An AVI file where the sound no longer matches the picture means you are dealing with avi audio out of sync. The mismatch can show up as a fixed delay or as drift that worsens the longer the video plays. The cause is specific to how AVI handles audio and video timing. Here is why the sync breaks and the practical steps to fix both a simple offset and progressive drift.

Why AVI Sync Problems Happen

AVI was designed with steady bitrate audio in mind. When the audio stream uses VBR MP3 (variable bitrate MP3), some players miscalculate the total audio duration because the bitrate changes from frame to frame. This leads to avi audio drift over the length of the file. Another common cause is a missing or damaged index, which makes players guess the timing of each frame. Without a correct index, the audio and video can appear to be out of sync even if the underlying data is fine. Dropped frames during capture also shift the video relative to the audio, creating an offset that is fixed from start to finish.

Offset Vs. Drift Know the Difference

A fixed offset means the audio is behind or ahead by the same amount for the whole video. Shift the audio track to fix it. Drift means the delay changes over time. The audio might match at the beginning but be off by the end. Drift requires re-encoding the video to realign the streams properly.

Quick Fix Adjust Playback in VLC

If you only need to watch the file once and do not want to re-encode it, VLC can compensate for a fixed offset during playback. While the video is playing, press J to delay the audio by a short amount or K to advance it by a short amount. This is a temporary adjustment and does not modify the file. It works for a fixed offset. It cannot correct drift that grows over time.

Fix a Constant Offset with FFmpeg

To permanently fix a fixed audio delay, use FFmpeg to shift the audio stream. The -itsoffset option delays an input by a given time. Here is the procedure:

  1. Open a terminal or command prompt.
  2. Run this command, replacing input.avi with your file and the delay with the offset in seconds (use a negative value to advance audio):ffmpeg -i input.avi -itsoffset [delay] -i input.avi -map 0:v -map 1:a -c copy output.avi
  3. Play the output file to check if the sync is correct. Adjust the offset value as needed.

Fix Drift by Re Encoding

Measure the Drift First

Drift requires re-encoding the video with corrected timing. One approach is to extract the audio, adjust its speed slightly, and remux it. Another is to use FFmpeg to resample the audio to match the video duration. Because the exact method depends on the source file, measure the drift at the start and end of the video, then calculate a correction factor. Re-encoding is more time consuming but produces a file that stays in sync from beginning to end.

Using FFmpeg for Drift Correction

Use the aresample filter to change the audio duration. If the video runs longer than the audio, speed up the audio slightly. The tempo value is calculated as video duration divided by audio duration. Test the result and adjust if necessary.

Rebuild a Damaged Index

A missing or damaged index can cause players to guess frame positions, leading to sync errors. Rebuilding the index fixes the problem without changing the audio or video data. Some video editors and conversion tools can reindex AVI files. If you have FFmpeg, try remuxing the file with the -fflags +genpts option to generate new timestamps. A simpler option is to use avi.repair, an online tool that can rebuild the index and correct sync issues caused by a broken index.

Prevent Sync Problems in Future Captures

To avoid avi sound lag and drift when capturing video, use constant bitrate audio instead of VBR. Ensure your capture software does not drop frames, and check the index after recording. If you already have a file with vbr mp3 avi sync issues, re-encode the audio to a constant bitrate format like PCM or CBR MP3 before editing.