PDA

View Full Version : Strange audio desync in extracted audio tracks


Prettz
2nd February 2005, 21:47
I've noticed that in a movie I've ripped, the English audio in many scenes seems to be about 2 frames ahead of the video, while the Japanese audio is synced correctly. Because it's an animation there are only a few places where you can say with 100% certainty that the English audio is too fast. There seem to be no places where the Japanese audio is off. When I use PowerDVD to play the VOB files, the English audio is correct in those same scenes. I've also used a wav-editor to compare the English and Japanese tracks, and in the most noticeable scene (with a single gunshot and no other noise), the English audio is more than 100ms ahead of the Japanese.

The English track is ahead by the same amount regardless of whether I extract the audio track using DGIndex 1.2.0 beta 2 or an older version.

I posted this thread in this forum because it seems that DGIndex is the only thing left that could possibly be responsible for my problem. It couldn't be the DVD ripper because the audio in the VOBs is synced correctly in PowerDVD, and it couldn't be a problem with frames being cut by my avisynth script because the Japanese track, which was ripped in the same manner, ends up being synced correctly.

neuron2
2nd February 2005, 21:51
I'm working on this right now. I am aware of an issue that would cause such an error *if* you are making a left selection that is not at the start. Are you doing that?

Prettz
2nd February 2005, 22:15
No, no selections of any kind. For both audio tracks I loaded up all the VOBs and extracted the whole thing to a WAV file.


edit: Tried extracting the audio track using DVD2AVI 1.76, but it's still too fast.

Prettz
15th February 2005, 02:51
Update:

Well not only did I try DGIndex 1.2.0 RC5, but I also tried demuxing the AC3 track directly from the DVD using both DVDDecrypter and SmartRipper. All 3 tries I got audio that's fast by the same offset.

I don't understand how the audio track can (apparently) be set incorrectly on the DVD and yet PowerDVD is able to remove the offset correctly on the DVD and the decrypted VOBs. It seems like there's some kind of dynamic check that PowerDVD is doing to sync the audio correctly that neither DGIndex nor the DVD rippers are doing. Is this even a problem that DGIndex would be able to correct at all?

For the record, the DVD in question is the Akira Special Edition DVD.

raymod2
17th February 2005, 06:17
First you say the desync is two frames and then you say it is over 100ms. Which is it? I suspect you wouldn't be able to detect a two frame desync unless something in your playback chain is adding additional delays. That could explain why you notice the desync when playing the AVI file but not when playing the VOB file in PowerDVD.

I wrote a tool that you can use to check the timestamps in the VOB file for discontinuities. I haven't yet found a VOB file that has this problem but I haven't checked many. PM me with your email address and I'll email you the tool.

Prettz
17th February 2005, 09:17
Originally posted by raymod2
First you say the desync is two frames and then you say it is over 100ms. Which is it? I suspect you wouldn't be able to detect a two frame desync unless something in your playback chain is adding additional delays. That could explain why you notice the desync when playing the AVI file but not when playing the VOB file in PowerDVD.

I wrote a tool that you can use to check the timestamps in the VOB file for discontinuities. I haven't yet found a VOB file that has this problem but I haven't checked many. PM me with your email address and I'll email you the tool.
Well I did say "about" 2 frames. Perhaps I should have said 2-3 frames. I got the 100ms+ figure by comparing the two audio tracks in a wav editor and looking at a scene with a single pronounced gunshot. In many scenes the audio sounds "off" but you can't say by how much, but in a few key scenes the delay is extremely noticeable (noticeable enough that I've been going through all this trouble to try to fix it). I'm still reluctant to just guess a number and delay the audio track by that much manually.

There couldn't be anything in the filter chain responsible because audio track 2 is perfectly synced throughout the entire movie.

raymod2
17th February 2005, 10:11
Originally posted by Prettz
There couldn't be anything in the filter chain responsible because audio track 2 is perfectly synced throughout the entire movie.

You misunderstand what I am saying. I am suggesting that possibly audio track 1 is in sync but audio track 2 is out of sync on the DVD just like you measured in your WAV editor. When played on a DVD player both tracks may sound in sync because the error in track 2 is too small to notice. But when you play it as an AVI file your playback chain may be adding enough extra delay that is making the desync noticeable.

I discovered on my own system that AC3Filter was adding a delay to my audio stream. I tried switching from the Wave Out renderer to the DirectSound renderer and that improved it.

neuron2
17th February 2005, 15:15
Originally posted by raymod2
I discovered on my own system... Hi Dan! Welcome to the forum. :D

nnigam
17th February 2005, 15:59
Originally posted by raymod2
I wrote a tool that you can use to check the timestamps in the VOB file for discontinuities. I haven't yet found a VOB file that has this problem but I haven't checked many. PM me with your email address and I'll email you the tool.

Could this tool be used to identify frames in an HD transport stream. What I am looking for is a tool that will identify frames where audio rate changes in hd streams such as when the program changes to an advertisement at a lower bitrate.

raymod2
18th February 2005, 02:28
Don: Hello. I made it past the waiting period so I can post now. :)

nnigam: My tool currently only works with program streams but you're welcome to try to modify it. PM me and I'll email you the source.

Prettz
18th February 2005, 03:08
raymod2:
I ran your program and all I can say is "Wow." There's hundreds if not thousands of audio timestamp errors. And not long into the video I found a section where it's nothing but errors, punctuated by video timestamp errors at intervals.

Here's a little sample of the section where everything has gone to hell:

...
ERROR: Discontinuity detected in audio time stamps
predicted_pts = 02858.26463, actual_pts = 00000.38201
ERROR: Discontinuity detected in audio time stamps
predicted_pts = 02858.29663, actual_pts = 00000.41401
frame 0069927 2 2 2 2 2 2 2 2 2 2 2 2
field 0171300 I B P B B P B B P B B P
(00000.25301 s) ( 0)( 2)( 1)( 4)( 5)( 3)( 7)( 8)( 6)(10)(11)( 9)

ERROR: Discontinuity detected in video time stamps
predicted_pts = 02858.13563, actual_pts = 00000.25301
ERROR: Discontinuity detected in audio time stamps
predicted_pts = 02858.32863, actual_pts = 00000.44601
ERROR: Discontinuity detected in audio time stamps
predicted_pts = 02858.36063, actual_pts = 00000.47801
...
predicted_pts = 02858.64863, actual_pts = 00000.76601
ERROR: Discontinuity detected in audio time stamps
predicted_pts = 02858.68063, actual_pts = 00000.79801
ERROR: Discontinuity detected in audio time stamps
predicted_pts = 02858.74463, actual_pts = 00000.86201
frame 0069939 2 2 2 2 2 2 2 2 2 2 2 3
field 0171324 B B I B B P B B P B B P
(00000.72014 s) ( 1)( 2)( 0)( 4)( 5)( 3)( 7)( 8)( 6)(10)(11)( 9)

ERROR: Discontinuity detected in video time stamps
predicted_pts = 02858.60277, actual_pts = 00000.72014
ERROR: Discontinuity detected in audio time stamps
predicted_pts = 02858.77663, actual_pts = 00000.89401
...

So what options do I have at this point?

Edit:
Ok, so I finished going over the whole dump file and after it first starts doing continuous nonstop ERRORs, it doesn't stop doing it at all for the rest of the movie.
At the end it reports the audio delay as (not surprisingly) 0.00 ms.

Exact same results for the VOBs ripped by DVDDecrypter rather than SmartRipper.

raymod2
18th February 2005, 03:16
Those actual_pts values look bogus. It looks like my tool is having trouble parsing your file for some reason. I've only tested it on two DVDs so far. If you ftp me your VOB file I'll take a look at it. But first, can you send me the whole dump file?

raymod2
18th February 2005, 04:36
I took a look at the dump file. The first 30 or so errors are probably false alarms. I was assuming that all PES packets that contained audio data had PTS fields. Those errors are probably the result of me trying to read a PTS field that isn't there. I'll fix that in my tool.

Around video frame 69911 (47min 37sec) it looks like the audio and video PTS fields reset to 0. It happens again after another 45min 12sec. Since my tool is not expecting these resets it indicates the rest of the stream is out of sync after the first reset. What kind of VOB file(s) are these? Are they from a DVD? Is there more than one program stream present?

Also, is audio track 0 the one that you are having trouble with (my tool is presently hard-coded to only parse audio track 0)?

Prettz
19th February 2005, 16:59
Yes, the first audio track is the one with problems. Like I said earlier, the VOBs are from a movie DVD (Akira).

Edit:
Tried your new version of vparse. The first few errors you described as false alarms are gone now, but it still craps out at the same spot and after that everything is errors like before.

raymod2
19th February 2005, 21:54
Originally posted by Prettz
Yes, the first audio track is the one with problems. Like I said earlier, the VOBs are from a movie DVD (Akira).

Edit:
Tried your new version of vparse. The first few errors you described as false alarms are gone now, but it still craps out at the same spot and after that everything is errors like before.

Like I said, for whatever reason there appears to be three 45 minute sections as far as the timestamps go. We know that there is nothing wrong in the first section. We could investigate the transitions between these sections to see if they are introducing a desync. But we don't need to bother if you are experiencing the problem in the first 45 minutes. Are you?

Prettz
20th February 2005, 04:57
Originally posted by raymod2
Like I said, for whatever reason there appears to be three 45 minute sections as far as the timestamps go. We know that there is nothing wrong in the first section. We could investigate the transitions between these sections to see if they are introducing a desync. But we don't need to bother if you are experiencing the problem in the first 45 minutes. Are you?
I thought I was sure I saw it in the beginning of the movie as well, but examining it again even closer, the delay might not be there after all. And the first scenes where I'm still sure I see the delay do happen to start appearing somewhere after the 45 minute mark (there's no obvious anomolies in the audio that would give away where the desync actually begins). The first event I see that's undoubtably off occurs at 45:43.

raymod2
20th February 2005, 05:42
Originally posted by Prettz
I thought I was sure I saw it in the beginning of the movie as well, but examining it again even closer, the delay might not be there after all. And the first scenes where I'm still sure I see the delay do happen to start appearing somewhere after the 45 minute mark (there's no obvious anomolies in the audio that would give away where the desync actually begins). The first event I see that's undoubtably off occurs at 45:43.

45:43 is still before the first timestamp reset. I was using 45 minutes as an approximation. The first timestamp reset occurs at 47min 37sec. I don't know what kind of upload bandwidth you have but if you want to send me the VOB files I'll take a look at it.

Prettz
25th February 2005, 02:51
Originally posted by raymod2
45:43 is still before the first timestamp reset. I was using 45 minutes as an approximation. The first timestamp reset occurs at 47min 37sec. I don't know what kind of upload bandwidth you have but if you want to send me the VOB files I'll take a look at it.
I sent you a PM you still haven't read yet. I can send you the VOBs whenever you want.