[FFmpeg-devel] [RFC] lavfi audio buffers and channel layout

Stefano Sabatini stefasab at gmail.com
Mon Jul 30 19:07:04 CEST 2012

On date Monday 2012-07-30 18:27:17 +0200, Nicolas George encoded:
> Le tridi 13 thermidor, an CCXX, Stefano Sabatini a écrit :
> > Possible solutions: we validate the channel layout when opening the
> > movie, if we can guess the channel layout from the number of channels,
> > we warn and set it in the decoder context. In case we can't map
> > nb_channels -> channel layout we just complain and fail.
> That is what ffmpeg does: guess_input_channel_layout().

Can't find that function in ffmpeg.c.

> > I don't know if this is a good idea, since we require the filtergraph
> > to be set up with a defined channel layout, and introducing a
> > nb_channels we may trigger possible inconsistencies in the filtergraph
> > (in case nb_channels doesn't match with the channel layout).
> Risks of inconsistencies are always bad.
> Also, IMHO, it is not a good idea to let people be too sloppy with channel
> layouts, because that kind of bugs is very annoying and quite hard to debug.
> So getting them to at least know there may be a problem by making them use a
> channel_layout mask instead of simply a number of channels is probably
> better.

We could follow this path: we open the decoder context in movie, in
case the channel layout is not set we try to auto-select it based on
the number of channels, warn and re-open the decoder.

It would be also useful to let the user set the channel layout
explicitely, but this requires support to generic options in movie,
which is not yet implemented.
FFmpeg = Free and Funny Mastodontic Power Ecumenical Gadget

More information about the ffmpeg-devel mailing list