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: Does adding -q0 to -b320 improve quality in LAME 3.99.5? (Read 41705 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Can anyone give a definitive answer on whether using -q0 with -b 320 will provide better quality than using -b 320 without a -q switch, when encoding with the latest version of Lame (3.99.5)?  I've read various posts about it and some say it's buggy, some say it's in an experimental stage of development and some say it's brilliant.  If -q0 isn't recommended, can better quality be achieved when using -b 320 with another -q switch as opposed to using -b 320 without a -q switch?

Thanks.

Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #1
You need to check out halb27's constraint vbr variant if you want to improve on cbr 320.

Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #2
Without double-blind test results for the specific tracks you want to encode, there is no point in commenting about sound quality for various encodes.

Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #3
And my understanding is that the default is -q3, which is mapped to the same thing as -q0.

Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #4
...or just use VBR and never mind the -q switch.

Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #5
And my understanding is that the default is -q3, which is mapped to the same thing as -q0.
AFAIR, this applies to VBR only, with the two being different under CBR. Interested readers can check this for themselves in the source code or, if not feeling that adventurous, perhaps in previous discussions on this same old question.

Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #6
And my understanding is that the default is -q3, which is mapped to the same thing as -q0.


Yeah I was just about to say I thought that's only in VBR.  I just encoded a track using -b 320 without a -q switch so the default of q3 was used (as was illustrated in the Lame encoder window) and then I encoded the same track using -b 320 with the -q0 switch and the encode with the -q0 switch took 4 times longer, 28 seconds instead of 7, so in CBR q3 isn't mapped to q0.

Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #7
Quote
If -q0 isn't recommended, can better quality be achieved when using -b 320 with another -q switch as opposed to using -b 320 without a -q switch?
As a broad generalization -   If you are getting audible artifacts at 320kbps (or V0), there's probably nothing you can do to improve the default performance.

Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #8
Just wanted to point out that -h (which means high quality on the documentation) is mapped to -q 2.

Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #9
Just wanted to point out that -h (which means high quality on the documentation) is mapped to -q 2.


Yeah it's strange that the developers have set the 'high quality' option to map to -q2 and not -q0, which is presumably higher quality although when I read the documentation it did say "-q 2:  recommended.  Same as -h.  -q 0 and -q 1 are slow and may not produce significantly higher quality.".  I kinda thought nothing of it but I assume the difference between q2 and q0 really must be either negligible or nothing at all, or else why would the 'high quality' setting (-h) be q2 and not q0?  It's still kinda counter intuitive if you want the highest quality to not use the highest quality setting (q0) and to use q2 instead... Unless the numbers are arbitrary and q2 is the best quality, due to q0 being buggy or experimental, if it is, or maybe it's just because q0 and q1 are slow and they are better quality than q2 but only by a negligible amount.

Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #10
I would simply add that most if not all of the tuning of the algorithms was probably performed with -h, so use of any other switch means using relatively untested areas of code. That's enough for me to stick with -h.

Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #11
First, about the OP's question: There is no definitive answer, because it hasn't been tested extensively.



Now, onto LAME's history:

The lame -q switches have had several evolutions during their history, including when they didn't exist and there was just -f and -h.
They are mostly related to CBR, because for VBR, the process of encoding is less dependant on how hard it tries to fit the data into the specified bitrate.
I won't enter much in detail, but the lame changelog has some information related to what was added to the different options.

Said that, it's important to understand this:

-f (and the -q 9 to -q 6 options) disable some of the analysis tools related to psychoacoustics and quantization. This means it calculates less information and as such, can make mistakes easier. The goal in this case is exclusively speed.
-h (and the -q 3 to -q 0 options) enable extra loops and analysis that allow to find the best compromise out of several options. The goal in this case, was to increase the quality for a determined bitrate. (CBR, remember?).

Now, onto the -q0 bug, the -q3 is the new -q2, and the -h is mapped to -q2 thing:

Several years ago, -q0 had a bug in its algorithm that could (i.e. not always) cause worse quality than -h (-q2 at that time). The bug was in the inner loop that tries to get the best quality by "brute force".  Later on, this was fixed, but again it didn't receive much testing.

Later, a new "brute force" algorithm was created, and was activated with the -q 0 setting. This meant than then, all qualities were moved one position up. I.e. old -q2 became -q3, old -q0 became -q1 and so on (and yes.. old -q9 disappeared).

What didn't get changed was the quality to what -h was mapping, so this is why now -q 3 is the default (which used to be -h), and -h maintains the old mapping, that was -q 2.

It didn't help that nowadays, LAME is mostly tested for VBR, and as has been said already, the quality values work differently for VBR because they don't activate the same things.

Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #12
I would simply add that most if not all of the tuning of the algorithms was probably performed with -h, so use of any other switch means using relatively untested areas of code. That's enough for me to stick with -h.


I wonder why there isn't any mention of the -h switch (or the -q switches) on the wiki recommended settings.  It says for best quality use -b 320 (with no switches).  I wonder if it is safest to use -b 320 with no switches because that way you're using the developer's default settings that are regarded as safe / stable so there is the lowest likelihood of getting any artifacts.  Can anyone clarify that?  Is that the thinking behind -b 320 without any switches being listed in the wiki recommended settings?

Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #13
I wonder why there isn't any mention of the -h switch (or the -q switches) on the wiki recommended settings.  It says for best quality use -b 320 (with no switches).

That's because -h is the default, so there is no need to include it.

Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #14
That's because -h is the default, so there is no need to include it.


-h isn't the default.  When you use -b 320 with no switches it defaults to q3 and when you use -b 320 -h it maps to q2.  I know q3 is the old q2 but in the Lame documentation and when you run lame --longhelp it says -h is the same as -q2 and it's recommended to use -h.  If that is the case, on the wiki why doesn't it say it's recommended to use -h?  Perhaps the Lame documentation is out of date and things have changed.

Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #15
Probably because there no evidence that it provides any improvement in general.

Please refer to my first post in this discussion:
http://www.hydrogenaudio.org/forums/index....st&p=850498

It isn't just my opinion; it is forum policy.

Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #16
The nice thing about using the default in this case, is that you got the same results from one version to the next, even when the definitions of -q and -h were changing.

I distrust any switch for which the response to the question "What does it do?" is "For which version?"


Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #18
Most of the information we have on the q switch is here:
http://wiki.hydrogenaudio.org/index.php?title=LAME_-q_switch

The information is based on previous discussions, feedback from the developers, the various documentations, verbose output of the lame tools, and the file headers of the resulting files.

EDIT: Note that those descriptions are as set by the LAME devs on the various docs, not Hydrogen Audio.

Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #19
Can anyone give a definitive answer on whether using -q0 with -b 320 will provide better quality than using -b 320 without a -q switch, when encoding with the latest version of Lame (3.99.5)?  I've read various posts about it and some say it's buggy, some say it's in an experimental stage of development and some say it's brilliant.  If -q0 isn't recommended, can better quality be achieved when using -b 320 with another -q switch as opposed to using -b 320 without a -q switch?

Thanks.


Will it provide better quality, YES.

Ask yourself this... If you pour a 1000 gallons of water into the ocean. does it increase it's level... YES. But would someone on the other side of the world notice the change?

Can you hear the difference... I can't answer that, but I think probably not.

It doesn't hurt for archiving but is the encoding time worth it? On my machine -b320 encodes at 38x where as -b320 -q0 does 10x

Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #20
With lossy encoding, sound quality depends on what you can prove. If you cannot tell the difference between a -q0 encode and a -q3 encode then -q0 is not any better.

I suppose interested parties could try mushra testing files encoded to 112 CBR with various -q values in order to possibly get a sense of how the setting works, though once you hit transparency, there really is no such thing as increased quality.

Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #21
Will it provide better quality, YES.

Ask yourself this... If you pour a 1000 gallons of water into the ocean. does it increase it's level... YES. But would someone on the other side of the world notice the change?


That example is illustrative, but it is not completely correct, because increasing the level of quality does not mean "add more quality". It strictly means use more tools to determine the best usage of bits to retain the level of quality that the tools can analyze.

Between q3 and q0, there is also a change of some parameters, as described by the wiki article posted by Makaki, that change the level required. But that does not necessarily mean more quality, it means what is allowable.


As for the scenario described by greynol, testing a lower bitrate has its pros and cons. Since the bitrate is more restricted, trying harder can obtain a better representation of bits than what a lower q would do, but also, since less bitrate is available, the increased level of some parameters might not be fullfilled.


Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #22
I cannot see why q0 would not provide higher quality in some cases. Its more analysis and with cbr/abr that's a good thing. If we deviate in the other direction  - towards Q9 thing do degrade at a certain point. Obviously Q3 was chosen as a 'sweet spot' for speed vs quality just like compression levels vs speed in lossless coders. To me it seems most people are after very fast encoding which I can understand and it becomes easy to dismiss the slower settings on those grounds that they are mostly 'useless'.

Whether the differences are audible is another issue. But if one isn't in a big hurry I'd give -Q0 or -Q1 a go using a lower encoding priority .

Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #23
It doesn't hurt for archiving...

Oh yes, it does hurt just using a lossy codec for archiving, whatever the codec and the bitrate or the quality level. It is a practice not to be endorsed.
... I live by long distance.

Does adding -q0 to -b320 improve quality in LAME 3.99.5?

Reply #24
Is it me, or are the arguments presented to support the idea that lower q values result in higher quality are just circular reasoning?

Whether the differences are audible is another issue.

No, whether the differences are audible is the issue.

Quote
mostly useless

Show me an example where it is useful @320 (per the topic) and you will have a leg to stand on.