Lossless MPEG transcoding

Mark R

Diamond Member
Oct 9, 1999
8,513
16
81
I'd find it very useful to be able to convert an MPEG-1 Layer 2 bitstream, into a Layer 3 bitstream of the same rate, but all the software that I've found converts between the two via an intermediate PCM bitstream, and is therefore wasteful of data and of CPU time. Is it possible to losslessly convert from layer 2 to layer 3?

I was under the impression that there are great similarities between the two formats, essentially the major difference is in the psychoacoustical transforms and quantisations. As it is the transformation stage that is lossy, I would have thought it possible to avoid repeating this stage, and use the ready transformed data (in layer 2 format) to generate the layer 3 file.

I'm thinking of a technique similar to that of lossless JPEG rotation, where it is possible to rotate a JPEG image by 90 degrees without recompressing it (simply by reordering the transformed and quantised data).
 

CTho9305

Elite Member
Jul 26, 2000
9,214
1
81
The reason MP3s are small is because they are lossy. Decoding them to wav and then re-encoding is not going to add more lossiness. As for convertin layer 2 to layer 3, I would imagine the lossiness of the codec overall would exceed the losses from conversion so much you wouldn't be able to tell - and if you can tell, you should be using CDs ;)
 

Woodchuck2000

Golden Member
Jan 20, 2002
1,632
1
0
Originally posted by: johnfreezz
:Q
/me wishes he knew half as much

...

lossy = ?
Lossy means that in the process of compression, information is lost.
If you convert from uncompressed WAV to MP3 and then back, you lose information.

Using an intermediate PCM Wav file doesn't make the process any more lossy, it just slows things down a little. I've never seen an application that'll do the transition straight off, but then I've never really looked.

BTW, lossless MPEG transcoding is a contradiction in terms - encoding/transcoding to a lossy format is inherently lossy.
 

KilroySmith

Junior Member
Dec 5, 2002
17
0
0
Simple experiment CTho9385 -
Encode a song to MP3. Convert back to .WAV. Repeat 3 or 4 times - the degradation in the music quality will indeed be noticeable. This is one of the reasons one wouldn't want to convert up and back down.

johnfreezz - "Lossy" means that some of the information in the original is thrown away ("lost") during the compression process. For example, WinZip is a "lossless" compression program - when you uncompress a file, you get exactly the same data as you had before you compressed it. Absolutely required for data files, program files, etc. MP3 is a prime example of a "lossy" program. If you compress a .WAV file to MP3, then uncompress it, the data you get after uncompressing it is NOT the same as the original data - some amount of detail has been lost, although in general it sounds exactly the same. This is done because:
  • "lossy" compression makes files much, much smaller than "lossless" compression - MP3 can typically compress music down to 1/12 it's original size, where WinZip may only compress it to 1/2 it's original size.
  • Some really bright guys figured out how to throw away data that you can't really hear anyway, so the "lossy" compression scheme sounds just fine to you

Mark - Don't know of anything. I'm guessing that each format is throwing away different data, so there probably isn't a straightforward conversion. It is probably mathematically and programmatically possible to convert one to the other, but I'm guessing that to do it well you'd have to do the equivalent of uncompress/recompress anyway (what mathematical function transforms a Layer 2 psychoacoustical transform to a Layer 3 psychoacoustical transform?).

/frank