LAME -q switch: Difference between revisions
(clarify) |
m (→External links: updated link to current documentation) |
||
(8 intermediate revisions by 4 users not shown) | |||
Line 9: | Line 9: | ||
===VBR=== | ===VBR=== | ||
VBR encoding modes take some different code paths and ignore some of the listed values. In particular, the ten values of -q are mapped to just 3 values under VBR: | VBR encoding modes take some different code paths and ignore some of the listed values. In particular, the ten values of -q are mapped to just 3 values under VBR as of 3.98 and later: | ||
* -q7 to -q9 are mapped to -q7. This level uses a psymodel but does not calculate quantisation noise when encoding: it takes a quick guess. | * -q7 to -q9 are mapped to -q7. This level uses a psymodel but does not calculate quantisation noise when encoding: it takes a quick guess. | ||
* -q5 and -q6 include all features of -q7, calculate and consider actual quantisation noise, and additionally enable subblock gain. | * -q5 and -q6 include all features of -q7, calculate and consider actual quantisation noise, and additionally enable subblock gain. | ||
Line 15: | Line 15: | ||
==Effects== | ==Effects== | ||
This table documents the parameters that are affected by the value assigned to -q. These are most relevant to CBR for the reasons noted above. | This table documents the parameters that are affected by the value assigned to -q. '''These are most relevant to CBR''' for the reasons noted above. | ||
{| border=1 class="wikitable" style="text-align:center" | {| border=1 class="wikitable" style="text-align:center" | ||
! -q n !! Huffman coding search !! Use full outer loop for Huffman encoding !! sv_qnt.substep_shaping !! Subblock gain !! Noise-shaping !! Amplification !! Stopping !! Description | ! -q n !! Huffman coding search !! Use full outer loop for Huffman encoding !! sv_qnt.substep_shaping !! Subblock gain !! Noise-shaping !! Amplification !! Stopping !! Description | ||
|- | |- | ||
| 0 || Best || Yes || 2 || 1 || Yes || 2 || 1 || align="left" | Use all the | | 0 || Best || Yes || 2 || 1 || Yes || 2 || 1 || align="left" | Use all the slowest parameters/algorithms that are available. | ||
|- | |- | ||
| 1 || Best || No || 2 || 1 || Yes || 2 || 1 || | | 1 || Best || No || 2 || 1 || Yes || 2 || 1 || | ||
Line 27: | Line 27: | ||
| 3 || Best || No || ? || 1 || Yes || 1 || 1 || align="left" | Default value. Good speed, good quality. Lower values of -q may not produce significantly higher quality. | | 3 || Best || No || ? || 1 || Yes || 1 || 1 || align="left" | Default value. Good speed, good quality. Lower values of -q may not produce significantly higher quality. | ||
|- | |- | ||
| 4 || Best || No || ? || 1 || Yes || 0 || 0 || | | 4 || Best || No || ? || 1 || Yes || 0 || 0 || align="left" | Optimal speed/quality. Usually produce less distortion at high frequencies than all other values of -q, except 5-6. | ||
|- | |- | ||
| 5-6 || Normal || No || ? || 1 || Yes || 0 || 0 || | | 5-6 || Normal || No || ? || 1 || Yes || 0 || 0 || align="left" | Almost the same as -q4. | ||
|- | |- | ||
| 7-8 || Normal || No || ? || -1 || No || 0 || 0 || align="left" | Same as -f. Very fast, OK quality. Psychoacoustics are used for pre-echo and mid/side stereo, but no noise-shaping is done. | | 7-8 || Normal || No || ? || -1 || No || 0 || 0 || align="left" | Same as -f. Very fast, OK quality. Psychoacoustics are used for pre-echo and mid/side stereo, but no noise-shaping is done. | ||
|- | |- | ||
| 9 || Normal || No || ? || -1 || No || 0 || 0 || align="left" | Disables almost all algorithms including psy-model. | | 9 || Normal || No || ? || -1 || No || 0 || 0 || align="left" | Disables almost all algorithms including psy-model. Extremely fast. OK quality. | ||
|} | |} | ||
==External links== | |||
* [https://svn.code.sf.net/p/lame/svn/trunk/lame/doc/html/detailed.html#q Current documentation] | |||
* [http://www.hydrogenaud.io/forums/index.php?showtopic=101132 Research & discussion that led to this summary] (2013) | |||
* [http://www.hydrogenaud.io/forums/index.php?showtopic=107424 More discussion mainly re: ABR] (2014) |
Latest revision as of 16:18, 5 April 2024
When using LAME from the command line, the switch -q (quality) can be added in either VBR or CBR mode to alter various parameters used when encoding, which are predicted (at least in theory) to affect the quality of the output MP3 stream.
Equivalences
CBR
Some values of -q seem to produce equivalent files, at least in terms of the audio itself.
- -q5 and -q6 output identical results. LAME's header will indicate the different quality parameter, but the files, including the actual audio, are otherwise a perfect match.
- -q8 is always mapped to -q7 and thus outputs identical files, including the header.
- -q9 outputs the same file as -q7 and -q8, although the official documentation describes it as a different quality. The LAME header will be different for CBR/ABR and identical for VBR.
VBR
VBR encoding modes take some different code paths and ignore some of the listed values. In particular, the ten values of -q are mapped to just 3 values under VBR as of 3.98 and later:
- -q7 to -q9 are mapped to -q7. This level uses a psymodel but does not calculate quantisation noise when encoding: it takes a quick guess.
- -q5 and -q6 include all features of -q7, calculate and consider actual quantisation noise, and additionally enable subblock gain.
- -q0 to -q4 include all features of higher numbers and additionally use the best search when applying Huffman coding.
Effects
This table documents the parameters that are affected by the value assigned to -q. These are most relevant to CBR for the reasons noted above.
-q n | Huffman coding search | Use full outer loop for Huffman encoding | sv_qnt.substep_shaping | Subblock gain | Noise-shaping | Amplification | Stopping | Description |
---|---|---|---|---|---|---|---|---|
0 | Best | Yes | 2 | 1 | Yes | 2 | 1 | Use all the slowest parameters/algorithms that are available. |
1 | Best | No | 2 | 1 | Yes | 2 | 1 | |
2 | Best | No | 2 | 1 | Yes | 1 | 1 | Same as -h. Higher quality than the default -q3. -q2 was the default in older versions of LAME. |
3 | Best | No | ? | 1 | Yes | 1 | 1 | Default value. Good speed, good quality. Lower values of -q may not produce significantly higher quality. |
4 | Best | No | ? | 1 | Yes | 0 | 0 | Optimal speed/quality. Usually produce less distortion at high frequencies than all other values of -q, except 5-6. |
5-6 | Normal | No | ? | 1 | Yes | 0 | 0 | Almost the same as -q4. |
7-8 | Normal | No | ? | -1 | No | 0 | 0 | Same as -f. Very fast, OK quality. Psychoacoustics are used for pre-echo and mid/side stereo, but no noise-shaping is done. |
9 | Normal | No | ? | -1 | No | 0 | 0 | Disables almost all algorithms including psy-model. Extremely fast. OK quality. |