[FFmpeg-user] Channel manipulation and audio filter equivalencies

Chris Angelico rosuav at gmail.com
Thu Nov 5 17:43:53 EET 2020

Hi! (First time post on this list.)

I'm not a hugely skilled audiophile, and I'm trying to do some audio
manipulation with ffmpeg. At times, the result isn't what I'd like it
to be, and I'm not always sure why, so the first step right now is to
try to understand what on earth it is that I'm actually asking ffmpeg
to do :)

Primary references:

My input file has eight audio channels and is described by ffprobe as
"7.1". If I use the channelsplit filter, I can listen to any channel

ffmpeg -loglevel error -stats -y -i Original.mkv -filter_complex
'channelsplit=channel_layout=7.1' -map 0:v -map 0:s channel_split.mkv

(Without loglevel error, this produces massive spam of "Queue input is
backward in time", but the audio is fine. As a side point, I'm curious
as to whether there's a better solution than simply silencing those

The result is a file with video and subtitle streams unchanged, and
eight individual audio streams. With judicious use of
"-metadata:s:a:%d" these can even be labelled, making them easy to
flip through. Well and good.

The real challenge is selecting two channels and trying to make them
into the left and right channels of a new stereo audio channel. One
option is channelmap:

ffmpeg -loglevel error -stats -y -i Original.mkv -af
'channelmap=map=BL|BR' channel_split.mkv

Another option is pan:

ffmpeg -loglevel error -stats -y -i Original.mkv -af
'pan=stereo|c0=BL|c1=BR' channel_split.mkv

According to the docs, pan should detect a pure channel mapping and do
an optimized lossless remap, which in theory should mean that these
two are the same. But my understanding must be wrong, because they
sound completely different :)

A third option is join:

ffmpeg -loglevel error -stats -y -i Original.mkv -af
'join=inputs=1:map=0.BL-FL|0.BR-FR' channel_split.mkv

This sounds very similar to the pan result, but quieter.

What am I doing wrong with the channelmap, and what is the preferred
way to create a stereo output by selecting channels?

Chris Angelico

More information about the ffmpeg-user mailing list