[FFmpeg-devel] [PATCH]Warn if the flac encoder outputs files with incorrect channel layout or guesses the channel layout

Carl Eugen Hoyos cehoyos at ag.or.at
Mon Apr 25 18:37:30 CEST 2011

Stefano Sabatini <stefano.sabatini-lala <at> poste.it> writes:

> > in the long term we maybe want a
> > list of supported channel layouts in AVCodec so this could be
> > checked more generically in utils.c for more encoders
> In general we may need a number-of-channels<->channel-layout map,



> I don't know if this mapping is specific for each encoder/decoder
> though.

There is exactly one FFmpeg-specific channel_layout <-> channel_order mapping.
(It is identical to wav order and implicitly specified in audioconvert.h.) All
decoders that output channel layout should only output audio in FFmpeg channel
order. (Everything else would be a nightmare to maintain, don't you think?) I
currently don't know of a decoder that violates this rule. All encoders should
expect this layout (libfaac doesn't, but that is a known bug, not a design
limitation). AC-3 works fine even with strange layouts.

PCM defines no channel layout, so the audio filter system will need a
possibility to specify a channel layout. That could also be used to work-around
problems, but I don't think that should be the primary goal. The important thing
- imo - is to be able to a) downmix: 5.0 or 5.1back -> quad or stereo and b)
upmix (for the encoders/devices that only support a small subset of possible
channel layouts).

I believe the file I attached to ticket #98 should see re-ordering in lavc
(triggered by lavf). I don't understand how other solutions wouldn't make the
interface as a whole much more complicated.

Carl Eugen

More information about the ffmpeg-devel mailing list