How to replace avi file soundtrack with another avi file soundtrack?

Posted on


I have a high resolution video which soundtrack is broken, then I have a low resolution video which soundtrack works. I want to combine high resolution video with the low resolution video soundtrack.

How can i do this without re-encoding the soundtrack or video?


If you want to do it via commandline, use FFmpeg (free, open-source, cross-platform).

First, extract the soundtrack from the correct video file. I assume the audio is MP3*.

ffmpeg -i correct.avi correct.mp3

Then, merge the broken file’s video bitstream with the new soundtrack:

ffmpeg -i broken.avi -i correct.mp3 -map 0:0 -map 1:0 -c:v copy -c:a copy out.avi

This will not re-encode the video and audio bitstreams.

* You can verify this by doing a simple ffmpeg -i correct.avi call and looking for the audio stream. Or, you can use MediaInfo. Note that the extension (here, .mp3) should really match the audio. If your AVI file does not have MP3 audio, but something else, you have to change the container accordingly.

You might want to have a look at VirtualDub:

VirtualDub features

  • Remove and replace audio tracks without touching the video.

avidemux should do this in copy mode. Alternately you should be able to strip out the audio and add it back in.

If you want to look for alternatives, you’re demuxing the audio and vidio to seperate them, and muxing them back together.

You can do this with either VirtualDub, AviDemux (doesn’t need extra codecs) or Xmedia Recode.
First, you gotta rip the audio out of the one file, preferably with GoldWave 4, because then you can store is as WAV, which is uncompressed, you need that to sync it.
Second, make sure your audio is EXACTLY the same lenght as the video, we’re talking thousands of seconds here. A difference of e.g. 0.234 seconds is okay, more than a second prolly will be bad.

Third, IF they are the same, open the video with either Vdub or AviDemux and look for the Add Audio from different source option. Add the WAV file. If it’s sync, you can then use compression to make the movie smaller.

You can adjust the length of the WAV file in Goldwave. You can do this, even when they are completely different and have totally different starts and endings. But that’s hard.

Leave a Reply

Your email address will not be published.