merging video and audio with custom panning
- by cherouvim
I have:
a video which has mono audio inside
a audio (mono)
I'd like to merge those two to a single video file containing:
video from #1
audio from #1 full left pan + audio #2 full right pan
Is this possible in ffmpeg using 1 command?
I've tried the following which almost does this but the video/audio gets out of sync:
ffmpeg -i video.mp4 -filter_complex "amovie=audio.wav [r] ; [r] amerge" output.mp4 -y
I've managed to do it with multiple commands:
#1 create right panned audio
ffmpeg -i audio.wav -ac 2 -vbr 5 audio-stereo.mp3 -y
ffmpeg -i audio-stereo.mp3 -af pan=stereo:c1=c1 audio-right.mp3 -y
#2 create left panned video
ffmpeg -i video.mp4 -af pan=stereo:c0=c0 video-left.mp4 -y
#3 merge the two
ffmpeg -i video-left.mp4 -i audio-right.mp3 -filter_complex "amix=inputs=2" video-mixed.mp4 -y
It does the job, but is it possible with 1 command?