Help - Search - Members - Calendar
Full Version: Decoding mp3 Creates different sized wav
Hydrogenaudio Forums > Lossy Audio Compression > MP3 > MP3 - Tech
gkmeyer
Hi everyone. This is my first post, so go easy on me and please let me know if I am posting in the wrong place. While I have been home recovering from knee surgery this week, I have been palying around with audio compression and trying to learn about the different encodings and see if I can hear the differences.

[B]The Background[B]
Since my ear is not that good, I wanted to hear the difference between a compressed audio file and the original wav. I encoded the original wav using oggenc and then decoded it back to wav using ogg123 and then inverted the waveform of the new file and mixed it back with the original using soxmix. The result is quite amazing, to be able to hear what was removed in the encoding process. I wanted to do the same with an mp3 and perhaps diff the ogg and mp3 to see the differences between the two compression formats, but I am having trouble because the mp3's are decoding to different sizes.

[B]The Details:[B]
I ripped a song to wav from a CD and I ended up with a file size of 28877900 blocks. When I encode that wav as an Ogg and then decode it back to wav, I get a consistent file size of 28877900, but when I encode the original wav to mp3 and back, I get a wav file size of 28882988. 5088 blocks bigger. Does anyone know what is happening and how I can work around it? I'm using vorbis-tools 1.0.1 and lame 3.95 on Linux.

TIA for any insight.
boojum
Rather than trying to re-invent the wheel, why don't you do a search of this forum for previous listening tests of different formats? cool.gif
Jan S.
Which mp3 encoder are you using? If you are using LAME you should not have this problem.
The problem is that mp3 encoders fill the last frame with silence to complete it. Only the LAME encoder saves the real length and is therefore able to decode it correctly (so-called gaplessly).
gkmeyer
QUOTE(boojum @ May 9 2004, 06:51 AM)
Rather than trying to re-invent the wheel, why don't you do a search of this forum for previous listening tests of different formats?    cool.gif

Because I wanted to hear the differences and because of the learning experience. There's nothing like doing it yourself to aid retention.

I have been googling for two days before making this post and I have not found any discussion of this particular problem.
gkmeyer
QUOTE(Jan S. @ May 9 2004, 06:55 AM)
Which mp3 encoder are you using? If you are using LAME you should not have this problem.

I am using LAME for both the encoding and the decoding.

QUOTE(Jan S. @ May 9 2004, 06:55 AM)
The problem is that mp3 encoders fill the last frame with silence to complete it. Only the LAME encoder saves the real length and is therefore able to decode it correctly (so-called gaplessly).

So the wav should be lined up from the beginning and the extra will be at the end, this sounds like a reasonable explanation. But this does not appear so, because if I go ahead and invert the decoded mp3 and mix it back in, I get a result that sounds like the original song but with some echo, so instead of the amplitudes canceling each other out, they are offset slightly and creating an echo effect. I can infer from this phenomena that some of the extra is actually at the beginning of the track. sad.gif
magic75
Try decoding with foobar2k.

But I would also like to say that your approach to comparing and judging the quality of codecs is not so good. One crucial part of lossy coding is to remove sounds that are conceiled by other louder sounds. So what you are doing is trying to hear things that cannot be heard when listening to the original file. A good codec only removes sounds that really cannot be herad in the original, and a not so good codec might remove some sounds that could be heard. But with your approach you will be comparing all that has been removed, of which most probably isn't hearable in the original.

A better approach to comparing codecs is trough blind ABX testing against the original. There should be lots of info about this either in the FAQ, wiki or by using the search function... BTW, foobar2k has a good ABX comparator built in. Just enqueue the original and the encoded version. Select both, right-click and chose ABX something... (I think you need the special installer to get the ABX component)
gkmeyer
QUOTE(magic75 @ May 9 2004, 11:56 PM)
But I would also like to say that your approach to comparing and judging the quality of codecs is not so good. One crucial part of lossy coding is to remove sounds that are conceiled by other louder sounds. So what you are doing is trying to hear things that cannot be heard when listening to the original file.

I understand that. I was just using this approach out of curiosity to hear what the encoder removed. For instance, with a Q4 Vorbis file, I cannot tell the difference between that, the 192 vbr mp3 or the original, it is all transparent. But using my approach, I hear that a lot was taken out by the encoder, even though I cannot hear what was removed when listened to the encoded file. I was just curious.

I am in the process of setting myself up to do some training for the purpose of doing the blind testing, so we'll see what happens and if I can get better at it.
2Bdecided
Have you seen...
http://www.ff123.net/training/training.html

Also, I'd second the use of foobar2k to (more often than not) make sure the decoded file is time-aligned with the original.

Or do the time aligning yourself in whatever audio editor you're using to subtract the waves. Most codecs add silence at the beginning and/or end - some trim it when decoding. You do have to check though - never assume!

Cheers,
David.
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2008 Invision Power Services, Inc.