0

I need to mix the first audio-track into left channel and the second into right. When audio-tracks are stereo, this does the job.

ffmpeg -i 1.mkv -filter_complex "[0:a:0][0:a:1]amerge=inputs=2,pan=stereo|c0<c0+c1|c1<c2+c3[aout]" -map "[aout]" 1.mka

But when there are more channels - how can I do it? Without manually checking number of channels and inserting them myself.

0

Use

ffmpeg -i 1.mkv -filter_complex "[0:a:0]pan=1c[a0];[0:a:1]pan=1c[a1];[a0][a1]amerge=inputs=2[aout]" -map "[aout]" 1.mka

You'll need either FFmpeg 4.0 or a git build later than Feb 19 2018.


With older versions, you have to use multiple commands to do it

ffmpeg -i 1.mkv -map 0:a:0 -ac 1 a0.wav -map 0:a:1 -ac 1 a1.wav

ffmpeg -i a0.wav -i a1.wav -filter_complex amerge 1.mka
2
  • 4.0 is the only way? on 3.4 it's impossible? Apr 25 '18 at 17:09
  • Before 4.0, one has to manually supply the rematrixing. Which you want to avoid. But you can use new command.
    – Gyan
    Apr 25 '18 at 17:16

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.