PDA

View Full Version : Audio delay after encoding MPEG-2


fellini
12th March 2006, 02:12
Hello,

I've download trial versions of the following MPEG-2 encoding softwares: TMPGEnc, Cinema Craft, Procoder and Mainconcept.

The only problem is with a constant delay in sound in the traget file.

I have test file of 2 minutes containing bars and tones which appears for 1 frame (40ms) simultaneously. These bars and tones scattered along the file. The first bars and tones appeares at 00:00:05:00 in the AVI file for 1 frame (till 00:00:05:039 including).

After I've encode it, the MPEG-2 file was synced perfectly regarding the video stream. The bars appeared exactly were they should have - 00:00:05:00 (till 00:00:05:039 including) but the audio was offset 34ms and appeared at 00:00:05:34 (till 00:00:05:073 including). Of course they should have appeared in the exact time and duration like the bars.

I've tried the following:

1. Change the target audio bit rate (192Kbps to 384Kbps Mpeg-1 Layer 2).
2. Change the target sample rate (48Khz to 44.1Khz Mpeg-1 Layer 2).
3. Change the target audio file type (from Mpeg-1 Layer 2 to uncompressed Wav).
4. Change the video bit rate (CBR / VBR etc).
5. Encode only audio with elementary audio (WAV and Mpeg-1 Layer 2).
6. Change the source from QuickTime Uncompressed with PCM Audio to AVI-DV with PCM Audio.

None of those eliminated the problem. The only discovery was: If the source file is in 44.1Khz and I choose to encode it to 44.1Khz as well, the offset reduce to 10ms.

BTW: I've tried to take the original wave to an AC-3 encoder and even there wan an offset (even bigger - 50ms)

Do you have any idea how to resolve this problem?

Thanks,
Lior
fellini@netvision.net.il

setarip_old
12th March 2006, 06:43
Hi!The first bars and tones appeares at 00:00:05:00 in the AVI file for 1 frame (till 00:00:05:039 including).1) What is the format of the audisotream in this .AVI? If it is .MP3, is it CBR or VBR?

2) Does the .AVI play synchronously?

fellini
12th March 2006, 10:44
The AVI contains DV-PAL codec for the Video and Uncompressed PCM 48Khz codec for the Audio. I've also tried Quicktime Uncompressed 10 Bit codec for the Video and Little Endian PCM 48Khz / 44.1Khz.

The problem is not in the file. Take any uncompressed audio (WAVE or AIFF), open it in an audio editor software. See where the first waveform appears along the timeline (make sure the timeline represent milliseconds) and then convert it with MPEG-2 software convertor directly to elementary MPEG-1 Layer 2 audio stream and open the stream with the same audio editor software. You'll see that a positive offset of 34ms will appear.

I think it's native to the codec. I've found some reference in the following link: http://www.mpeg1.de/faq/layer3.faq

In General it says:


Q: Quality, complexity - what about the codec delay?
A: Well, the standard gives some figures of the theoretical minimum delay:
Layer-1: 19 ms (<50 ms)
Layer-2: 35 ms (100 ms)
Layer-3: 59 ms (150 ms

The question is if the delay will somehow fix itself when playing it with the hardware player (ADTEC) or should I fix it manualy. Also, If it's native to the codec, why the MPEG softwares don't offer delay fix when convert to MPEG-1 Layer 2?

Hope someone can answer my questions cause it's getting a bit frustrating.... Thanks

setarip_old
12th March 2006, 18:45
The problem is not in the file.I assume this is in answer to my question of does the source .AVI play sychronously.

I can only tell you that I have had absolutely no synchronization problems converting .AVIs' with PCM audio into compliant NTSC MPEG2 (including MPEG1LayerII audio), using "TMPGEnc" (I continue to use the ancient v.1.2c, because it works!) - most recently, my VirtualDub capture of the seasons' finale of "Battlestar Galactica"...

fellini
12th March 2006, 19:50
Thanks for your reply. Can you please download the following wave file from the attachment and encode in to MPEG-1 Layer 2? It would be great help if someone else would also check it. The wave is a 4 seconds segment containing mostly silence. a single tone appears exactly at 2 seconds from the begining of the file for 40ms. Beyond this point there's a silence again till the end of the file.
Please check the wave file and the encoded MPEG-1 Layer 2 file in audio editor and see if it has shifted in some way. If you don't have audio editor, you can download the following shareware from this link:
http://www.goldwave.com/release.php

Thanks so much for your help.
Lior

P.S
Your can also download the audio test file from here: http://s6.yousendit.com/d.aspx?id=1AAMZ3LXPEVVK0XGAI96V4P1E5

fellini
24th March 2006, 12:47
I've took 4 sec AVI - inserted 3 tones an bars for 1 frame each time along the file:

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

I've took the AVI file and put it in CCE / TMPGEnc / MainConcept MPEG Encoder, chose System MPEG-2 with MPEG-1 Layer 2 codec, convert it and opened it. This is what I've got:

00:00:00:000 - 00:00:00:010 Silence
00:00:00:010 - 00:00:00:030 Tone
00:00:00:030 - 00:00:00:034 Silence
00:00:00:034 - 00:00:00:074 Tone
00:00:00:074 - 00:00:02:034 Silence
00:00:02:034 - 00:00:02:074 Tone
00:00:02:074 - 00:00:03:994 Silence
00:00:03:994 - 00:00:04:008 Tone

The video bars however stayed the same!!!

I don't know where to begin to describe the abnormality:

1. Everything shifted 34ms forward.
2. The tone from the end of the file appeared 10ms from the begining of the mpeg file but only for 20ms (instead of 40ms).
3. The duration of the new mpeg file has an extra 8ms.

I've attached these 2 files.
You can download it from here:
http://s4.yousendit.com/d.aspx?id=1QXLMLX4HI12G2BNU013VGV4XP

Thanks,
Lior

setarip_old
25th March 2006, 22:19
Do try locating and using "TMPGEnc" v.1.2c...