Log in

View Full Version : Fixing Audio Delays


m3mbran3
22nd June 2009, 00:06
I'm having a problem calculating how much to adjust the audio delay for a DVD that I am ripping and encoding to x264/aac in mkv

I am using DVDDecrypter in ifo mode to rip individual episodes of the Freaks and Geeks DVDs and for the main audio track I am getting a delay of -66ms
0x81 - Audio - AC3 / 6ch / 48kHz / DRC / English / LBA: 21 / PTS: 00:00:00.280 / Delay: -66ms

I then use eac3to to extract the stream and then get a delay of -16ms
[a03] A remaining delay of -16ms could not be fixed.

When I encode the video stream with x264 I am getting an initial delay of 2002/24000
mp4 [info]: initial delay 2002 (scale 24000)
Although I'm not really sure what this means, I'm guessing a video delay of 2002/24000 seconds or frames?

I am encoding the audio track to aac using the nero encoder and I was wanting to correct the delay at this stage in the process. Only problem is I'm not sure what the correct delay is.
Is the delay from decrypting + extracting (-66 -16 = -82) -82ms or is the delay from the eac3to output inclusive of the initial delay from decrypting, so just -16ms?

Then I am left wondering what the initial delay from the video is and how this effects my output. So far I have muxed my audio and video (with no delay compensation) and played it back a few times with VLC experimenting with different delays. I can't say that the difference is very noticeable to me when going from 0ms to -100ms but at times I think it does look more in sync with a -50ms delay (placebo effect most likely). I guess such a small delay is probably not going to be noticeable to me but I figure since it *should* be easy to fix I might as well.

My workflow is pretty standard and besides ripping the disc, I am using the tools of the latest megui build (0.3.1.1045) and megui as the gui for all of them. As this is my first time encoding a video with megui I am hopeful that a seasoned veteran will have some good advice for me.

Inspector.Gadget
22nd June 2009, 00:11
If you're going to re-encode the audio anyway, extract with DGIndex to WAV and the delay will be cut/padded.

m3mbran3
22nd June 2009, 02:37
OK I can do that, so that will compensate for decrypting and extracting?
I'm also seeking clarification on what exactly the initial delay from the x264 encoding means.

thanks.

Inspector.Gadget
22nd June 2009, 03:49
Decrypting/demuxing doesn't introduce any delay that isn't already present - a DVD authored with a -16ms delay will still have it after you copy it, for instance. DGindex (which you'll use to index MPEG-2 streams from DVDs anyway) will take the input stream and add or remove time at the beginning during decoding in order to make the delay 0ms. Initial delay was pretty well covered in one of the longer x264 threads recently, IIRC.

manono
22nd June 2009, 11:37
If you use DGIndex for demuxing, I'm fairly certain you'll find there is no delay.

m3mbran3
26th June 2009, 13:35
Have basically read through all the long x264 threads but have not been able to find out what the initial delay is

found this post http://forum.doom9.org/showthread.php?p=1212573#post1212573 which says that it has been discussed before but I was still unable to find it.

A point in the right direction please?

manono
26th June 2009, 13:53
A point in the right direction? I told you I'm fairly certain there is no delay. Demux with DGIndex and get the delay from the audio file name.

m3mbran3
26th June 2009, 14:21
Sorry for the misunderstanding. I am referring to the message from the x264 encoder which is (i think) independent of the decrypting / demuxing process.
mp4 [info]: initial delay 2002 (scale 24000)

manono
26th June 2009, 16:07
And isn't your source a DVD? What does that have to do with finding the delay in an MKV? If you don't want to take 5 seconds to find it in DGIndex, then open the IFO in PGCDemux and find it instantly. I don't understand the difficulty. DVD Decrypter is known for giving the wrong delays in its info files.

Are you saying that by making an MKV or whatever you're doing, you'll introduce a delay where initially there was none?

m3mbran3
26th June 2009, 16:50
Basically when I encode the video with x264 there is a line in the log that mentions "initial delay". I think this may be the encoder adding a delay to the start of the file, I'm not sure though that is why I'm seeking clarification.

manono
26th June 2009, 17:32
OK, someone else can help you with that, although I find it hard to believe the default setting is to delay the audio by some amount. Your first post was about the audio delay as given by DVD Decrypter. Well, part of the post was.

m3mbran3
27th June 2009, 02:12
Initially I thought there was some kind of -/+ delay added to the audio in decrypting / demuxing then some kind of -/+ video delay in the encoding. Thanks for your help, maybe I'll try the x264 forum.