IPB

Welcome Guest ( Log In | Register )

2 Pages V   1 2 >  
Reply to this topicStart new topic
LAME, CBR, VBR,.... I'm confused!
Immo
post Mar 26 2003, 19:51
Post #1





Group: Members
Posts: 25
Joined: 26-March 03
From: Latvia
Member No.: 5684



Hi!

This is my first post on this board, and the reason why I'm posting is to find an explanation for one particular, interesting issue of LAME MP3 compression...

I took a sample from a live instrumental concert with clear high-frequency sounds. I compressed it with two different settings, using LAME 3.91.

-b 192 -m j -h -q 0 (= 192kbps constant, joint stereo, quality-optimised, max. quality) and
--alt-preset standard, which produced a slightly larger file, the bitrate averaging at 200kbps.

The results were both quite good and I couldn't tell the difference in sound - maybe I lack the equipment.

I performed a spectral frequency analysis on each of the results.

Here's what it looked like:


Let's look at the left image: the frequency meter suggests thet there's a sharp cut at 16kHz. Nevertheless, some sounds are given higher frequencies, but then there is another sharp cut just under 19kHz, above which nothing can be seen.

Now the right image: up to about 16kHz the frequencies are generally preserved. Then they gradually become thinner in a varying manner, depending, i suppose, on their importance. There is no sharp cut below ~19.8kHz.

I do not know much abot audio compression - maybe I'm misunderstanding the whole thing - so I'd like you to ask you first: which picture do you think corresponds to which compression method?

Immo
Go to the top of the page
+Quote Post
/\/ephaestous
post Mar 26 2003, 19:59
Post #2





Group: Members
Posts: 648
Joined: 25-October 02
From: Colombia
Member No.: 3620



YOU CANT' SAY SOMETHING SOUNDS BETTER BASED ON A PICTURE.


--------------------
"You have the right to remain silent. Anything you say will be misquoted, then used against you."
Go to the top of the page
+Quote Post
ff123
post Mar 26 2003, 20:46
Post #3


ABC/HR developer, ff123.net admin


Group: Developer (Donating)
Posts: 1396
Joined: 24-September 01
Member No.: 12



I'd say that --alt-preset standard is the picture on the left.

gpsycho tends to leave little "speckles" of high-frequency low-amplitude sound which are disconnected from the rest of the picture. At lower bitrates these speckles appear at lower frequencies and can be audible to some people. They have been described by other people as "ringing" or just the classic watery sound.

The lowpass is probably another clue. I don't know for sure, but I think the default lowpass at 192 kbit/s is higher than --alt-preset standard (I'm talking about the higher cutoff frequency, near 19 kHz, not the 16 kHz cutoff).

But /\/ephaestous has a point: if you can't hear it, it's not important (at least at that bitrate).

ff123
Go to the top of the page
+Quote Post
evereux
post Mar 26 2003, 21:08
Post #4





Group: Members
Posts: 907
Joined: 9-February 02
From: Cheshire, UK
Member No.: 1296



QUOTE (/\/ephaestous @ Mar 26 2003 - 06:59 PM)
YOU CANT' SAY SOMETHING SOUNDS BETTER BASED ON A PICTURE.

I don't believe he said it did?

The regulars here know that looking at graphs is pretty irrelevant when coming to the actual listening. But I still think it's interesting from a technical point of view to see what the codecs are doing.


--------------------
daefeatures.co.uk
Go to the top of the page
+Quote Post
Pio2001
post Mar 26 2003, 21:12
Post #5


Moderator


Group: Super Moderator
Posts: 3936
Joined: 29-September 01
Member No.: 73



The left picture must be alt preset standard, because the lowpass is lower (18671 to 19205 Hz, vs 19383 to 19916 Hz for the other command line).

Nothing can be said about quality or audible difference looking at the pictures, because an MP3 encoder is targeted at removing as much inaudible sounds as possible. Therefore a lack of frequencies can as well mean that some audible parts are missing (bad work, or too low setting), than that the encoder managed a very good compression, removing a lot of unuseful things.

BTW, there are also alt presets for CBR, that provide better quality than your command line. the syntax is --alt-preset CBR 192, and, according to http://www.hydrogenaudio.org/forums/index....=ST&f=15&t=3076 , and to the verbose switch, it means

-h -b 192 --nspsytune -m j --lowpass 19500 --athtype 2 --ns-bass -6 --scale 0.97

There must be a slight difference in one of the settings, since I get is different files with the preset and the command line (JohnV ? Dibrom ?)

And before you ask, there is no equivalent command line to the VBR alt presets (FAQ)
Go to the top of the page
+Quote Post
outscape
post Mar 26 2003, 21:18
Post #6





Group: Members
Posts: 374
Joined: 29-September 01
From: Toronto
Member No.: 30



i have to agree with /\/ephaestous on this.. you can't tell the sound quality by looking at a picture. well, sort of..

>>>'Now the right image: up to about 16kHz the frequencies are generally preserved.'<<<

this is not necessrily true. in many cases, the mp3 format in general doesn't code high frequencies very well. so, while these frequencies may "show up" on the graph, it doesn't mean that they are coded properly or sound like the high frequency content of the source file. this is why we use our ears, not eyes

>>>'I'd like you to ask you first: which picture do you think corresponds to which compression method?'<<<

i say the image on the left is --alt-preset standard because of the lowpass at ~19.5 kHz


--------------------
Be healthy, be kind, grow rich and prosper
Go to the top of the page
+Quote Post
/\/ephaestous
post Mar 26 2003, 21:21
Post #7





Group: Members
Posts: 648
Joined: 25-October 02
From: Colombia
Member No.: 3620



QUOTE (evereux @ Mar 26 2003 - 03:08 PM)
QUOTE (/\/ephaestous @ Mar 26 2003 - 06:59 PM)
YOU CANT' SAY SOMETHING SOUNDS BETTER BASED ON A PICTURE.

I don't believe he said it did?

The regulars here know that looking at graphs is pretty irrelevant when coming to the actual listening. But I still think it's interesting from a technical point of view to see what the codecs are doing.

not really, pictures are misleading, check out a Mp3pro or WMA graph and you'll think it sounds better than APS. and you can't tell what has been transformed trhu the graph, the most you can see is the lowpass,

This post has been edited by /\/ephaestous: Mar 26 2003, 21:22


--------------------
"You have the right to remain silent. Anything you say will be misquoted, then used against you."
Go to the top of the page
+Quote Post
Immo
post Mar 26 2003, 22:11
Post #8





Group: Members
Posts: 25
Joined: 26-March 03
From: Latvia
Member No.: 5684



Thanks for the replies, folks.

All who guessed, guessed right about --alt-preset standard - it's the picture on the left. But there's something bugging me.

I really didn't say anything about which sample sounds better - either my ears or my headphones are too bad for that. But REGARDLESS of the audible result it was a surprise for me to see that the lowpass filter, considering the two clearly visible boundaries, is applied much earlier in a VBR algorythm than in CBR. A question arises: how is the advantage of VBR being used? I earlier thought that VBR provides the possibility to preserve a broader range of frequencies where it is needed and cut down on them where it isn't.
As far as I understand, the VBR codec (like any other) "considers" the lower frequencies more important and cuts off the higher ones, which is, of course, a good idea to some extent, as people don't hear them very well. But then why does the CBR codec leave so much of them? It could as well apply a lower lowpass filter if it's such a good idea, but it doesn't. Why? After all, it's the same version of the same encoder, so the applied techniques are surely coordinated.
Doesn't this fact surprise you a bit? Just a little bit??? smile.gif
Or have I just gone mad? ohmy.gif

The point is, I don't believe that the marginally higher frequencies preserved in the CBR really destroy the overall sound quality, especially they wouldn't in a VBR codec, where there is a possibility to assign more bits at a particular point...

Regards,
Immo

This post has been edited by Immo: Mar 26 2003, 22:24
Go to the top of the page
+Quote Post
Andavari
post Mar 26 2003, 22:38
Post #9





Group: Members
Posts: 935
Joined: 3-June 02
From: USA
Member No.: 2204



QUOTE (Immo @ Mar 26 2003 - 03:11 PM)
The point is, I don't believe that the marginally higher frequencies preserved in the CBR really destroy the overall sound quality, especially they wouldn't in a VBR codec, where there is a possibility to assign more bits at a particular point...

There's also the possibility that 192KBPS is transparent to you or very near transparent, and perhaps your hearing capabilities.

My hearing isn't getting any better as I am getting older, however I can just about always tell a high quality LAME --alt-preset standard MP3 versus the likes of a 192KBPS CBR MP3 encoded by LAME or FhG.


--------------------
Complexity of incoherent design.
Go to the top of the page
+Quote Post
[proxima]
post Mar 26 2003, 23:11
Post #10





Group: Members
Posts: 197
Joined: 12-October 02
From: Italy
Member No.: 3537



QUOTE (Pio2001 @ Mar 26 2003 - 09:12 PM)
-h -b 192 --nspsytune -m j --lowpass 19500 --athtype 2 --ns-bass -6 --scale 0.97

There must be a slight difference in one of the settings, since I get is different files with the preset and the command line

--alt-preset cbr 192 is: -b 192 -h -mj --nspsytune --athtype 2 --lowpass 19.5 --nsmsfix 1.7 --ns-bass -2 --scale 0.97

With v3.90.2 and these switches i get the same decoded wav.

To get the same MP3 files you must add --nssafejoint:

-b 192 -h -mj --nspsytune --athtype 2 --lowpass 19.5 --nssafejoint --nsmsfix 1.7 --ns-bass -2 --scale 0.97

This is quite strange because --nssafejoint before --nsmsfix has no effect. I think that it must be something related with LAME header. IIRC --nssafejoint is equal to --nsmsfix 1

This post has been edited by [proxima]: Mar 26 2003, 23:13


--------------------
WavPack 4.3 -mfx5
LAME 3.97 -V5 --vbr-new --athaa-sensitivity 1
Go to the top of the page
+Quote Post
LordSyl
post Mar 26 2003, 23:54
Post #11





Group: Members
Posts: 198
Joined: 19-October 02
From: Valencia
Member No.: 3577



Please, don't confuse newbies with those stupid commandlines...you already know what is the result of those commandline tweakings rolleyes.gif
Go to the top of the page
+Quote Post
Pio2001
post Mar 27 2003, 00:30
Post #12


Moderator


Group: Super Moderator
Posts: 3936
Joined: 29-September 01
Member No.: 73



Right, right,
It started when I was about to write "the alt presets are better than any command line", but it occured to me that we were speaking about alt preset CBR, and it didn't make sense.

Immo, the global lowpass needed depends on the hearing ability of the listener. There have been some tests with sweep tones and music lowpassed here recently, to see how high people could hear, but they are affected by the fact that most soundcard resample, and therefore produce low frequency sounds when high frequency ones are fed into them (the "alias" effect).

The lowpass used in the command line and the one used in the alt preset can't be compared, because they were developed at a different time by different people.
Lowpassing is a powerful way to reduce the bitrate of a VBR file, that's why lowpass filters are used in the presets.
Go to the top of the page
+Quote Post
mithrandir
post Mar 27 2003, 01:43
Post #13





Group: Members
Posts: 669
Joined: 15-January 02
From: SE Pennsylvania
Member No.: 1032



QUOTE (Immo @ Mar 26 2003 - 04:11 PM)
A question arises: how is the advantage of VBR being used? I earlier thought that VBR provides the possibility to preserve a broader range of frequencies where it is needed and cut down on them where it isn't.
As far as I understand, the VBR codec (like any other) "considers" the lower frequencies more important and cuts off the higher ones, which is, of course, a good idea to some extent, as people don't hear them very well. But then why does the CBR codec leave so much of them? It could as well apply a lower lowpass filter if it's such a good idea, but it doesn't.  Why?

One phrase: sfb21.

Scalefactor band 21 is the nemesis of MP3 VBR (well, one of them). Unlike the first 20 scalefactor bands (<16KHz), scalefactor band 21 (>16KHz) doesn't use a scalefactor and this leads to many problems. You'll find more technical explanations about sfb21 here at HA but understand that the lower lowpass of VBR is a result of a MP3 design flaw. The more you cram in sfb21 (i.e. greater HF retention) the more the bitrate will bloat. If you are shooting for a certain bitrate like --alt-preset standard does, you don't want to waste all you bits in a single sfb, especially one that is arguably the least critical.

CBR doesn't have the same limitation because it doesn't employ sfb21. Does that make CBR superior? No, because the workarounds for sfb21 are generally effective.

But I wouldn't worry. Who can really hear the difference between a 19KHz and a 19.5KHz lowpass?

This post has been edited by mithrandir: Mar 27 2003, 01:44
Go to the top of the page
+Quote Post
NeoRenegade
post Mar 27 2003, 06:46
Post #14





Group: Members
Posts: 723
Joined: 29-November 01
Member No.: 563



I just wanted to point out, Immo, that your commandlin is kind of funy. you specifiy -h, which is equivalent to -q2 for your information, but then you specify -q 0 (which in current versions of the encoder is flawed so the quality is not better), which overrides the -q 2.

Not exactly an issue now, though.

It's good to have you here. Happy ripping!...
Go to the top of the page
+Quote Post
Immo
post Mar 27 2003, 13:08
Post #15





Group: Members
Posts: 25
Joined: 26-March 03
From: Latvia
Member No.: 5684



Good afternoon,

thanks for the tip, NeoRenegade, the reason for that is my (supposedly lame) usage of the RazorLame frontend.

Thank you all for the explanations. The picture becomes clearer to me, at least after Mithrandir's post.

I'm not so sure about Pio2001's answer, though:
QUOTE
Lowpassing is a powerful way to reduce the bitrate of a VBR file, that's why lowpass filters are used in the presets.


I suppose lowpassing is just as powerful a tool to reduce the bitrate of a CBR file, if not, in fact, even more powerful, as VBR should have more tricks up the sleeve. But I'll settle me with the information I have now smile.gif

I tried to use Lame 3.93.1 with the same CBR settings: -b 192 -m j -q 0.
Here is the comparison. The first image is 3.91, the second - 3.93.1:


What do we see? In the 3.91 there is no clear cut at 16kHz, as opposed to 3.93.1, where we can distinguish a cut much better.

Maybe the developers had noticed something similar to what I did, and made an effort to cut more on the CBR high frequencies?

Anyway, before I forget, here are the original two sound samples, in case you want to listen to them and see if you can tell a difference:
3.91 CBR 192 (-b 192 -m j -q 0), 380KB
3.91 --alt-preset standard, 404KB

Regards,
Immo
Go to the top of the page
+Quote Post
Pio2001
post Mar 27 2003, 14:28
Post #16


Moderator


Group: Super Moderator
Posts: 3936
Joined: 29-September 01
Member No.: 73



QUOTE (Immo @ Mar 27 2003 - 03:08 PM)
I suppose lowpassing is just as powerful a tool to reduce the bitrate of a CBR file,

Adding a lowpass switch to a cbr 192 command line won't decrease it's bitrate to anything else than 192 kbps.

Don't worry, you're not the first one to make this mistake wink.gif
Go to the top of the page
+Quote Post
Immo
post Mar 27 2003, 15:12
Post #17





Group: Members
Posts: 25
Joined: 26-March 03
From: Latvia
Member No.: 5684



Sorry, you're right! smile.gif

What I meant was that lowpassing is an even more important tool in CBR to increase the overall sound quality than in VBR, as you don't have the possibility to assign more bits to a particular place, isn't it?

In 128kbps CBR, for instance, LAME applies a lowpass filter sooner than in --alt-preset 128 (VBR), so it's the other way around and corresponds to my understanding of VBR, so that makes this whole thing even more mysterious.

Cheers,
Immo

This post has been edited by Immo: Mar 27 2003, 15:21
Go to the top of the page
+Quote Post
Lev
post Mar 27 2003, 17:36
Post #18





Group: Members
Posts: 524
Joined: 7-November 02
From: Gloucester, UK
Member No.: 3716



/\/ephaestous:

QUOTE
YOU CANT' SAY SOMETHING SOUNDS BETTER BASED ON A PICTURE.



--------------------
"You have the right to remain silent. Anything you say will be misquoted, then used against you."


Heh, worlds most ironic sig-line rolleyes.gif


--------------------
http://www.megalev.co.uk
Go to the top of the page
+Quote Post
Gecko
post Mar 27 2003, 17:58
Post #19





Group: Members
Posts: 948
Joined: 15-December 01
From: Germany
Member No.: 662



Immo: VBR isn't about preserving HF content. It's about providing the same sound quality over the whole piece of music. The sound complexity of your music can vary a great deal so VBR tries to find the bitrate needed to encode a small piece of sound at a given quality level. There are a lot more things to worry about than just HF content.

Hearing the difference between --alt-preset standard and your command line is a matter of training mostly. Equipment, as long as it is halfway decent, plays only a very minor role in hearing these differences. Give headphones a try, they can be more "revealing".
Go to the top of the page
+Quote Post
Immo
post Mar 27 2003, 18:39
Post #20





Group: Members
Posts: 25
Joined: 26-March 03
From: Latvia
Member No.: 5684



Lev: it gets even more ironic when the author makes the line come true wink.gif

Gecko: yes, well, I guess it is another way to put the thing. But it doesn't really explain why, if a higher quality can be obtained by using up to 320 kbps available on lower frequencies, the CBR codec uses its 192 on higher...

And - my sound "equipment" smile.gif at the moment actually is a pair of low-end headphones, that's why I don't rely much on it, but maybe it's not that bad.

Immo

This post has been edited by Immo: Mar 27 2003, 18:46
Go to the top of the page
+Quote Post
deej_1977
post Mar 27 2003, 18:47
Post #21





Group: Members
Posts: 157
Joined: 21-October 01
From: Belgium
Member No.: 332



QUOTE (Pio2001 @ Mar 27 2003 - 03:28 PM)
Adding a lowpass switch to a cbr 192 command line won't decrease it's bitrate to anything else than 192 kbps.

Agree but doesn't adding a lowpass enhance/optimise the use of the bit reservoir in CBR mode?

This post has been edited by deej_1977: Mar 27 2003, 18:48


--------------------
No inspiration
Go to the top of the page
+Quote Post
LordSyl
post Mar 27 2003, 19:30
Post #22





Group: Members
Posts: 198
Joined: 19-October 02
From: Valencia
Member No.: 3577



CBR is shit...always. The entire fact of giving the same bitrate for transients than for silence is...idiotic.
As for quality, when you set CBR mode, you set VQ, CBR (variable quality, constant bitrate) opposed to VBR (constant quality, variable bitrate)

That happens because CBR uses always a fixed bitrate, so it becomes both overkill and lack of bits at the same time: bits that aren't used while encoding are set to null data to fill the specified bitrate, while other times it will run short of bits on harder-to-encode parts.

VBR, however, will decide what shall be encoded and what has to be left, without wasting bits: it can use bitrates as low as 128kbps or as high as 320 if it considers it necessary.

--alt-preset standard, --alt-preset extreme and --alt-preset insane* are code-tweaked: it's impossible to reach them through commandlines [no, do NOT use them!!!] in terms of quality.

*--alt-preset insane is CBR, yes, but it's on the highest bitrate allowed for the mp3 standard, so it won't get short of bits (inside of mp3's specs) , but it also will happily start wasting bits..... ph34r.gif

This post has been edited by Syleth: Mar 27 2003, 19:34
Go to the top of the page
+Quote Post
sony666
post Mar 28 2003, 01:58
Post #23





Group: Members
Posts: 573
Joined: 22-February 02
Member No.: 1375



CBR is not "always shit", plz stay serious. Especially not for the music I listen to (Rock, Heavy etc) where are no silent parts and pure tones.

If you plan to use your encodes for listening on the PC and playing them in your car/portable/DVD player, "--alt-preset cbr 192" is a very good choice, especially since lame is told to have very good short block/bit reservior handling (mp3 CBR is not really CBR), and the VBR files give serious trouble to some hardware players.

Oh btw, does anyone know if the "--alt-preset cbr" modes have been improved between lame 3.90.2 and 3.93.1, or are the CBR modes more or less "finished". Thanks.

This post has been edited by sony666: Mar 28 2003, 02:04
Go to the top of the page
+Quote Post
NeoRenegade
post Mar 28 2003, 03:29
Post #24





Group: Members
Posts: 723
Joined: 29-November 01
Member No.: 563



The lame development team works on the encoder and the switches. Mainly Dibrom works on the Alt Presets. There should be no difference between the presets in 3.90.2 and 3.93.1 other than that 3.93.1's VBR Alt Presets may not function totally properly, and 3.93.1 has "Alt Presets" under 80kbps which 3.90.3 doesn't...
Go to the top of the page
+Quote Post
roman
post Mar 28 2003, 08:38
Post #25





Group: Members
Posts: 38
Joined: 4-December 02
From: Russia
Member No.: 3980



To Immo
About your 1st pictures...
Can you think about VBR as a manner of redistributing bitrate between intensive and easy sections, instead of CBR, where such sections gives equal bitrate? From that point maybe those pics will be cleaner?
I.e.: for intensive section (we see widefreq beat) coder uses more bitrate, which he needs to take from unintensive section. And he does it, casually lowering lowpass filter further.
Am I right, at least a bit?

P.S. Seems, Gecko says a kind of it.

This post has been edited by roman: Mar 28 2003, 08:42
Go to the top of the page
+Quote Post

2 Pages V   1 2 >
Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 22nd December 2014 - 01:13