Tech Tip: Overriding the Audio Track of a Video using ffmpeg
In this tip I will cover how to use ffmpeg to override the audio track of a video from a different audio track (such as the one in a WAV, an OGG or an MP3 file). To do that use the following recipe (based on this out-of-date blog post and some help from ubitux on #ffmpeg, with a lot of trial and error):
ffmpeg -i in_audio.wav -i in_video.ogv -map 0:0 -map 1:1 -shortest \
-c:a libvorbis -q:a 7 -c:v copy output.ogv
Some of these files are not needed if you're not dealing with Ogg Video files. -shortest is useful for making sure that the length of the output is trimmed to that of the shortest input.
I ended up using this command for the latest screencast I prepared. Cheers, and happy holidays.
