Add or replace the music of a video
Completely replace a video's audio with music, or add background music under the original voices. The video is copied without re-encoding; only the audio is recreated.
Updated on
How to use it
- Install ffmpeg if you haven't already.
- Put the video and the music in the same folder, then open a terminal in that folder.
- Copy the generated command, adjust the file names if needed, then run it.
- Open the resulting file to check the result.
Replace or mix?
Replace the audio for a purely musical edit, a timelapse or a video whose audio is useless. Mix to keep the original voices or ambience with music in the background: in that case, set the music volume to "Low" so it doesn't drown out the speech.
How mixing works
The amix filter adds the two audio sources together. The music volume is applied beforehand, and the final duration follows that of the video. The video is copied without modification thanks to "-c:v copy".
Frequently asked questions
The music is longer than the video. What happens?
The command stops at the end of the video: the music is cut off. If the music is shorter, in replace mode the video is shortened to the length of the music; in mix mode, the video keeps its duration and the music simply stops.
Mix mode fails with an error about "[0:a]". Why?
The video has no audio track: there is nothing to mix. Use the "Replace" mode.
Can I use any music?
Technically yes, but for a published video, the music must be royalty-free or you must have permission to use it. Platforms often detect and block copyrighted music.
ffmpeg says "Option 'normalize' not found". What should I do?
Your version of ffmpeg is too old for the mix mode as written. Update ffmpeg, or remove ":normalize=0" from the command: the mix will work, but the original audio will be a little quieter.