<p>I have no idea if this is optimal for you, but one approach using free software would be to first determine the percentage (and direction) of drift by finding a point near the end where you can tell with some precision what the sync error is, in frames.</p>

<p>Demux the video and audio into separate streams, using a free tool like AVI-Mux. Load the audio into Audacity, and apply the time shift determined above, either as a "new length" or a ratio (frame error / total frames).</p>

<p>Export the audio and remux using the new track. </p>

CC BY-SA 3.0
2013-06-19T12:34:45.960Z
I do have audacity and I think I have some software that can rip out the audio stream. Does audacity allow you to edit the *length* of the audio track too? I know you can shift the whole thing forward, but what's the option to edit how it syncs up? The audio track is the right length but doesn't sync, so just shifting the start position won't fix it.
Zelda
CC BY-SA 3.0
2013-06-20T18:35:03.940Z
You can squeeze or stretch time in Audacity either as a percentage, or by simply specifying a new length for the track or selected portion. Under Effects, Change Speed / Tempo / Pitch. For a small drift just do a speed change and ignore the slight alteration in pitch. Doing a tempo change while maintaining pitch takes longer and may not sound as good.
Jim Mack
CC BY-SA 3.0
2013-06-20T20:53:15.047Z
Oh, hm. Is there any clever way to know how much of a % to tweak but or will I just have to play them side by side until it's right?
Zelda
CC BY-SA 3.0
2013-06-21T22:14:55.990Z
If it's noticeably out of sync, what is it that you notice? Find a spot near the end of the clip where you can identify a lag or lead, and note the video and audio times where the matching points occur. The difference in time, divided by the total time (either as frames or as decimal seconds) gives the percentage error. Or guess -- if it's a 30.0 vs 29.97 type error, use 0.001 as the factor, either plus or minus as needed.
Jim Mack
CC BY-SA 3.0
2013-06-19T11:04:14.703Z
2013-06-19T11:04:14.703Z
Jim Mack
<p>It is the video frame rate that VirtualDub can manipulate, and there is good reason for this. Recording involves encoding, which usually takes more processing power for video than for audio. Thus, video is more prone to glitches; you can better trust that the length of the audio stream is correct.  </p>

<p>It also seems easier to manipulate video. VirtualDub can simply duplicate or delete the necessary number of frames, evenly distributed along the length of the recording, and the human eye won't notice these artefacts.  </p>

<p>So I would recommend finding a software that can change the frame rate of mp4 files.</p>

CC BY-SA 3.0
2014-07-16T16:27:58.893Z
Processing audio is generally far easier than processing video.  Dropped frames produce highly noticeable artifacting unless interpolation is done around the dropped frames to blend over the sudden change of speed and missing data.  Also, adjusting the frame rate doesn't do anything about dropped frames.  The clock rate of an audio source is just as likely to be off as the clock rate of video, the only difference is that video is more likely to miss a frame entirely, but this is a separate type of problem.  (though drop frames can cause desync as well)
AJ Henderson
CC BY-SA 3.0
2014-06-11T22:05:44.120Z
2014-06-11T22:05:44.120Z
Gyula
<p>I've got some moderately large, compressed video files (~2+ gigs, over an hour long) from a few Open Broadcaster Software streams to Twitch.tv. All output files (including the twitch archive's export) have the dreaded gradual audio desync.</p>

<p>I have assorted tools to play with audio, but all of them seem to be failing me. Camtassia Studio barely loads the files (sometimes it just plain doesn't), and since the desync is gradual, Camtasia can't really help since I can only shift ALL audio.</p>

<p>I used to be able to fix a similar desync problem in Virtual Dub, which would change the "framerate" or some equivalent timing of the video or audio to make them match up in timing, I did this with small 10 minute AVI files and it worked like a charm. But Virtual Dub doesn't support mp4s with h264, and even after adding a plugin to give VDub support for them it crashes when I load the files in Virtual Dub.</p>

<p>Is there any moderately easy way to correct this audio sync? I have about 6 video files to work with, all over an hour long, so manually adjusting timing with millisecond precision just isn't practical. I have Camtasia Studio and access to any free software for x64/32 bit windows and I'm willing to buy software to fix this as well, I just have no idea what I'm looking for to make this really work.</p>

<p>How can I fix gradually desynced audio in large video files?</p>

CC BY-SA 3.0
2013-09-17T13:00:52.780Z
_moderately_ large is 2 gigs to you?
Cole Tobin
CC BY-SA 3.0
2013-09-17T17:58:20.343Z
@ColeJohnson for a final file file to upload to youtube it's pretty big, but for a source file for editing I'll often have 5-40GB files for 30 minutes to an hour, over 100 GB with a long Fraps recording (but those get compressed/chopped up quite a bit)
Zelda
<video><audio><editing><sync>
Fixing desync in a large, long video file
Zelda
# Fixing desync in a large, long video file

(Asked by: username_0 on 2013-06-19)

I've got some moderately large, compressed video files (~2+ gigs, over an hour long) from a few Open Broadcaster Software streams to Twitch.tv. All output files (including the twitch archive's export) have the dreaded gradual audio desync.

I have assorted tools to play with audio, but all of them seem to be failing me. Camtassia Studio barely loads the files (sometimes it just plain doesn't), and since the desync is gradual, Camtasia can't really help since I can only shift ALL audio.

I used to be able to fix a similar desync problem in Virtual Dub, which would change the "framerate" or some equivalent timing of the video or audio to make them match up in timing, I did this with small 10 minute AVI files and it worked like a charm. But Virtual Dub doesn't support mp4s with h264, and even after adding a plugin to give VDub support for them it crashes when I load the files in Virtual Dub.

Is there any moderately easy way to correct this audio sync? I have about 6 video files to work with, all over an hour long, so manually adjusting timing with millisecond precision just isn't practical. I have Camtasia Studio and access to any free software for x64/32 bit windows and I'm willing to buy software to fix this as well, I just have no idea what I'm looking for to make this really work.

How can I fix gradually desynced audio in large video files?

**Tags:** video, audio, editing, sync

> **Comments:**
> **username_1**: _moderately_ large is 2 gigs to you?  
> **username_0**: @ColeJohnson for a final file file to upload to youtube it's pretty big, but for a source file for editing I'll often have 5-40GB files for 30 minutes to an hour, over 100 GB with a long Fraps recording (but those get compressed/chopped up quite a bit)  

---

## 2 answers

### Answer by username_2 on 2013-06-19. Score: 3

I have no idea if this is optimal for you, but one approach using free software would be to first determine the percentage (and direction) of drift by finding a point near the end where you can tell with some precision what the sync error is, in frames.

Demux the video and audio into separate streams, using a free tool like AVI-Mux. Load the audio into Audacity, and apply the time shift determined above, either as a "new length" or a ratio (frame error / total frames).

Export the audio and remux using the new track.

> **Comments:**
> **username_0**: I do have audacity and I think I have some software that can rip out the audio stream. Does audacity allow you to edit the *length* of the audio track too? I know you can shift the whole thing forward, but what's the option to edit how it syncs up? The audio track is the right length but doesn't sync, so just shifting the start position won't fix it.  
> **username_2**: You can squeeze or stretch time in Audacity either as a percentage, or by simply specifying a new length for the track or selected portion. Under Effects, Change Speed / Tempo / Pitch. For a small drift just do a speed change and ignore the slight alteration in pitch. Doing a tempo change while maintaining pitch takes longer and may not sound as good.  
> **username_0**: Oh, hm. Is there any clever way to know how much of a % to tweak but or will I just have to play them side by side until it's right?  
> **username_2**: If it's noticeably out of sync, what is it that you notice? Find a spot near the end of the clip where you can identify a lag or lead, and note the video and audio times where the matching points occur. The difference in time, divided by the total time (either as frames or as decimal seconds) gives the percentage error. Or guess -- if it's a 30.0 vs 29.97 type error, use 0.001 as the factor, either plus or minus as needed.  

---

### Answer by username_3 on 2014-06-11. Score: 0

It is the video frame rate that VirtualDub can manipulate, and there is good reason for this. Recording involves encoding, which usually takes more processing power for video than for audio. Thus, video is more prone to glitches; you can better trust that the length of the audio stream is correct.

It also seems easier to manipulate video. VirtualDub can simply duplicate or delete the necessary number of frames, evenly distributed along the length of the recording, and the human eye won't notice these artefacts.

So I would recommend finding a software that can change the frame rate of mp4 files.

> **Comments:**
> **username_4**: Processing audio is generally far easier than processing video.  Dropped frames produce highly noticeable artifacting unless interpolation is done around the dropped frames to blend over the sudden change of speed and missing data.  Also, adjusting the frame rate doesn't do anything about dropped frames.  The clock rate of an audio source is just as likely to be off as the clock rate of video, the only difference is that video is more likely to miss a frame entirely, but this is a separate type of problem.  (though drop frames can cause desync as well)  

---

