How to replace a video’s audio with FFMPEG

To replace audio in a video without having to re-encode the video you can use a tool called ffmpeg. This is very useful as a way to avoid loss of quality for the video. Don’t want to read a whole article? The short answer is install FFMPEG and use this command:

ffmpeg -i source_video.mp4 -i source_audio.wav -acodec copy -vcodec copy -map 0:v:0 -map 1:a:0

Now lets break it down.


FFMPEG is a a terminal program, so you’ll need to go to the Utillities folder inside of the applications folder and install homebrew


brew install ffmpeg

From there you can enter the command like so:

ffmpeg -i /path/to/movie/file.mp4 -i /path/to/audio/file.wav -acodec copy -vcodec copy -map 0:v:0 -map 1:a:0

-i -- the input file(s)
-acodec copy -- this means keep the audio codec from the source file
-vcodec copy -- this means keep the video codec from the source file
-map 0:v:0 -- This is a complicated option that specifies that we want to take the video from the first stream and the audio from the 2nd stream

I find it often easier on macOS to drag the file locations to terminal

Prepping your audio file

The new audio file in the video will start at the exact moment that the old one did, so you’ll want to match them.

If you are using Pro Tools the “tab to transients” feature is very useful here if you are syncing externally recorded audio to camera audio. Find a transient (a loud brief noise like a drum hit or a ‘k’ sound) and tab-to-transient it on both the camera audio and the recorded audio. Create a sync point (command-,) Then slide the externally-recorded audio to the sync point. From there “move edit set up” or just ‘P’ on the keyboard to the recorded audio and trim it down to exactly match the camera audio then export

File Formats

If you’re like me you want a version of the video with a lossless audio file. This is why the container format is .MOV in that command because .MOV files can handle .WAV files. MP4 files can only handle lossy files.