Log in

View Full Version : audio sync issue, but why?


kurt2439
21st April 2006, 14:55
Im using virtualdub 1.6.14 and im converting a long baseball game to xvid. The original cap is in sync the entire way through. When I play the edited (minus commercials) movie with the virtualdub output play thing it is in sync (although I dont know if thats a valid test)...however when I convert to xvid I get sync issues big time. It SEEMS like the first segment is in sync but its hard to tell because its just voice overs, however after the first edit it goes out of sync by like 2 seconds. This was after I changed the audio framerate to match the video.

Before this I wouldnt change the framerate and the sync was the same. Actually going back the audio starts off behind the video and at some point gets ahead of it. Why does this happen! if the source is in sync, and you cut some piece of the video off - why should the two get out of sync so badly...and why the swing from audio behind to audio ahead? Im curious as to whether if I served it to Tsunami the same thing would happen? Or if I edited it with Premiere instead. I dunno, Im relatively new so it would be great if someone could explain this or tell me how I could go about fixing this or preventing it from happening?

Thanks for anyone who could offer some help

setarip_old
21st April 2006, 19:25
Hi!When I play the edited (minus commercials) movie with the virtualdub output play thing it is in sync1) What is the format of the original capture?

2) If you play this edited version in Windows Media Player, or another software player (not editor), does it play properly, from start to finish?

kurt2439
22nd April 2006, 06:39
Hey setarip...

1. Well the original capture was in MJPEG from Pegasus.

2. The only way I can view the edited version in a software player is by saving the .avi, and in this case converting to xvid (right?)...and in that case it does not play properly. This is the only apparent time when it gets out of sync, after it has been encoded from virtualdub. The original, non-edited version of the capture plays fine in WMP, and the edited version seems to play fine in virtualdub before encoding. Im not sure of any other way to test it

setarip_old
22nd April 2006, 06:51
A suggestion, if I may:

Convert the entire, unedited MJPEG video to XviD-compressed .AVI first. Play it to determine whether it is in synch from start to finish. if it is, edit it and save with a new name.

If it isn't in synch, adjust as follows (save with a new name and then edit the new file):

Load the file into VirtualDub, VirtualDubMod, or NanDub.
Set BOTH "Video"(VirtualDub, VirtualDubMod and NanDub) and "Audio"
(VirtualDub and NanDub - VirtualDubMOD>"Streams>"Stream list") to "Direct Stream Copy".

A) If the difference between audio and video is constant throughout the video:

From the "Audio" dropdown menu, select "Interleaving" (For VirtualDubMOD, rightclick on the listed audiostream and then select "Interleaving")

Under "Audio skew correction", set an appropriate number of milliseconds (positive or negative) in the box labelled "Delay audio track by"

Save with a new filename


B) If the difference increases as the movie plays:

From under the "Video" dropdown menu, select "Framerate" - and select "Change so video and audio durations match"

Save with a new filename

Let us know of your success ;>}

kurt2439
22nd April 2006, 14:34
hmm that is a good idea to convert the whole unedited cap to xvid and edit it after. I will let you know how that goes. Unfortunately it takes about 11 hours to convert the one without commercials so it'll be awhile before I can let you know =o)

kurt2439
23rd April 2006, 14:11
So after the 12 hour marathon encode I discovered this. It has the same problem even before editing. And I cant just shift the audio one way or another because the audio starts off about a second BEHIND the video and then becomes 2 seconds or so AHEAD of the video. Also when I went to adjust the framerate, the current fps 29.972 and the corrected to match fps were exactly the same (29.972). I would have gone through with it anyways except
1) the time to change the framerate and save the avi was 12 hours
2) Ive tried changing the framerate to match before (and there was a difference from the original cap) and it didnt have an effect

I did realize however, and I dont know how I forgot this and neglected to mention, that I am encoding the audio from PCM to mp3 118kbps using the lame mp3 encoder. Im assuming it is this audio conversion that is screwing it up now...how can I test this?

setarip_old
23rd April 2006, 18:06
Im assuming it is this audio conversion that is screwing it up now...how can I test this?First, extract the PCM (.WAV) audiostream from the captured MJPEG

1)Load the (unedited) XviD-compressed .AVI into VirtualDubMOD

2) Set "Video" to "Direct Stream Copy"

3) From under the 'Streams" dropdown menu, "Disable" the .MP3 audiostream

4) "Add" the PCM (.WAV) audiostream

5) Save with a new filename

6) See if the XviD-PCM .AVI plays properly


Before doing the above, please:

1) Load the (unedited) XviD-compressed .AVI into VirtualDubMOD
2) From the "File" dropdown menu, select "File Information"

3) Post (here) EVERYTHING you see (BOTH video and audio information), or post a screen capture .jpg of the information box

kurt2439
24th April 2006, 14:22
http://home.comcast.net/~kurt2439/fileinfo.JPG

A-ha! So when I did what you said and used the uncompressed pcm audio with the unedited xvid file it works fine, in sync the whole way through (althou does the fact that the audio says it has a .48 s preload mean its .48 seconds out of sync?) Now to figure out how to compress the audio without it going out of sync...what can be learned from this file info?

setarip_old
24th April 2006, 19:51
does the fact that the audio says it has a .48 s preload mean its .48 seconds out of sync?No.

I'd suggest that you edit the XviD+PCM file in VirtualDubMOD - and then save the file with .MP3 audio set to a more standard 128Kbps (rather than your earlier 123Kbps)...

kurt2439
25th April 2006, 05:31
Sooo yeah. I decided to scrap the xvid file and recut the original cap since we had isolated the problem to the audio encoding and it was taking forever to edit the xvid in vdubmod. I also decided to switch to x264 however when I use a mp3 bitrate of 128 I get no sound in wmp, it searches for codec and then just displays video. VLC however plays sound fine but has no video. I tried 160 bitrate, which had the same problem. I then went back and did 118 (which is what i was doing originally, althou it says 123) and that also had the same problem. I'll just encode the video with pcm and play with it tomorrow. Odd thou it seems

setarip_old
25th April 2006, 06:31
I think it would be best if you'd be good enough to follow my last suggestion before going on to other changes. It may make it possible to either resolve your problem or track it down...

kurt2439
25th April 2006, 21:49
You're right, and I appologize for that. When I encoded the xvid+PCM file into 128 kbps mp3 I had no problems with the syncing! (except that I seem to have picked up a codec problem and windows media player refuses to have sound, but this is across known good xvids as well). So it would seem that my xvid+mp3 ripps are working correctly now and that's great, thank you so much for your help setarip!! I owe you big time

Im having another issue with x264 in that I tell it to encode at 750 kbps and it seems to encode at whatever it feels like (450 in the latest case) which isnt good at all. I was having a similiar problem with xvid until I reinstalled the codec and it seems to be working well since. But since this is a seperate issue I'll tackle this in another post I suppose. Thank you so much for the help mate, cheers =o)

setarip_old
25th April 2006, 22:01
thank you so much for your help setarip!! I owe you big timeAs always, my pleasure!

Donations to the (FAKE) "Be nice to the old man" fund graciously accepted ;>}