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: Is this a LAME or foobar2000 bug (Read 4485 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Is this a LAME or foobar2000 bug

So I am converting speeches from FLAC to LAME -V 8 setting.

When I play the file in foobar2000, it is reported as -V 5.

The same happens if I use -V 9

Is this a bug in LAME or foobar2000 ?

Is this a LAME or foobar2000 bug

Reply #1
Encode a file in console and you'll see:

Quote
LAME 3.99.5 32bits (http://lame.sf.net)
CPU features: MMX (ASM used), SSE (ASM used), SSE2
Resampling:  input 44.1 kHz  output 24 kHz
polyphase lowpass filter disabled
Encoding test.wav to test.mp3
Encoding as 24 kHz j-stereo MPEG-2 Layer III VBR(q=5.2)
    Frame          |  CPU time/estim | REAL time/estim | play/CPU |    ETA
  7069/7069  (100%)|    0:03/    0:03|    0:03/    0:03|  43.280x|    0:00

So yes, LAME 3.99 changes the value of VBR Quality.

Here's the code in lame.c that does it:

Code: [Select]
    /* WORK IN PROGRESS */
    /* mapping VBR scale to internal VBR quality settings */
    if (gfp->samplerate_out == 0 && (gfp->VBR == vbr_mt || gfp->VBR == vbr_mtrh)) {
        float const qval = gfp->VBR_q + gfp->VBR_q_frac;
        struct q_map { int sr_a; float qa, qb, ta, tb; int lp; };
        struct q_map const m[9]
        = { {48000, 0.0,6.5,  0.0,6.5, 23700}
          , {44100, 0.0,6.5,  0.0,6.5, 21780}
          , {32000, 6.5,8.0,  5.2,6.5, 15800}
          , {24000, 8.0,8.5,  5.2,6.0, 11850}
          , {22050, 8.5,9.01, 5.2,6.5, 10892}
          , {16000, 9.01,9.4, 4.9,6.5,  7903}
          , {12000, 9.4,9.6,  4.5,6.0,  5928}
          , {11025, 9.6,9.9,  5.1,6.5,  5446}
          , { 8000, 9.9,10.,  4.9,6.5,  3952}
        };
        for (i = 2; i < 9; ++i) {
            if (gfp->samplerate_in == m[i].sr_a) {
                if (qval < m[i].qa) {
                    double d = qval / m[i].qa;
                    d = d * m[i].ta;
                    gfp->VBR_q = (int)d;
                    gfp->VBR_q_frac = d - gfp->VBR_q;
                }
            }
            if (gfp->samplerate_in >= m[i].sr_a) {
                if (m[i].qa <= qval && qval < m[i].qb) {
                    float const q_ = m[i].qb-m[i].qa;
                    float const t_ = m[i].tb-m[i].ta;
                    double d = m[i].ta + t_ * (qval-m[i].qa) / q_;
                    gfp->VBR_q = (int)d;
                    gfp->VBR_q_frac = d - gfp->VBR_q;
                    gfp->samplerate_out = m[i].sr_a;
                    if (gfp->lowpassfreq == 0) {
                        gfp->lowpassfreq = -1;
                    }
                    break;
                }
            }
        }
    }

Is this a LAME or foobar2000 bug

Reply #2
Ok, now makes sense: V7 to V9 are labels that are mapped to other settings.

Is this a LAME or foobar2000 bug

Reply #3
O_o'


A) Foobar2000 is reporting settings Guessing out of some values stored in a tag called Lame Tag (or the LAME portion in the Xing tag).
Examples:
LAME 3.97, Foobar shows MP3 VBR V5. Tag contains (in hex):
    04 A0 00 00 00 00 2E 33 00 00 14 20 24 05 1C 4D 00 01 C2 00 2B BE E5 B6 FE F4 EA
LAME 3.99r, Foobar shows MP3 VBR V2. Tagging contains (in hex):
    04 B9 00 00 00 00 2E 12 00 00 35 20 24 03 60 4D 00 01 E0 00 6D 95 2B 04 F2 5B B2
LAME 3.100l (halb version), Foobar shows MP3 VBR V0. Tagging contains (in hex):
    04 AF 00 00 00 00 2C 16 00 00 35 20 24 05 40 4D 00 01 F4 00 06 95 1A B9 84 98 28

B) What LAME reports as "q" next to the VBR text, is not the value of the VBR. It is the value of the quality factor being used. (The "-q" setting).


You might think that foobar2000 is lying to you, but that's because you don't have all the information about what you are being told. Those are not the parameters used. Those are the quality estimates.

And also, the V settings are not "labels mapped to other parameters".  The V settings control other parameters. There's an important difference.

Is this a LAME or foobar2000 bug

Reply #4
B) What LAME reports as "q" next to the VBR text, is not the value of the VBR. It is the value of the quality factor being used. (The "-q" setting).

Actually, no. Here what LAME prints for -V8 -q3 settings:

3.97:
Quote
Encoding as 32 kHz VBR(q=8) j-stereo MPEG-1 Layer III (ca. 15x) qval=3

3.98.4:
Quote
Encoding as 32 kHz j-stereo MPEG-1 Layer III VBR(q=8)

3.99.5:
Quote
Encoding as 24 kHz j-stereo MPEG-2 Layer III VBR(q=5.2)

 

Is this a LAME or foobar2000 bug

Reply #5
Mmm.. You are right on that.  (I knew that one of the two parameters wasn't shown any longer in the console, but I was incorrect in which one it was).

Also, from your lines, it seems a bit clearer what happens now. Previously, it was keeping the same MPEG version ( 32, 44, 48 mpeg1, 16,22,24, mpeg2), whereas now, it goes lower in samplerate, and so it compensates for this change (i.e. so that you don't get the same result starting from a 44Khz than with a 22KHz file).
I wasn't aware of this change.