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

Greg Oliver oliver.greg at gmail.com
Tue Apr 14 20:49:23 EEST 2020


Hi,

We currently use ffmpeg to combine 2 streams (telephony codecs) into
mp3/wav/flac, etc..  This is no problem - we use:

ffmpeg -ar 8000 -y -f mulaw -i calls/example.g711a.ulaw -ar 8000 -f mulaw
-i calls/example.g711b.ulaw -filter_complex "[0:a][1:a]amerge[aout]" -map
"[aout]" output.wav

If we have multiple legs of a recording, we just use linux `cat' to
concatenate them prior to ffmpeg processing (we have raw audio frames
without headers, etc, so this works fine).

Due to Covid, almost all of our customers have moved their call centers to
employee homes, so we have mixed codec calls and the necessity has arose to
generate audio files accordingly.  It is easily accomplished with multiple
temporary files, but I would like to clean it up and have been unsuccessful
in coming up with a single string to accomplish it.

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

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.

TiA,

Greg


More information about the ffmpeg-user mailing list