Christian Genco


Replace audio in a video #

ffmpeg -i video.mp4 -i audio.aac -c:v copy -map 0:v:0 -map 1:a:0 out.mp4

If your audio is getting downsampled to 128kb/s, try adding -acodec libfaac -b:a 256k.

If your audio came from a video of the same format add -c:a copy.

Extract audio #

ffmpeg -i video.mp4 -vn audio.mp3

You can also use -acodec copy if approporiate.

Embed .srt subtitles in an .mp4 #

This method is supported by QuickTime.

ffmpeg -i video.mp4 -i -map 0:0 -map 0:1 -map 1:0 -c:s mov_text out.mp4