ffmpeg mixing up audio channels

Resubmitting because no one answered the question: I've recently noticed that when I encode a movie to h265 with aac 5.1 audio (probably will do the same on 7.1 too) the output had the forward channel playing from the rear. Dialog and other sounds I expected from the center speaker were coming from behind me. This is not an issue with the player/decoder, ffmpeg (latest version) is putting audio channels in the wrong place. How do I fix this? I thought maybe something with -map or -strict could help but I don't know the proper syntax.


Solution 1:

I figured it out: the proper syntax is -af "channelmap=0|1|2|3|4|5:5.1". You can switch 0 through 5 to put different channels in different places (kind of fun with odd results if you have the time to play around). You'd think that zero through 5 in sequential order would be the go-to arrangement of ffmpeg but I guess not as that was what I put in to get the audio to come out correctly when it wasn't doing so on its own.