[FFmpeg-user] Amerge trouble

Erik Dobberkau erik.dobberkau at gmail.com
Sat Nov 18 16:54:15 EET 2017


2017-11-18 15:12 GMT+01:00 Bouke / VideoToolShed <bouke at videotoolshed.com>:

> Hi guys,
> Trying to do some audio patching from multiple input files, and output a
> QT or MXF with a poly soundtrack.
> Now this turns out to be a hell of a job, I can’t grasp the logic on how
> the patching works.
>
> Y\LTC_Convert\FF\ffmpeg -threads 1 -i V\!patch\test.mxf -ss 0.0000 -i
> V\!patch\snd.wav -map 0:0 -filter_complex "[1:a][0:a:2][1:a][0:a:1][0:a:
> 3]amerge=inputs=5,pan=5c|c0=c9|c1=c1|c2=c8|c3=c0|c4=c2[a]" -map "[a]" -ca
> pcm_s24le -cv copy -timecode 01:00:00:00 -y V\!patch\active\test.mxf"
>
> FFmpeg returns:
> Stream mapping:
>   Stream #0:2 (pcm_s24le) -> amerge:in3
>   Stream #0:3 (pcm_s24le) -> amerge:in1
>   Stream #0:4 (pcm_s24le) -> amerge:in4
>   Stream #1:0 (pcm_s24le) -> amerge:in0
>   Stream #1:0 (pcm_s24le) -> amerge:in2
>
> This looks all good, so the problem must be in how I define the pan, but
> for the life of me I can’t understand how the numbers work.
> It seems (by other tests) that the input track up numbers based on what is
> already set, but it’s still erratic..
>
> I would expect to get (output = from input file)
> sndTrack 0 = snd.wav 2
> sndTrack 1 = test.mxf 2
> sndTrack 2 = snd.wav 1
> sndTrack 3 = test.mxf 1
> sndTrack 4 = test.mxf 3
>
> but, the result has channels mapped as
> sndTrack 0 = snd.wav 1
> sndTrack 1 = snd.wav 2
> sndTrack 2 = test.mxf 3
> sndTrack 3 = snd.wav 1
> sndTrack 4 = snd.wav 3
>
> Isn’t there a simple way to set the patching? Or, where is my logic off?
>
>
Hi Bouke,

I would have thought

-filter_complex "[1:a:1][0:a:1][1:a:0][0:a:0][0:a:2]amerge=inputs=5"

would get you what you want.

-filter_complex "[1:1][0:a:1][1:0][0:a:0][0:a:2]amerge=inputs=5"

should also work, as well as

-filter_complex "[1:1][0:2][1:0][0:1][0:3]amerge=inputs=5"

No pan filter required, if you require one output stream with 5 audio
channels.

If you specifiy audio by using "a", you need to start counting from zero.
If you omit "a", the stream number depends on the arrangement of streams in
the file.


Best regards,
Erik


More information about the ffmpeg-user mailing list