[FFmpeg-devel] [PATCH] avfilter/af_amerge: add reorder_inputs option to be able to turn off reordering

Tobias Rapp t.rapp at noa-archive.com
Tue Sep 6 10:04:07 EEST 2016

On 05.09.2016 16:43, Nicolas George wrote:
> Le decadi 20 fructidor, an CCXXIV, Marton Balint a écrit :
>> The order of the channels to remain unchanged regardless of the input
>> channel layout (which is often guessed only). Filtering in ffmpeg is
>> unfortunately forcing you to use channel layouts, even if you don't want to,
>> even if you only want to say: this track has 2 channels, that stream track
>> has 1 channels. Don't assume anything else.
> I feel Carl Eugen has the right of it.
> libavfilter can work with streams with unknown layouts, but some individual
> filters may not. To make them work is relatively easy. First, make sure they
> do not use the channel layout: most filters from the fork will use the
> channel layout to know the number of channels, we have a separated field for
> that. Then declare accordingly the list of formats in query formats.
> The real problem is ffmpeg.c: it will try to guess the channel layout when
> none is specified. I think I added an option to avoid that, but it may have
> been lost at some point.

-guess_layout_max 0

But indeed when using it I stumbled over similar filter issues (amerge 
or pan?). In the end I stopped using it and let the guessing do its 
work, instead I added "-write_channel_mask off" on AVI output side.

And there seems to be no option to explicitly set an unknown input 
channel layout (as Marton noted).

> And of course, most of the time, there is a channel layout, you just have to
> make sure it is properly set at input and let the logic do its work.
>> Another example: You have a file, with mono tracks. Some tracks have correct
>> metadata describing the channel layout of the files, others don't.
>                                                        ^^^^^^^^^^^^
> This is what needs fixing.
>> 								     You wan't
>> the channels in file-order, regardless of the correctness of the input
>> channel layout metadata in the file.
> Not true. Codecs work with the channel layouts, for inter-channel
> correlation, for the cutoff frequency on the subwoofer, etc.


More information about the ffmpeg-devel mailing list