WAV -> MP3 causes lag?

Locked
User avatar
Jnzk
Artsy Bastid
Joined: Tue Jan 28, 2003 5:30 pm
Location: Finland
Org Profile

WAV -> MP3 causes lag?

Post by Jnzk » Wed Apr 21, 2004 8:51 am

More annoying nit-picking from me. :D

I just found out something I never thought of before. I compressed a wav file with Lame 3.95.1 and opened both files for comparison in Audacity. It looks like the peaks in the MP3 version come about 40-50 milliseconds later. The MP3 is also a little longer than the WAV. Is this true or just some kind of visualization error? What should I do to fix it?

User avatar
WilLoW :--)
Joined: Thu Jun 14, 2001 7:07 am
Location: Matsudo, Japan
Contact:
Org Profile

Post by WilLoW :--) » Wed Apr 21, 2004 9:26 am

VirtualDub Help file wrote: Some MP3 codecs do not generate MP3 streams at exactly the same rate as specified in their audio format when 44.1KHz sampling rates are used -- this causes a small discrepancy in audio sync of around 0.5%. By default, VirtualDub recomputes the data rate and automatically corrects the audio header when MP3 compression is active. This option allows you to disable correction if it is causing problems, such as an MP3 stream being generated in a format that VirtualDub cannot parse correctly.
Your problem may come from that, however I thought Lame prevented this problem from occuring... :?

User avatar
Jnzk
Artsy Bastid
Joined: Tue Jan 28, 2003 5:30 pm
Location: Finland
Org Profile

Post by Jnzk » Wed Apr 21, 2004 12:13 pm

I used the command line Lame executable, I'm going to mux the MP3 later using direct stream copy. I don't know if VirtualDubMod will do something to the audio in this case too or if it recomputes the data rate only when you use the Lame dll. :|

User avatar
Jnzk
Artsy Bastid
Joined: Tue Jan 28, 2003 5:30 pm
Location: Finland
Org Profile

Post by Jnzk » Wed Apr 21, 2004 8:04 pm

Ok, I analyzed the situation more carefully. The difference between the WAV and the MP3 at a certain point is 2257 samples. The total length of the WAV is 13,262,975 samples while the length of the MP3 is 13,265,280 samples. So the difference in length is 2305 samples or 0.0174%. Thus obviously a few silent samples get inserted to the end too.

Both --preset extreme and --preset insane for Lame give similar results. I tried Lame 3.96, but the differences were exactly the same.

Then I tried to do the compression in VirtualDubMod with Lame ACM 3.92. This time the audio comes a little earlier than in the command line MP3 version, but still later than in the original WAV. Having the "Don't correct MP3 audio streams" option checked or not didn't make any difference.

The difference of about 50 milliseconds is noticeable in the video. :?

User avatar
The Wired Knight
Joined: Sun Jan 07, 2001 3:22 pm
Status: Attorney At Law
Location: Right next door to you
Org Profile

Post by The Wired Knight » Wed Apr 21, 2004 9:27 pm

What program are you running it through? Running the two compartively through premiere it seems the problem for me is that the highly compressed MP3 doesn't like to run as smoothly through premiere wheras the wav runs fine. Or is there a lag in any program you are using?
BANG

Intellectual Property, Real Estate & Probate Attorney.

User avatar
Jnzk
Artsy Bastid
Joined: Tue Jan 28, 2003 5:30 pm
Location: Finland
Org Profile

Post by Jnzk » Thu Apr 22, 2004 12:37 am

I'm using Audacity 1.2.0 to compare. Here's what it looks like:

Image
Above is the WAV, below is the MP3.

User avatar
AbsoluteDestiny
Joined: Wed Aug 15, 2001 1:56 pm
Location: Oxford, UK
Contact:
Org Profile

Post by AbsoluteDestiny » Thu Apr 22, 2004 1:42 am

How did you create the wav?

How did you create the mp3?

User avatar
Jnzk
Artsy Bastid
Joined: Tue Jan 28, 2003 5:30 pm
Location: Finland
Org Profile

Post by Jnzk » Thu Apr 22, 2004 1:48 am

I ripped the wav from a CD with Exact Audio Copy V0.95 prebeta 3 (11 May 2003). I chose Action - Test and copy selected tracks - Uncompressed. I don't know if it makes a difference in this case but I haven't touched the offset correction settings at all.

Then I proceeded to compress the file with Lame 3.95.1 downloaded from Doom9. The command line is "c:\program files\lame 3.95.1\lame.exe" --preset insane c:\cdver.wav c:\mp3-insane.mp3.

User avatar
AbsoluteDestiny
Joined: Wed Aug 15, 2001 1:56 pm
Location: Oxford, UK
Contact:
Org Profile

Post by AbsoluteDestiny » Thu Apr 22, 2004 2:18 am

btw why is the mp3 32bit float?

Well, first of all I dont understand how the mp3 can have more data than the source it is compressing.

The only thing I can imagine going on at the moment is that Audacity is displaying things wrong.

Does the mp3 audio sound in sync when you merge it with vdubmod?

User avatar
WilLoW :--)
Joined: Thu Jun 14, 2001 7:07 am
Location: Matsudo, Japan
Contact:
Org Profile

Post by WilLoW :--) » Thu Apr 22, 2004 2:35 am

I thought the human ear could tell the difference with a 80millisec desynch, not below :?

Locked

Return to “Video & Audio Help”