Alex Balgavy

Just some stuff about me.

Here's my dotfiles repository.

Check out my blog.

My keys: PGP, SSH

My crypto wallets (BTC, XMR)

ffmpeg how to replace the audio on a video

Written by John Riselvato - original link

There are times when the audio on a video needs to be replaced. Here filters are not even needed to replace audio but the use of ​-map becomes important to understand:

$ ffmpeg -i input.mp4 -i input.mp3 -map 0:v -map 1:a -shortest output.mp4

Here the video from the first input and the audio from the second input is mapped to the output.

**Challenge:**​ Using the same concepts in the above example, if two inputs were videos, how would you replace the first input video with the second input video but keep the first input’s audio?