[FFmpeg-user] FFmpeg apply same audio mixing to multiple output

Moritz Barsnick barsnick at gmx.net
Mon Mar 30 16:25:13 CEST 2015

On Mon, Mar 30, 2015 at 06:45:40 -0700, Jeromy wrote:
> ./ffmpeg -i 1.amr -i 2.amr -filter_complex amix=inputs=2:duration=longest:dropout_transition=2 -c:a amr_nb -ac 1 -ar 8000 -b:a 12.2k -y output1.amr -c:a pcm_alaw -ac 1 -ar 16000 -y output2.wav -c:a pcm_mulaw -ac 1 -ar 16000 -y output2.wav

By the way, you have three outputs, two of them named output2.wav! And
where's your MP3 output? You should habe noticed this from your output
stream mapping.

Assuming you mean to have three:

> The problem is that audio mixing is applyed only to first amr file.
> How can I apply the audio mixing to all output file.

You should change to something like this:
$ ffmpeg -i 1.amr -i 2.amr -filter_complex "amix=inputs=2:duration=longest:dropout_transition=2,asplit=3[audio1][audio2][audio3]" -map "[audio1]" -c:a amr_nb -ac 1 -ar 8000 -b:a 12.2k -y output1.amr -map "[audio2]" -c:a pcm_alaw -ac 1 -ar 16000 -y output2.wav -map "[audio3]" -c:a libmp3lame -ac 1 -ar 16000 -y output3.mp3

Note splitting the filter output into three using
and mapping each of those filter chain outputs to an output encoder using
  -map "[audioX]"

This gives me:
Stream mapping:
  Stream #0:0 (pcm_s16le) -> amix:input0
  Stream #1:0 (pcm_s16le) -> amix:input1
  asplit:output0 -> Stream #0:0 (libopencore_amrnb)
  asplit:output1 -> Stream #1:0 (pcm_alaw)
  asplit:output2 -> Stream #2:0 (libmp3lame)

which should be what you intended.

please let us know how it works,

More information about the ffmpeg-user mailing list