PDA

View Full Version : ac3 delay calculation


sapient
31st October 2002, 09:19
Can someone explain or point to an explanation of how dvd2avi calculates audio delay?

When ripping region 2 Farscape DVDs, DVD2avi always reports a 0 delay that is blatandly wrong. Using trial and error methods I have determined the delay to be around 250ms for most episodes.

Also, after using GreedyHMA to IVTC the PAL version of some X-Files episodes, I have noticed occasional differences from the DVD2Avi calculated delay. In these episodes, the field order changes from normal to inversed between scenes. I have noticed that the video has no delay compared to the non-iVTC'ed in scenes with the correct field order and a one-field or half-frame (20ms) delay compared to the original in scenes where field order has to be reversed. However, a/v delay seems constant through-out to me, though it seems to vary between episodes: sometimes its exactly equal to the one reported by DVD2avi, in other cases an extra +20ms delay seems necessary. Any ideas?

trbarry
31st October 2002, 16:03
For a discussion of how DVD2AVI probably does it see
this thread in the Development Forum (http://forum.doom9.org/showthread.php?s=&threadid=30895&highlight=audio+delay). I have frankly never understood audio programming and have not spent any time on the code doing that in DVD2AVI.

GreedyHMA does not detect changes in field order. It just uses whichever you tell it in the parms. So if you say the clip is TopFirst then it will take all the top fields and match them to either the prev or next bottom field, whichever creates the fewest weave artifacts. Or when deinterlacing video it will do the same thing on a pixel by pixel basis. Either way this involves about a one field video delay to the video since it looks ahead one field. But notice that would be true even on progressive video without GreedyHMA since there are 2 fields / frame and the sound is syncronized by frame.

And, like me, GreedyHMA knows nothing about audio. ;)

BTW, Neuron2 claims Decomb can actually handle some changes in field order, though I don't remember how he does it.

- Tom

sapient
31st October 2002, 17:52
Thanks for your reply.

I read the explanation, though I am still not sure that it explains well such a big error by DVD2avi in the case of the Farscape DVDs.
If anyone has an implementation of the alternate method for calculating the delay proposed in these messages (I am no programmer) please point me to it.

Thanks,
sapient

Justinus
2nd November 2002, 04:11
Once I came across some threads talking about the wrong audio delay output from DVD2AVI as well. Maybe you should use rippers to demux audio directly, such as DVD Decrypter, SmartRipper, or vStrip. It may handle better than DVD2AVI since they're rippers and know exactly where the streams start and end :)

JohnMK
9th November 2002, 14:59
This recently happened to me, too, encoding Cleopatra from 1964. There reported delay for Disc 2 was -302ms. Actual is probably somewhere between +200/+300. How can I empirically find out the correct delay?

trbarry
11th November 2002, 06:54
I'm also getting fairly regular very large errors in delay from certain HDTV captures recently. I've looked at the DVD2AVI audio code briefly a couple times but don't really know enough to fix it. There is probably something silly that any audio programming expert would notice immediately, but I don't see it.

- Tom