Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: MP3 Compression (Read 5452 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

MP3 Compression

Ok, most of us know that converting a WAV file to MP3 reduces the size to arounf 10% (35 Meg WAV becomes a 3.5 Meg MP3) of the origional file at the loss of quality, and the bits that are cut out to reduce the size are gone. What I dont figure is that when the MP3 is converted back to a WAV file it is around the same size as it was in the first place, if bits are lost in the compression phase, where does all the extera MB come from?

MP3 Compression

Reply #1
The 35 meg WAV (actually PCM) is data of the form that your sound card requires in order to reproduce the music. The mp3 does not "remove bits". It simply is a more efficient way of encoding the information that your sound card will need, but it must be restored to 35 meg in order to play it.

MP3 Compression

Reply #2
A WAV file has always the same structure: 44100 wave samples in a second for each channel, and each wave sample is represented by a 16 bit Integer (CD originated music assumed).
You may have compressed your music anyway you like: if you convert back to WAV it's always the size according to this WAV file structure. So same size as original WAV file.
lame3995o -Q1.7 --lowpass 17

MP3 Compression

Reply #3
An analogy that may help you:

let's say you've decided to save a lossy JPG image file as uncompressed TIF; you would end up with exactly the same image (ie, quality settings wouldn't improve or decrease) but in a larger file, which is inherent to the uncompressed format - nothing more nothing less.
Listen to the music, not the media it's on.
União e reconstrução

 

MP3 Compression

Reply #4
Take a newspaper sheet (this is your wave file), now squash into a ball (this is mp3), now open backup again to a full sheet (this is wave again, but you will notice it is not as good as before you squashed it).

MP3 Compression

Reply #5
If you know that there are 8-bits in a byte, and you know the bit depth, sample rate, and number of channels, you can calculate the size of a WAV file:

File Size in bytes = Sample rate in Hz x (bits-per-sample / 8) x number of channels x playing time in seconds.

i.e. CDs are 16-bits stereo at 44.1kHz, so you have 44,100 samples per second x 2 bytes x 2 channels.  That's about 10 megabytes for one minute of sound.


For compressed files, the bitrate (kbps) is the number of kilobits for one second of program, so you can calculate file size if you know the bitrate and the playing time. 

Or by calculating the number of bits in one second of CD audio, you can caluculate the bitrate for CDs as 1411 kpbs. 

MP3 Compression

Reply #6
Take a newspaper sheet (this is your wave file), now squash into a ball (this is mp3), now open backup again to a full sheet (this is wave again, but you will notice it is not as good as before you squashed it).

But if you don't squash it too much, or better fold it carefully, when you expand it again to its previous size you might not notice any difference at all, at reading distance. This is perceptual encoding...
... I live by long distance.

MP3 Compression

Reply #7
ok, think im getting the picture here(though i was always told mp3's do give a lot of loss, (unlike FLAC)
as for the newspapar alogy, hmmm, if it is ironed out to remove the not so squashed bits, it is almost as good as the origional.

not that i need mp3's, as dont use a player for them, and on the computer, with the low cost of HDs in the TB range, space is not an issue

MP3 Compression

Reply #8
ok, think im getting the picture here(though i was always told mp3's do give a lot of loss, (unlike FLAC)


But that's the point, it's perceptual, whether you can hear what is missing isn't guaranteed, and the whole point of this sort of lossy encoding. The objective being to remove what you can't (shouldn't be able to) hear.

FLAC is lossless, what you encode is exactly what you get out.

MP3 Compression

Reply #9
not that i need mp3's, as dont use a player for them, and on the computer, with the low cost of HDs in the TB range, space is not an issue


Is that thanks to what you've read elsewhere so far?

Then, like myself, you'll benefit immensely from reading what's in here at HA.

I was once or twice in the same boat, but after realising other HA members who, knowing a lot more than I do (you won't believe the expertise level of some of them), still cared about MP3 and other similarly good lossy encoders, I came to the conclusion it is not a matter of 'don't use it anymore' but more of 'be quality-minded & practical: use it whenever necessary' (portable usage etc.)

That of course, as long as you 'lossyly' encode you files with quality settings high enough, your ears (and only your ears, not other people's) cannot discern them from the original. Get to know more about ABX testing if necessary but just don't give up on what it is an excellent alternative to audio encoding without first giving it a fair chance to impress you.
Listen to the music, not the media it's on.
União e reconstrução

MP3 Compression

Reply #10
though i was always told mp3's do give a lot of loss, (unlike FLAC)


Information is absolutely lost, but when converting "back" to WAV, you're basically reserving space for that lost information, even if there's no music there. So saving an mp3 as WAV is quite a waste of space.

How much is lost depends on your compression settings and your ears.

MP3 Compression

Reply #11
thanks dhromed, i thought it may have been something like that, the computer knows there should be something there but cant find it, so reserves space fir it.

MP3 Compression

Reply #12
thanks dhromed, i thought it may have been something like that, the computer knows there should be something there but cant find it, so reserves space fir it.


To be clear, theres still information there, its just not the same information as the original file.  You can think of mp3 as adding noise to replace the information it discards.  So the output file has the same size as the input, but is not quite the same because some information has been changed.

MP3 Compression

Reply #13
I can make another metaphor about small data being in a small box (mp3), and if you convert to a bigger box (wav) you don't get more music but you do waste space, and about how part of the mp3 algorithm in a way permanently tenderizes the data-meat so that it can be more easily compressed, but how many can we stack on top of one another before mr. bazza is more confused than at the start? 

At some point, you just have to get to terms with the fact that WAV means writing out every single value, in full, 44100 numbers of 16 bits, for every second in your song, and that just takes up loads of space.