PDA

View Full Version : Constant 18ms positive delay when encoding to AC3


fellini
3rd April 2006, 04:05
Maybe you know this and maybe not, but I've found constant delay of positive 18 ms, when converting wav 48khz to AC3.
I've reported it to Dolby and they confirm they found it at their lab as well. The only remedey they could offer me is to make changes to the audio files, prior the encode process (hence make negative delay of 18ms at the begining of the audio file and aboid placing any information at least 40ms before the end of the file).

I've made an audio test file. Took 4 sec Stereo Wave 16bit 48Khz - inserted 3 tones for 40ms each time along the file:

00:00:00:000 - 00:00:00:040 Tone (40ms length)
00:00:00:040 - 00:00:02:000 Silence
00:00:02:000 - 00:00:02:040 Tone (40ms length)
00:00:02:040 - 00:00:03:960 Silence
00:00:03:960 - 00:00:04:000 Tone (40ms length)

I've took the Wave file and put it in Apple A.Pack and in Soft Encode 1.0 - Dolby Digital 5.1 and encoded stereo AC3 with the default preset, and here what I've got:

00:00:00:000 - 00:00:00:018 Silence
00:00:00:018 - 00:00:00:058 Tone
00:00:00:058 - 00:00:02:018 Silence
00:00:02:018 - 00:00:02:058 Tone
00:00:02:058 - 00:00:03:978 Silence
00:00:03:978 - 00:00:04:000 Tone

As you can see:

a. Everything shifted 18ms forward.
b. The last tone appears for only 22ms instead of 40ms (because of the general shift).

It's very weird cause it happens with 2 different encoders on 2 different computers and OS. The question is, if the delay is native to this technology, why isn't there any automatic compensation or a tool which allow me to set a delay fix?
But as I've mentioned before, even Dolby wasn't aware to this problem.

If you want to 'play' with it and test it for you self, you can take my samples. I've attached the "before" wave file and the "after" AC3 file for you to examine.
If you have any problem download the attachment from Doom9's forum, you can try download it from this link:
http://s54.yousendit.com/d.aspx?id=36J4I6KWBZK5M0AAGME9P6Q8V8

Lior

tebasuna51
3rd April 2006, 13:10
In my test (also with your sample "Audio for 4sec_3_tones_16bit.wav") using Sonic Foundry Soft Encode v1.0 (build 19), I obtain always a delay of only 5.333 ms.

I say to other user in http://forum.doom9.org/showthread.php?t=104336 :

"An ac3 (48 KHz) is a sequence of frames (header and data) of 32 ms. ...

A correct ac3 always have a length multiple of 32 ms. Any truncated frame is rejected because there are two CRC's (at beginning and at the end of the frame) to verify the frame integrity.

To have a exact correspondence between wav and ac3 you need:
1) Create a wav with length (in ms) = X*32
2) Add at the beginning 26.667 ms, and 5.333 at end with anything
3) Encode to ac3
4) Cut the first 32 ms (the first frame)"

To delay/cut ac3 (always in 32 ms steps) use DelayCut by jsoto.

fellini
3rd April 2006, 17:26
well I think the different between you and me is that you're working with NTSC frame rate and I'm working with PAL frame rate.
NTSC frame is approx 33ms and PAL frane is exactly 40ms.
So I have to use 40ms units.

tebasuna51
3rd April 2006, 21:20
Not at all. The frame size in ac3 is always the same for 48 KHz.
Is independent of video framerate (Spain is a PAL country furthermore).

If you use also Sonic Foundry Soft Encode v1.0 (build 19), maybe we are using different encode settings. I use 192 Kb/s and all unchecked in Preprocessing (None for DRC).