View Full Version : Audio Sync Problem
jriker1
22nd December 2005, 04:46
I have an AVI file that I'm converting to mpv and ac3 to burn to DVD. Clip is about 1 hour 45 minutes long. Movie is in sync for about 45 minutes or so and then starts getting out of sync by about a half to a full second. Info on the clip:
- AVI-MUX says there is no delay in the original AVI file with the audio.
- AVI is 25 fps
- When opening in VirtualDUB get an improper VBR and message about rewriting header.
- Sonic Scenarist sees the video converted with a length of 01:45:30;07
- Sonic Scenarist sees the audio converted with a length of 01:45:29;20
- In Virtual Dub Mod under Video > Framerate > Change so video and audio duration match had (25.002) in parenthesis
- In Virtual Dub Mod under Video > Framerate > Change so video and audio duration match has (9945.827) for some reason.
- GSpot info:
- Runtime: 01:45:30 (158,258 fr)
- xy: 512x288 (1.78:1) [=16:9]
- Bitrate: 780 kb/s
- FPS: 25.000
- Audio: 0x0055(MP3) ID'd as MPEG-1 Layer 3
- Bitrate: 133 kb/s (66/ch, stereo) VBR LAME3.91
- Media Player says the file is 1:45:30 in length
- All audio programs I'm looking at say the audio is 01:45:29 in length which doesn't seem right as it doesn't match the video length and since it starts out in sync can't be accounted for by a delay.
Tried converting the audio using Virtualdubmod and HeadAC3he, virtualdub with full processing and HeadAC3he , Adobe Audition. Then use Sonic Soft Encode to create an AC3. They all end up the same length and all out of sync.
Any help to fix this would be extremely appreciated.
Thanks.
JR
Matthew
22nd December 2005, 06:36
I take it the original avi is out of sync too?
If the sync is progressive (and it sounds like it) then from the 45 min point then I'd suggest using a wav editor (wavelab, cool edit, sound forge, etc) to cut out and timestretch the affected segment, and then rejoin.
setarip_old
22nd December 2005, 08:30
When opening in VirtualDUB get an improper VBR and message about rewriting header.
If the original .AVI is in synch (If the asynchronous condition appears only after conversion), try the following:
Use NanDub or VirtualDubMOD (Different than standard VirtualDub), to save the audio stream as an Uncompressed PCM (WAV) file as follows:
1) Load your original .AVI into NanDub
2)Set "Video" to "Direct Stream Copy"
3) Set "Audio" to "Full Processing Mode" (NanDub only -For VirtualDubMOD>"Streams>"Stream list">>rightclick on the listed audiostream and then select "Full Processing Mode")
From the "Audio" dropdown menu, select "Compression" and choose "No compression(PCM)" (NanDub only - For VirtualDubMOD>"Streams>"Stream list">>rightclick on the listed audiostream and then select "Compression" and choose "No compression(PCM)")
4) From the "File" dropdown menu, select "Save WAV" (In VirtualDubMOD, "Save WAV" is located under the "Streams" drodpown menu) (Enter a new filename with a ".WAV" extender).Click on "OK"
5) Then save the .AVI as a silent .AVI (NanDub - set "Audio" to "No audio" after you've saved the WAV file. - For VirtualDubMOD>"Streams>"Stream list">>click on the listed audiostream and then select "Disable").
Then close NanDub and restart it
Set "Audio" to "No audio" (Not necessary under VirtualDubMOD)
Load your silent .AVI
Set "Video" to "Direct Stream Copy"
Under "Audio" click on "WAV Audio" and load your .WAV (In VirtualDubMOD, Streams>>Add)
Set "Audio" to "Full Processing Mode" (In VirtualDubMOD, Streams>>Rightclick on the listed audiostream, click on "Direct Stream Copy")
From the "Audio" (In VirtualDubMOD, "Streams") dropdown menu, select "Compression" (In VirtualDubMOD, rightclick on the listed audiostream, click on "Compression") and choose the appropriate .MP3 settings. Click on "OK"
From the "File" dropdown menu, select "Save as AVI" (In VirtualDubMOD, "Save as") and save your file with a new filename.
jriker1
22nd December 2005, 17:38
Wow. Thanks for the detailed reply. Yes, the original AVI seems to be in perfect sync throughout the file. Strange though that VirtualDubMod would show the audio length a second shorter than the video. I will try as you suggest when I'm done testing something else. I was going through the process in VirtualDubMod to do Video > FrameRate > Change so video and audio match. Not sure 25.002 is really a valid framerate, however saw this suggestion out there before your post came through so didn't want to waste a 66GB file I just created for testing. This new file shows the video a second shorter than it used to be and matching the audio. Not sure if t his bought me anything though.
I've always had sync problems with AVI files using MP3 audio. If the AVI has AC3 audio, never had a problem.
jriker1
23rd December 2005, 00:32
Ran into a problem. Step 4 of your instructions it runs for about 1 second and then stops with a 1 meg wav file created. I haven't done this as it is not as you suggested, however if I change the audio to Direct Stream Copy it starts creating the wav file as expected.
Matthew
23rd December 2005, 01:25
I'd check the mp3 for corruption. "direct stream copy|save wav" then use besplit/besliced or another tool to scan the audio.
jriker1
23rd December 2005, 01:31
More info. I selected VirtualDubMod with settings as you suggest. Gave an error about a third of the way through. Switched to "Priss rocks!" audio setting and ran again. Gets so far and then just sits there at 113304960/303855360.
Matthew
23rd December 2005, 01:45
If you can extract the audio using another app, e.g. avi2wav, then once you identify corrupt regions, if there are not too many you can replace the corrupt data with silent mp3 frames in a hex editor, and then convert the fixed file. I do this to correct initial audio delays before conversion.
jriker1
23rd December 2005, 15:44
Thanks Matthew. Guess this goes back to your original suggestion. Well, never had to manipulate the audio in this manner before so this will be kind of new to me. Obviously VirtualDubMod identified an issue at 113304960/303855360 where ever that is in the audio file. Do you know if there is a tutorial on how to identify where there are problems in the audio file and the steps you use to fix them? So you know, I have Adobe Audition 1.5 which I believe used to be GoldWave.
Thanks.
JR
Matthew
23rd December 2005, 23:57
Audition was formerly Cool Edit :)
I don't know of any tutorial, all I can recount are my own experiences.
A while back I was deliberately muxing damaged mp3 streams and from memory VirtualDub errored out sometimes. So you need to use another app to extract the mp3.
My understanding of the way avi works is that when the muxed avi has corrupted audio, sync will be retained, so a way to fix the file is to replace those corrupt sections with the equivalent length of valid mp3 data. IMO this might be easier than using a wav editor, and is certainly more pure. That is not to say it is easy.
But first you need to extract the mp3 and then scan it for errors. I like to use mp3check for this.
http://jo.ath.cx/soft/mp3check/
mp3check.exe file.mp3 --error-check > errors.txt
That will tell you the problems. "bitrate switching" doesn't matter, you'll be looking for errors like "frame 645: invalid header at 0x000662da (0x6a6a6a6a), skipping 672 bytes"
mp3check.exe file.mp3 --dump-header > headers.txt
will provide a list of frame headers and their locations. After deleting the first line of headers.txt, which contains the file name, the line number=header number.
line 645 (corresponds to frame header 645) gives the byte location:
417850 (fff,ID1,l3,prot1,12,48.0kHz,pad0,priv0,mode1,ext0,copy0,orig1,emp0)
line 646 is the next header:
419194 (fff,ID1,l3,prot1,12,48.0kHz,pad0,priv0,mode1,ext0,copy0,orig1,emp0)
Byte 417850 is the location of the frame header that precedes the corruption. So using a hex editor (e.g. UltraEdit) you can delete that frame, starting at 417850 and ending at 419193, and replace the data with a silent frame.
This is just a simple example, it could end up being trickier than this. Depends on the errors in your file.
vBulletin® v3.8.11, Copyright ©2000-2026, vBulletin Solutions Inc.