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: Lower algorithm quality in LAME produces better quality than anything above -q 3 (Read 5715 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Lower algorithm quality in LAME produces better quality than anything above -q 3

A while ago I was experimenting with the audio quality of MP3s, and I determined that (mostly for CBR) using the "Algorithm Quality" (-q) level 4 on LAME (3.100.1) produces much better quality than 3 (the default) and above.
It's not super easy to tell, so I was second guessing myself, but at low bitrates and certain types of audio it's quite apparent. Even at 128kbps however (and even sometimes 160kbps), it is possible to tell between the difference, but I'm not an audiophile so I wasn't certain.

I was able to complete an ABX test with 100% certainty between two 32kbps files, one encoded with -q 4 and the other -q 3.

Sometimes it causes more or less artifacts (I haven't quite figured out all the details of this issue) but major sources of MP3 content (eg. Soundcloud) have more artifacts in the content than it should for the bitrate. One of the ways you can sometimes tell is pre-echo that contains a higher frequency noise (kind of like a "snipping" sound), and another way is to hear a kind of warbling "squishness" to the audio.
I believe that this issue is fairly quite widespread; most common MP3s encoded within 10yrs ago or more using LAME have many of these extra warbly, squishy artifacts that really don't need to be there.

This issue also affects ABR encoding, but (I haven't tested enough) I believe it only applies to -q 2 and above. VBR is not affected, since -q 0 to -q 4 encode identical files.

This issue is less apparent on older versions of LAME, since 3.96.1 didn't seem to have artifacts on -q 3 when I checked (but it did above!)

I've uploaded the two 32kbps encodes, as well as the original WAV (which I obtained from a disregarded bug report on LAME's Sourceforge stating a similar issue, ironically) and the ABX results. Feel free to experiment with any of this yourself.

I just really would like to see this fixed in the encoder itself, I get bothered by little things like this and a low audio quality seems to be so prevalent. At least fixing this issue will improve the quality where it counts, I guess.

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #1
Interesting finding, the LAME project may actually have a bigger room for improvement.

According to the documentation , -h is equal to the -q2.

https://svn.code.sf.net/p/lame/svn/trunk/lame/USAGE
Quote
q n           Internal algorithm quality setting 0..9.
               0 = slowest algorithms, but potentially highest quality
               9 = faster algorithms, very poor quality
            Default is 3. Read the differences between VBR and CBR below.
-h             same as -q2
-f             same as -q7

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #2
Interesting finding, the LAME project may actually have a bigger room for improvement.
The thing is, older versions of the encoder achieved this level of quality by default. This seems to be a bug with newer releases...?

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #3
Its harder to pick the difference @ 192 + and noise shaping 1 is used.
At 128 or less its very apparent exactly as you mention . A warbling squishy artifact affecting everything. Noise shaping 2 is used. Q3..0  (NS+extra precision) Q4..6 (NS without extra precision). How it all works i don't yet know.



CBR / ABR  --verbose 160k and lower

-q0 .. 1
    noise shaping: 2
         ^ amplification: 2
         ^ stopping: 1

-q2 .. 3
    noise shaping: 2
         ^ amplification: 1
         ^ stopping: 1

-Q4 .. 6
    noise shaping: 2
         ^ amplification: 0
         ^ stopping: 0

-q7 (-f)
    noise shaping: 0
         ^ amplification: 0
         ^ stopping: 0


CBR / ABR 192k --verbose and higher NS 1

-q0 .. 1
    noise shaping: 1
         ^ amplification: 2
         ^ stopping: 1

-q2 .. 3
    noise shaping: 1
         ^ amplification: 1
         ^ stopping: 1

-Q4 .. 6
    noise shaping: 1
         ^ amplification: 0
         ^ stopping: 0

-q7 (-f)
    noise shaping: 0
         ^ amplification: 0
         ^ stopping: 0

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #4
Yeah, I too am under the impression that Lame CBR seems to have regressed compared to older releases and also compared to the Helix MP3 encoder.

In CBR, Lame with default settings seems to create "holes" in the higher frequency bands, which to my ears seem create a metallic, chirpy sound. On occasion, I tried to create a discussion topic on that, but given that we don't listen with our eyes and that deriving audio quality claims from spectrogram-images is problematic at best, I felt like I didn't have enough evidence to warrant a discussion.

(Copyright law in my area also does not know the concept of "fair use", so posting any of the samples I tested may be troublesome, too).

Nonetheless, I attach two images of spectrograms. One is from the GammaBoost's sample files (q3 vs q4), another one is showing Lame and Helix MP3 (more restraint needed here regarding audio quality comparisons) on a sample file in my collection.

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #5
I settled on ABR 192 or 200 using -q > 3. To me its surprisingly robust without having to deal with cbr or pure vbr (vbr-old vs new vs- Y etc)

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #6
Yeah, I too am under the impression that Lame CBR seems to have regressed compared to older releases and also compared to the Helix MP3 encoder.

In CBR, Lame with default settings seems to create "holes" in the higher frequency bands, which to my ears seem create a metallic, chirpy sound. On occasion, I tried to create a discussion topic on that, but given that we don't listen with our eyes and that deriving audio quality claims from spectrogram-images is problematic at best, I felt like I didn't have enough evidence to warrant a discussion.

(Copyright law in my area also does not know the concept of "fair use", so posting any of the samples I tested may be troublesome, too).

Nonetheless, I attach two images of spectrograms. One is from the GammaBoost's sample files (q3 vs q4), another one is showing Lame and Helix MP3 (more restraint needed here regarding audio quality comparisons) on a sample file in my collection.


Can you test -b192 -q3 vs 4 .  @ 192 and more Lame use NS 1. Not sure if that is the issue or specifically -q3..0

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #7
Can you test -b192 -q3 vs 4 .  @ 192 and more Lame use NS 1. Not sure if that is the issue or specifically -q3..0

I certainly shall resume testing. I'm currently without headphones and my test files (holidays), but I hope I can get back to testing next year.

However, for my old ears, 192 kbps is just too much and I don't really expect to be able to ABX anything. Back when I compared old/new Lame and Helix, I went into 96/112/128 (web radio bitrates). There the differences seemed to be somewhat reliably demonstrable.

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #8
Can you test -b192 -q3 vs 4 .  @ 192 and more Lame use NS 1. Not sure if that is the issue or specifically -q3..0

I certainly shall resume testing. I'm currently without headphones and my test files (holidays), but I hope I can get back to testing next year.

However, for my old ears, 192 kbps is just too much and I don't really expect to be able to ABX anything. Back when I compared old/new Lame and Helix, I went into 96/112/128 (web radio bitrates). There the differences seemed to be somewhat reliably demonstrable.

Thanks, I think a spectrogram will be fine (for me) to see if the 'holes' are there @ 192

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #9
Thanks, I think a spectrogram will be fine (for me) to see if the 'holes' are there @ 192

Well, I did create spectrograms of -b192 -q3 and -b192 -q4. And yes, I can *see* differences in the spectrogram. However, at these bitrates, this doesn't at all mean there are meaningful differences in perceived audio quality (what we are interested in).


Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #10
Thanks, I think a spectrogram will be fine (for me) to see if the 'holes' are there @ 192

Well, I did create spectrograms of -b192 -q3 and -b192 -q4. And yes, I can *see* differences in the spectrogram. However, at these bitrates, this doesn't at all mean there are meaningful differences in perceived audio quality (what we are interested in).


Thanks, I think a spectrogram will be fine (for me) to see if the 'holes' are there @ 192

Well, I did create spectrograms of -b192 -q3 and -b192 -q4. And yes, I can *see* differences in the spectrogram. However, at these bitrates, this doesn't at all mean there are meaningful differences in perceived audio quality (what we are interested in).


You may be right. My hunch is use -q4..7 esp @ lower rates. @ 192+ one can go either way.

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #11
I guess a 'hack' would be to default -q4 for -b160 and under and for --abr 175 and lower.

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #12
Okay, at -b 96 the differences between -q3 and -q4 are so easily ABXable in the first two seconds of the sample (easily detectable dropouts in the noise sweep), that I think that it's fair to say that for this sample and that bitrate, q3 underperforms q4.

Squishyball ABX result on a PC with cheap Logitech PC speakers:

Code: [Select]
squishyball --abx -e 2 q3-b96.wav q4-b96.wav 

A/B/X test results:
Correct sample identified 7/8 trials.
Probability of 7 or better correct via random chance: 3.52%

Testing metadata:
Test was aborted early (8/20 trials).
Total time spent testing: 2:24.30
Total seeks: 0
Silent flip used 17 times.
Undo was not used.

edit: Just to be clear - "fuller" spectrograms don't equal "better" audio quality. TOS 8 applies. May contain traces of nuts.

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #13
Good news is that in --vbr-new -q4..0 are identical. So defaulting everything to -q4 isn't likely to have a bad
impact. CBR /ABR is improved and VBR remains identical.

A local hack is setting lame variable;   SET LAMEOPT=-q4

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #14
I tried nightwish angels falls first sample with --abr 192

-q4 = 4/5 + 5/5 not hard
-q3 = 3/5, 5/5, not hard different to q4 needs 1 -2 secs pause
-q5 = 2/5
-q7 = 0/0

--abr 200 --lowpass 16

-q3 3/5 + 5/5 warble need 2 sec pause
-q4 4/5 + 5/5 less annoying than q3
-q5 5/5 , similar to q3 but a bit easier to abx possib less annoying
-q7 1/5

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #15
florida_seq sample

--abr 192

q3 5/5 mild warble
q4 5/5 more subtle
q5 4/5 good
q7 5/5 different artifact in right channel easiest to abx

--abr 192 --lowpass 16

q3 2/5
q7 4/5 improvement for sure

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #16
Haha, when I saw that you used sample from LAME's SourceForge I immediately knew what sample you are talking about.

I created a thread 3 years ago: https://hydrogenaud.io/index.php/topic,120193.0.html

To save you some time so you don't have to read through all of that,
there is nothing you can do about it. It is literally killer sample. It kills all formats.
gold plated toslink fan

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #17
Even this 'killer' and others are encoded to a not bad at all level for me using plain --abr 192 . -q7 adds
addtional artifact here and on florida-seq sample.

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #18
Haha, when I saw that you used sample from LAME's SourceForge I immediately knew what sample you are talking about.

I created a thread 3 years ago: https://hydrogenaud.io/index.php/topic,120193.0.html

To save you some time so you don't have to read through all of that,
there is nothing you can do about it. It is literally killer sample. It kills all formats.

Or just cheat by using V0 with "--allshort".

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #19
Yeah, I too am under the impression that Lame CBR seems to have regressed compared to older releases and also compared to the Helix MP3 encoder.

In CBR, Lame with default settings seems to create "holes" in the higher frequency bands, which to my ears seem create a metallic, chirpy sound. On occasion, I tried to create a discussion topic on that, but given that we don't listen with our eyes and that deriving audio quality claims from spectrogram-images is problematic at best, I felt like I didn't have enough evidence to warrant a discussion.
Hi @maikmerten @GammaBoost
I was reading this topic i have found very interesting
I have the same impression , may I ask you if you have this impression even 320 kb ?
and may I ask you which lame version do you think sound better in CBR (3.96.1)?
Would like to perform/make some tests between 320k between 3.96.1 vs LAME 3.100.1 with -q0
thanks

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #20
I have the same impression , may I ask you if you have this impression even 320 kb ?
[...]
Would like to perform/make some tests between 320k between 3.96.1 vs LAME 3.100.1 with -q0

I don't expect to be able to detect any difference at 320 kbit/s. That bitrate is just too high for my ears to reliably detect a difference.

Indeed, for "old Lame", I think 3.96.1 is a good version to look at.

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #21
 3.96.1 shows similar behaviour.  3.93.1 may be interesting as it had the last tunings for older 'gpsycho'
model as well has the alt-preset system. I think also, the -f in lame 3.96 ~ 3.100 cbr/abr may mimick the
behaviour of 3.93 and before.

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #22
Well im a little confused as --verbose shows 'psymodel 1' for lame 3.90,3.93 and 3.100.
I guess psymodel 2 = gpsycho and 1 = nspytune. Lame 3.90 -b 128 (on this sample) sounds better though.

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #23
Stick with v 3.97.  That is the last one to have ALL modes tuned inc CBR. There are listening tests that show
v3.97 has better in quality overall vs v3.90 incl cbr/abr for 128 k  .

Re: Lower algorithm quality in LAME produces better quality than anything above -q 3

Reply #24
@shadowking

What about ABR mode in 256 - 288k range? Is it still good to use -q7 or standard -q3?
Also, should we stick with 3.97 on high bitrate (256+) or is version 3.100 equally good?
lame --abr 288 -f --lowpass 17 (+ mp3gain@92 dB)