Help - Search - Members - Calendar
Full Version: Mp3 coding without frequency loss
Hydrogenaudio Forums > Lossy Audio Compression > MP3 > MP3 - Tech
Snake
Question:

Coding WAV (48khz 16bit) to MP3 using CD-DA @ 320kbps and decoding (playing) using any mp3-player will yield a decoded 44khz 16bit sound stream....

Why? Can it be avoided? Is it the codec?

I would of-course like to see (even though mp3 is a lossy format) that the decoded stream has the same frequency (and bit-depth) as the original file before coding.

Thanks!! unsure.gif
Garf
1) MP3 encoding is inherently lossy, the spectral content will never be the same after decoding (except for trivial cases)

2) Because of (1), MP3 has no concept of bit depth, and "having the same bit depth after decoding" is basically meaningless.

The samplerate (48kHz) should not change, whatever you did the encoding with is buggy.

SebastianG
"using CD-DA @ 320 kbps" ???

CD-DA = compact disc digital audio = Stereo-PCM at a samplingrate of 44100 Hz

MP3 supports sampling rates of 16, 22.05, 24, 32, 44.1 and 48 kHz (8, 11.025 and 12 as well if you count "MPEG 2.5"). It's possible to encode a 48 kHz wave to a 48 kHz mp3.

Appearently you make use of software which resamples the audio signal prior encoding to 44.1 kHz 'cause you're telling it to do it by using "CD-DA" as setting.
(At least that is how it looks to me)

I think you should make yourself familar with the informations you can find here (for a start, read the FAQs and the posting about recommended encoder settings)

I'd personally do something like this:
ssrc --profile fast --resample 44100 --bits 24 yoursource.wav resampled44.wav
lame --preset fast standard resampled44.wav something.mp3

Explanations for this approach:
- SSRC is a high quality resampler which does a very good job
- The usage of 24 bit output avoids adding further quantizing errors
- LAME is one of (if not THE) best mp3 encoder -- heavily tuned and tested in the 44.1 kHz arena. The used setting should give you something around 200 kbps with subjectivly no loss in quality.

Don't worry about the slightly lower sampling rate. A lowpass filter at the encoder side kicks in anyway -- and trust me: This is a good thing.

BTW: Welcome to HA


Sebi
Shade[ST]
QUOTE(Garf @ Jul 28 2005, 10:22 AM)
The samplerate (48kHz) should not change, whatever you did the encoding with is buggy.



I agree, here. I have some mp3s that some 1337 cod3rz ripped, upsampled to 48000 and encoded with lame -- when they decode, they're 48000. This is practically pointless, though, unless your original itself is sampled in 48000 and you can hear the difference from 44100 (most probably you won't be able to -- otherwise you wouldnt encode into mp3...)

I consider this a non-issue.
Snake
QUOTE(Garf @ Jul 28 2005, 10:22 AM)
1) MP3 encoding is inherently lossy, the spectral content will never be the same after decoding (except for trivial cases)

2) Because of (1), MP3 has no concept of bit depth, and "having the same bit depth after decoding" is basically meaningless.

The samplerate (48kHz) should not change, whatever you did the encoding with is buggy.
*




Well that's a point I can understand for 48kHz vs 44kHz when coded into mp3 @ 320kbps. I was however more in general terms trying to undertand the limitations / possibilities of mp3 coding. Say I have a source (DVD-A) 24bit 192kHz which I wanted to code into something like 1500 to 2000kbit using mp3 or similar, it would be pretty useless if the coding downsampled my source to 16bit 44kHz before compression. This also brings the question of filtering that the coder applies, is this variable by source samplerate and choosen compression? Or the question of the resulting dynamic range of the coded mp3, how can it be calculated?

Since this explodes into 10 new questions, I suppose I just surf around here and see what I can find.....

BTW thanx for the tip that my coder likely chooses to downsample rather than the mp3spec itself was written that way.

//Snake
NeoRenegade
LAME can handle 24-bit WAV's. However, MP3's maximum sampling rate is 48kHz as far as I know.

If you can manage to rip a 192kHz stream to WAV, then there may be some way to SSRC resample that to 48kHz or lower so LAME could handle it.

Honestly though, don't worry about "frequency loss". Lowpassing and resampling are two very good ways to make audio sound very good while being smaller.
Klyith
QUOTE(Snake @ Jul 29 2005, 12:03 PM)
I was however more in general terms trying to undertand the limitations / possibilities of mp3 coding. Say I have a source (DVD-A) 24bit
As others have mentioned, mp3 can handle any "bit-ness" without resampling. Internally mp3 uses a different representation in which there is no analogue to bit depth of a pcm wav file.

QUOTE(Snake @ Jul 29 2005, 12:03 PM)
192kHz
Gee, it would be terrible if dogs were denied the full range of sound in the original recording.

QUOTE(Snake @ Jul 29 2005, 12:03 PM)
which I wanted to code into something like 1500 to 2000kbit using mp3 or similar
320 kbit is a hard ceiling. You can't go any higher.

QUOTE(Snake @ Jul 29 2005, 12:03 PM)
it would be pretty useless if the coding downsampled my source to 16bit 44kHz before compression.
Lame and most other codecs are optimized for 16/44.1, since that's the most common. It would actually be best for you to resample any music you want to encode to that format yourself. The resampling routines in most codecs are optimized for speed, not quality.

QUOTE(Snake @ Jul 29 2005, 12:03 PM)
This also brings the question of filtering that the coder applies, is this variable by source samplerate and choosen compression?
There are both constant and variable limits on frequency. When an mp3 is made, the encoder first selects a hard limit on frequency, determined mostly by the bitrate or quality mode selected at the start. But afterwards it will still drop some high frequency content below that limit if the psychoacoustic model says that it isn't important. The source sample rate is actually not much considered in this process, except when the source is even lower than what the encoder would otherwise use at that bitrate.
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.