[FFmpeg-user] Muxing multiple files and concatenating those outputs

Ted Park kumowoon1025 at gmail.com
Tue Apr 14 23:24:58 EEST 2020


> Example using these files (suffix denotes codec - a and b are each side of
> a call):
> 18_17_248.g729a
> 18_17_248.g729b
> 19_18_440.g711a
> 19_18_440.g711b
> 20_01_886.g729a
> 20_01_886.g729b
That is really confusing...

> Current method to concatenate and transcode to wav putting caller on left
> and callee on right:
> ffmpeg -f g729 -i 18_17_248.g729a -f g729 -i 18_17_248.g729b
> -filter_complex "[0:a][1:]amerge[aout]" -map "[aout]" out_1.wav
> ffmpeg -ar 8000 -y -f mulaw -i 19_18_440.g711a -ar 8000 -f mulaw -i
> 19_18_440.g711b -filter_complex "[0:a][1:a]amerge[aout]" -map "[aout]"
> out_2.wav
> ffmpeg -f g729 -i 20_01_886.g729a -f g729 -i 20_01_886.g729b
> -filter_complex "[0:a][1:]amerge[aout]" -map "[aout]" out_3.wav
> ffmpeg out_1.wav out_2.wav out_3.wav final.wav
> My goal is to syntactically accomplish this with one ffmpeg string (not
> pipes, ; or && bash syntax).
> I would appreciate any insight - I have tried everything I can find / think
> of without success.
The final command is supposed to concatenate the out_?.wav files into the final.wav file right?

I think the way you have them written, it makes it easy to combine it into one command, though I have to wonder what benefit (if any) you seek to get from it. Because, if you're scripting it, it really shouldn't matter, and if you're doing it by hand, doesn't it make one big command that has to be repeated if it fails? Anyhow,

> ffmpeg -f g729 -i 18_17_248.g729a -f g729 -i 18_17_248.g729b -ar 8000 -y -f mulaw -i 19_18_440.g711a -ar 8000 -f mulaw -i
> 19_18_440.g711b -f g729 -i 20_01_886.g729a -f g729 -i 20_01_886.g729b -filter_complex '[0][1]amerge,afifo[l1];[2][3]amerge,afifo[l2];[4][5]amerge,afifo[l3];[l1][l2][l3]concat=v=0:a=1:n=3' <insert output settings and output uri here>

I think this will do what you want, the individual input pads to amerge and/or fifo might not be needed.

Ted Park

More information about the ffmpeg-user mailing list