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

Greg Oliver oliver.greg at gmail.com
Tue Apr 14 23:42:11 EEST 2020

On Tue, Apr 14, 2020 at 3:30 PM Ted Park <kumowoon1025 at gmail.com> wrote:

> Hi,
> > 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...

Yeah, when we record the calls, the directory structure preceeding those
names is YYYY/MM/DD/HH and the filenames are MIN_SEC_MSEC.codec(side)

> > 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.

Yeah, the only issue is that if there are 10 legs of a call (think patient
calling a hospital and asking for neurology, getting the neurology
receptionist and then being transferred to a doctor who does not answer and
rings back to the receptionist who does not answer and then finally
arriving back at the main switchboard and the cycle starts over).  We may
have quite a few legs, so we must mux each leg prior to the concatenation.

I was really looking for just syntax to group commands, so I could use the
merge filter output as direct input for the concatenation.  The man page
and web searches I tried came up empty, but I figured someone may know some
magic sauce I could not find.


> Regards,
> Ted Park
> _______________________________________________
> ffmpeg-user mailing list
> ffmpeg-user at ffmpeg.org
> https://ffmpeg.org/mailman/listinfo/ffmpeg-user
> To unsubscribe, visit link above, or email
> ffmpeg-user-request at ffmpeg.org with subject "unsubscribe".

More information about the ffmpeg-user mailing list