[FFmpeg-user] Mixing two audio files to left/right channels, but using a (stream-copied) video from a third input

Lou lou at lrcd.com
Mon Nov 24 20:20:58 CET 2014

On Mon, 24 Nov 2014 17:04:24 +0100
Alfredo Di Napoli <alfredo.dinapoli at gmail.com> wrote:

> Hello everyone,
> and sorry if the title is convoluted, I couldn't find a better one. What
> I'm trying to accomplish is simple, in practice: Assume I have three files:
> - Left_Audio.mp3
> - Right_Audio.mp3
> - Video.mov
> (Extensions are not important). What I would like to achieve is to come up
> with a CLI command which would give me a resulting video such that:
> - The left audio channel of the output will be mixed from  Left_Audio.mp3
> - The right audio channel of the output will be mixed from Right_Audio.mp3
> - The video will be a stream copy of Video.mov

Since there is no info (ffmpeg console output) about your inputs I'll
assume your audio inputs are both stereo, and that you only want the
video stream from Video.mov while ignoring any other stream types:

ffmpeg -i Left_Audio.mp3 -i Right_Audio.mp3 -i Video.mov \
-filter_complex "[0:a][1:a]amerge,pan=stereo|c0<c0+c1|c1<c2+c3[aout]" \
-map 2:v -map "[aout]" -c:v copy -shortest output

More information about the ffmpeg-user mailing list