I have a video file(V1) and two stereo audio files(A1 & A2). I'm trying to output a movie with the video content and duration from V1, and I want to set A1's audio to the left channel and A2's audio to the right channel, even if those sources are originally stereo.

I've been playing around with the stereotools and pan filters but I'm honestly having trouble deciphering the documentation. Any help is appreciated.

  • 1
    It would probably help if you edited the question to show what you've actually tried so far – hardillb Apr 30 '18 at 21:44
  • I didn't even get to a point that was worth sharing unfortunately. – wsmith Apr 30 '18 at 22:05

I think I've got it or pretty close at least. I still need to figure out how to control the duration but the -shortest flag encodes it at the shortest duration which is actually what I need in this case.

ffmpeg -i video.mov -i audio1.wav -i audio2.wav -filter_complex "[1:a][2:a]amerge=inputs=2,pan=stereo|c0<c0+c1|c1<c2+c3[aout]" -map 0:v -map "[aout]" -shortest output.mp3
  • To make sure that the video stream isn't clipped, you should pad the audio i.e. pan=stereo|c0<c0+c1|c1<c2+c3,apad[aout] – Gyan May 1 '18 at 5:28

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.