3

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?

2
  • moderately large is 2 gigs to you?
    – Cole Tobin
    Commented Sep 17, 2013 at 13:00
  • @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
    Commented Sep 17, 2013 at 17:58

2 Answers 2

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.

4
  • 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
    Commented Jun 19, 2013 at 12:34
  • 1
    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
    Commented Jun 20, 2013 at 18:35
  • 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
    Commented Jun 20, 2013 at 20:53
  • 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
    Commented Jun 21, 2013 at 22:14
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.

1
  • 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
    Commented Jul 16, 2014 at 16:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.