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

Nicolas George george at nsup.org
Thu Apr 16 18:19:38 EEST 2020

Greg Oliver (12020-04-14):
> 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.

I suspect what you need is the concat filter. But you were not clear
enough about what exactly you are trying to achieve. Maybe make diagram?


  Nicolas George
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-user/attachments/20200416/ec4b3b21/attachment.sig>

More information about the ffmpeg-user mailing list