[FFmpeg-devel] [PATCH] audio filter 'merge them all'
george at nsup.org
Mon Jun 30 19:26:04 CEST 2014
Le duodi 12 messidor, an CCXXII, Gaullier Nicolas a écrit :
> This patch makes it possible to use 'amerge' filter with 'inputs=-1' to
> merge 'all' audio input streams.
> The 'killer use case' is to batch-convert input files with varying/unknown
> input audio mappings.
> ffmpeg (...) -filter_complex "amerge=inputs=-1[a]" -map 0:v -map [a] -d10_channelcount 8 -f mxf_d10 d:\output-naudios.mxf
> It is possible with a unique command line to process input files with 1 or
> several mono tracks, 1 or several stereo tracks, and more.
I strongly object to this patch: it has changes all over the place, with
some aspects of API design that completely contradict good practices (like
avoiding global variables), for one very specific use case, and does not
even generalize well beyond that use case.
At some point, people need to realize that AV encoding is too complex for
ffmpeg to always have the perfect -do_what_i_mean option. If you need to
process input files with various structure, then use a proper scripting
language, first calling ffprobe to get the characteristics of the file and
then building the corresponding ffmpeg command-line.
Still, if you really want it to work in one go, there are still cleaner ways
of doing it. You can, in ffmpeg_opt.c alone, have a "-merge_all_audio"
option that builds just the right "amerge=inputs=n" filter and use it for
Or you could allow to use globs to connect several inputs at once:
ffmpeg -i file -filter_complex '[0:a:*] amerge [aout]'
would automatically connect all audio streams in file #0 to amerge, but that
would work for other filters too. This one requires some design, but it
would be quite useful IMHO.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Size: 819 bytes
Desc: Digital signature
More information about the ffmpeg-devel