[Ffmpeg-devel] channel ordering and downmixing

Paul Curtis pfc
Fri Mar 30 00:16:13 CEST 2007

Justin Ruggles wrote:

> #2) define a standard FFmpeg channel order and change decoders to always
>     output in that order.  this would be simpler, but has the problem
>     stated above with containers vs. codecs.  the demuxer could choose
>     to tell the decoder the channel order or else leave it up to the
>     decoder.  i can't think of a clean way to use this on the encoding
>     side though.

I, too, have been looking at this problem. Your second solution looks 
like the best way to handle it. I had the idea of having a default 
channel mapping to start with, then when the container was opened, if it 
had a channel mapping, it would set it. If the codec had a different 
mapping, it would then override the container's mapping. That way, a 
container with PCM would set the mapping, or in the AC3 case, the codec 
would override it. This is on decode.

On encode, that reverse process would occur ... the container would set 
it's "preferred" channel mapping, and the codec could override it. You 
could also have an option (a la 'mplayer') to force the mapping, if needed.

On down mixes, it would be a bit more complex. For example, a MPEG-TS 
with 5.1 audio converting to a FLV with two channels. That mapping would 
be a bit problematic, as where would the mapping occur? My thoughts were 
to have the 5.1 presented by the decoder, and then down mixed in the 
codec similar to the way it is handled now.

Just my random thoughts while trying to convert DVB 5.1 audio to DVD 5.1 


More information about the ffmpeg-devel mailing list