Difference between revisions of "LAME"

From Hydrogenaudio Knowledgebase
Jump to: navigation, search
(Recommended encoder settings)
(Portable: listening in noisy conditions, lower bitrate, smaller file size)
 
(114 intermediate revisions by 30 users not shown)
Line 1: Line 1:
 +
{{featured}}
 
{{Software Infobox
 
{{Software Infobox
 
| name = LAME
 
| name = LAME
| screenshot = [[Image:Lamelogo.png|250px|LAME official logo]]
+
| logo = [[Image:Lamelogo.png|250px|LAME official logo]]
 +
| screenshot =
 
| caption = LAME ain't an MP3 encoder
 
| caption = LAME ain't an MP3 encoder
 
| maintainer = The LAME project
 
| maintainer = The LAME project
| stable_release = 3.97
+
| stable_release = 3.100
 
| preview_release = none
 
| preview_release = none
| operating_system = All
+
| operating_system = Windows, Mac OS/X, Linux/BSD
| use = Audio encoder/decoder
+
| use = Encoder/Decoder
 
| license = LGPL
 
| license = LGPL
| website = [http://lame.sourceforge.net/ LAME website]
+
| website = [http://lame.sourceforge.net/ LAME website], Download site: [http://www.rarewares.org/mp3-lame-bundle.php Rarewares LAME-bundle]
}}{{featured}}
+
}}
'''LAME''' (Lame Ain't an MP3 Encoder) is the [[Hydrogenaudio]] recommended [[MP3]] encoder. It has been developed by the open-source community since 1998, and has become the highest quality [[MP3]] encoder for most purposes.
+
'''LAME''' (Lame Ain't an MP3 Encoder) is the [[Hydrogenaudio]] recommended [[MP3]] encoder. It has been developed by the open-source community since 1998, and has become the highest quality MP3 encoder for most purposes.
  
Some benefits for using LAME:
+
Some benefits of using LAME:
 
* Highly optimised presets
 
* Highly optimised presets
 
* Fast encoding
 
* Fast encoding
* [[CBR]], [[ABR]] and [[VBR]] encoding methods
+
* [[CBR]], [[ABR]] and quality-optimized [[VBR]] encoding methods
 
* [[Gapless]] playback with LAME-header compliant decoders
 
* [[Gapless]] playback with LAME-header compliant decoders
* [[Exact Audio Copy]] and [[CDex]] support
+
* Supported by recommended CD rippers [[Exact Audio Copy]] and [[CDex]]
 +
* Highly tunable
  
 +
<!--extra whitespace here to provide a margin for the Table of Contents-->
  
 
==History==
 
==History==
LAME development began around mid-1998. Mike Cheng started it as a patch against the 8hz-MP3 encoder sources. After some quality concerns raised by others, he decided to start from scratch based on the dist10 sources. That branch (a patch against the reference sources) became LAME 2.0, and only on LAME 3.81 they got rid of all dist10 code, making LAME a completely new program-not a mere patch of an existing encoder.
+
LAME development began around mid-1998. Mike Cheng started it as a patch against the 8hz-MP3 encoder sources. After some quality concerns raised by others, he decided to start from scratch based on the dist10 sources.<ref>dist10 is the rudimentary "demonstration" MP3 encoder described in the MPEG-2 standard, ISO/IEC 13818.</ref> That branch (a patch against the reference sources) became LAME 2.0. By the release of LAME 3.81, all dist10 code was removed, making LAME a completely new program, not a mere patch of an existing encoder.
  
 
The project quickly became a team effort. Mike Cheng eventually left leadership and started working on [http://toolame.sourceforge.net/ tooLAME], an [[MP2]] encoder. Mark Taylor became leader and released version 3.0 featuring gpsycho, a new psychoacoustic model developed by him.
 
The project quickly became a team effort. Mike Cheng eventually left leadership and started working on [http://toolame.sourceforge.net/ tooLAME], an [[MP2]] encoder. Mark Taylor became leader and released version 3.0 featuring gpsycho, a new psychoacoustic model developed by him.
  
Nowadays LAME is considered the best MP3 encoder at mid-high bitrates and features the best VBR model among MP3 implementations, mostly thanks to the dedicated work of talented developers like Takehiro Tominaga, Naoki Shibata, Darin Morrison, Gabriel Bouvigne, Robert Hegemann, etc. And development is still going on...
+
Nowadays LAME is considered the best MP3 encoder at mid & high bitrates, and features the best VBR model among MP3 implementations, mostly thanks to the dedicated work of talented developers Takehiro Tominaga, Naoki Shibata, Darin Morrison, Gabriel Bouvigne, Robert Hegemann, and others. Development is ongoing.
  
 +
Although LAME is generally considered to be an encoder, according to the LAME technical FAQ, it's technically not an encoder, but rather is officially just "a development project which uses the open source model to improve MP3 technology." This improved technology is only released in source code form in order to minimize the risk of violating patents. When the source code is compiled and distributed, it ''may'' require a license from Thomson, depending on where and how it's to be used. The LAME project's position is "Source code is considered as speech, which may contain descriptions of patented technology. Descriptions of patents are in the public domain."
 +
 +
LAME source code is maintained in a CVS repository, and the only official codebase for public use is the trunk code tagged "MAIN". There are also numerous experimental branches of this code in which the developers test new ideas. One of these branches was started after the release of LAME 3.92 in 2002. To keep it from being confused with LAME 3.93 alpha versions, the code was made to self-identify as LAME 4.0 alpha 1 (in late 2002) through 4.0 alpha 14 (since 2005). This code is mainly for the developers to test optimizations and architectural changes in LAME's foundational code, ideas that may eventually be used in the main branch if and when development actually begins on LAME 4.0. However, some members of the public used this code to build working copies of "LAME 4.0" alpha versions in 2003-2005. These should not be considered actual LAME 4.0 releases and the developers do not want public feedback on them, nor do they want any more public builds to be made from this branch.
  
 
==Recommended encoder compiles and source code==
 
==Recommended encoder compiles and source code==
This list will be kept up to date with the current LAME compiles that are recommended for optimal quality and will keep track of any development compiles released on [[Hydrogenaudio]].
 
  
It is suggested that the compiles available here be used with the [[#Recommended encoder settings|recommended encoder settings]].
+
Unless noted otherwise, the recommended LAME compile for optimal quality is always the '''latest stable version'''.
 
+
 
+
<center>'''The currently recommended LAME version is'''</center>
+
{| class="wikitable" style="margin: 1em auto 1em auto;text-align:center;color:red;"
+
|-
+
! 3.97
+
|}
+
  
 +
'''Download the latest LAME from these links:'''
 +
* [http://www.rarewares.org/mp3.php RareWares MP3 Page] - Compiles for Win32, Mac OS X universal binary, Linux etc.
 +
* [http://sourceforge.net/project/showfiles.php?group_id=290&package_id=309 LAME source code on SourceForge]
  
*[http://rarewares.org/dancer/dancer.php?f=1 Download] (317 KB - Win32 compile including lame_enc.dll)
+
Avoid using alpha versions of LAME. These versions have "a" in their version string and are usually only for testing changes and new features, and may result in lower quality MP3s. Use them only if you want to help the developers and provide feedback.
<!--*[http://rarewares.org/dancer/dancer.php?f=103 Download] (342 KB - LameDropXPd: easy to use drag'n'drop LAME frontend for Windows)
+
*[http://www.rarewares.org/files/mp3/lame-3.97b-Linux86.tar.gz Download] (131 KB - Linux x86 static compile)
+
*[http://www.rarewares.org/files/mp3/lame-3.97b1-MacOSX.tar.gz Download] (192 KB - MacOS X compile)
+
*[http://www.rarewares.org/mp3.html Download] (Compiles for other operating systems: Solaris, BSD, HP-UX etc.)-->
+
*[http://prdownloads.sourceforge.net/lame/lame-3.97.tar.gz?download Download] (1.3 MB - Lame source code from Lame project page)
+
  
 
==Recommended encoder settings==
 
==Recommended encoder settings==
This section describes the [[Hydrogenaudio]] recommended settings to be used with [[LAME]] for highest quality [[MP3]] encoding.
+
This section describes the [[Hydrogenaudio]] recommended settings to be used with LAME for highest quality MP3 encoding. These settings require LAME 3.98 or later (the latest stable version is recommended).
  
These settings require LAME 3.94 or later. LAME 3.97 is the recommended version.
+
<div style="background-color: #F0F0F0; color: black; border: 1px solid black; margin: 1em; padding: 1em 2em 1em 2em;">
 +
====Maximum quality and archiving====
  
Avoid using alpha (a) versions of LAME. More often than not those are exclusively for testing purposes. Use them only if you want to help developers with feedback.
+
Maximum quality is achieved when, regardless of listening conditions, you are unable to detect a difference between the MP3 and the original. As demonstrated by blind [[ABX]] tests, LAME-encoded MP3s typically achieve this level of [[transparency]] when encoded with the default settings, at bitrates well below maximum. Encoding with higher-bitrate settings will have no effect on the perceived quality.
  
'''Note #1:''' the rule of thumb when considering encoding options: at a given bitrate, [[VBR]] is higher quality than [[ABR]], which is higher quality than [[CBR]] ([[VBR]] > [[ABR]] > [[CBR]] in terms of quality). The exception to this is when you choose the highest possible [[CBR]] bitrate, which is 320 kbps (-b 320 = --alt-preset insane), but this produces very large filesizes for very little audible benefit.
+
For archiving, only [[lossless]] formats like [[WavPack]], [[FLAC]], etc. are ideal; they will preserve the audio with no changes, sample-for-sample, regardless of encoder settings. In contrast, lossy formats like MP3 are designed to save space by changing the audio in subtle, often imperceptible ways, even at the encoder's maximum settings.
  
'''Note #2:''' all modes and settings mentioned in this topic belong to the specifications of the [[MP3]] standard, and the resulting MP3s should be playable by every [[MP3]] decoder that conforms with the standard. If your decoder or device does not play MP3s produced by LAME, blame the manufacturer or developer, and not LAME.
+
====[VBR] Very high quality: <font style="color:red">HiFi, home, or quiet listening, with best file size</font>====
  
===VBR (variable bitrate) settings===
+
<code><font style="color:green">-V 0</font></code> (~245 kbps), <code><font style="color:green">-V 1</font></code> (~225 kbps), <code><font style="color:green">-V 2</font></code> (~190 kbps) or <code><font style="color:green">-V 3</font></code> (~175 kbps) are recommended.
'''[[VBR]]:''' ''variable bitrate mode. Use variable bitrate modes when the goal is to achieve a fixed level of quality using the lowest possible bitrate.''
+
  
[[VBR]] is best used to target a specific quality level, instead of a specific bitrate. The final file size of a [[VBR]] encode is less predictable than with [[ABR]], but the quality is usually better.
+
These [[VBR]] settings will normally produce [[transparency|transparent]] results. Audible differences between these presets may exist, but are rare.
  
'''Usage:''' <code>-V(number)</code> where number is 0-9, 0 being highest quality, 9 being the lowest.
+
====[CBR] Very high quality: <font style="color:red">HiFi, home, or quiet listening, with maximum file size</font>====
  
'''Example:''' <code>-V2</code>
+
<code><font style="color:red">-b 320</font></code> is an alternative to the VBR settings above.
  
 +
This [[CBR]] mode will maximize the MP3's bitrate and overall file size. The extra space may allow for some parts of the audio to be compressed with fewer sacrifices, but to date, no one has produced ABX test results demonstrating that perceived quality is ever better than the highest VBR profiles described above.<ref>Prior to version 3.99, CBR and VBR modes were encoded differently by LAME. In some unusual problem samples, these differences were sometimes audible, even at very high bitrates. Current versions of LAME encode CBR and VBR with the same psychoacoustic model, so such differences shouldn't arise from normal use.</ref>
  
{| class="wikitable" style="margin: 1em auto 1em auto;"
+
====Portable: <font style="color:purple">listening in noisy conditions, lower bitrate, smaller file size</font>====
|+'''List of recommended settings'''
+
| '''Switch''' || '''Preset''' || '''Target Kbit/s''' || '''Bitrate range kbit/s'''
+
|- style="background:white;"
+
| -b 320 || --preset insane || 320 || 320 CBR
+
|-
+
| -V 0 --vbr-new || --preset fast extreme ||  245 || 220...260
+
|- style="background:white;"
+
| -V 0 || --preset extreme || 245 || 220...260
+
|-
+
| -V 1 --vbr-new ||&nbsp;|| 225 || 200...250
+
|- style="background:white;"
+
| -V 1 ||&nbsp;|| 225 || 200...250
+
|-
+
| -V 2 --vbr-new || --preset fast standard || 190 || 170...210
+
|- style="background:white;"
+
| -V 2 || --preset standard || 190 || 170...210
+
|-
+
| -V 3 --vbr-new ||&nbsp;|| 175 || 155...195
+
|- style="background:white;"
+
| -V 3 ||&nbsp;|| 175 || 155...195
+
|-
+
| -V 4 --vbr-new || --preset fast medium || 165 || 145...185
+
|- style="background:white;"
+
| -V 4 || --preset medium  || 165 || 145...185
+
|-
+
| -V 5 --vbr-new ||&nbsp;|| 130 || 110...150
+
|- style="background:white;"
+
| -V 5 ||&nbsp;|| 130 || 110...150
+
|-
+
| -V 6 --vbr-new ||&nbsp;|| 115 || 95...135
+
|- style="background:white;"
+
| -V 6 ||&nbsp;|| 115 || 95...135
+
|-
+
| -V 7 --vbr-new ||&nbsp;|| 100 || 80...120
+
|- style="background:white;"
+
| -V 7 ||&nbsp;|| 100 || 80...120
+
|-
+
| -V 8 --vbr-new ||&nbsp;|| 85 || 65...105
+
|- style="background:white;"
+
| -V 8 ||&nbsp;|| 85 || 65...105
+
|-
+
| -V 9 --vbr-new ||&nbsp;|| 65 || 45...85
+
|- style="background:white;"
+
| -V 9 ||&nbsp;|| 65 || 45...85
+
|}
+
See also [[#Technical information|Technical details for recommended LAME settings]].
+
  
If you need a predictable bitrate (in a streaming application, for example), use [[ABR]] or [[CBR]] modes, described below.
+
<code><font style="color:purple">-V 4</font></code> (~165 kbps), <code><font style="color:purple">-V 5</font></code> (~130 kbps) or <code><font style="color:purple">-V 6</font></code> (~115 kbps) are recommended.
  
===ABR (average bitrate) settings===
+
<code><font style="color:purple">-V 6</font></code> produces an "acceptable" quality, while <code><font style="color:purple">-V 4</font></code> should be close to perceptual [[transparency]].
'''[[ABR]]:''' ''average bitrate mode. A compromise between [[VBR]] and [[CBR]] modes, [[ABR]] encoding varies bits around a specified target bitrate.''
+
  
Use [[ABR]] when you need to know the final size of the file but still want to allow the encoder some flexibility to decide which passages need more bits.
+
====Very low bitrate, small sizes: <font style="color:blue">eg. for voice, radio, [[mono]] encoding etc.</font>====
  
'''Usage:''' <code>--preset <bitrate></code> where <bitrate> (desired averaged bitrate in kbit/s) can be any value between 8 - 320 , like eg. 9, 17, 80, 128, 133, 200 etc.
+
For very low bitrates, up to 100kbps, [[ABR]] is most often the best solution.
 +
Use <code><font style="color:blue">--abr <bitrate></font></code> (e.g. --abr 80).
  
'''Example:''' <code>--preset 200</code>
+
'''--preset voice''' is only available in the command line front-end, and is there for compatibility.
 +
It is currently mapped to '''''--abr 56 -mm''''', so that means that the recommendation would be to encode in mono, and use ABR.
 +
</div>
  
'''Important:''' ''[[ABR]] setting is tuned from 320 kbit/s down to 80 kbit/s.''
+
==Understanding the bitrate settings==
 +
MP3s are divided into frames, each frame being a particular size, expressed as a [[bitrate]]. If the bitrate of every frame is the same throughout the file, then the file is considered to be ''constant bit rate'' ([[CBR]]). Otherwise, it is ''variable bit rate'' ([[VBR]]). LAME offers CBR and VBR encoding modes, as well as a special VBR encoding mode called [[ABR]] (''average bit rate'').
  
===CBR (constant bitrate) settings===
+
===VBR (variable bitrate) settings===
'''[[CBR]]:''' ''constant bitrate mode. [[CBR]] encoding is not efficient. Whereas [[VBR]] and [[ABR]] modes can supply more bits to complex music passages and save bits on simpler ones, [[CBR]] encodes every frame at the same bitrate.''
+
'''[[VBR]]:''' ''variable bitrate mode. Use variable bitrate modes when the goal is to achieve a fixed level of quality using the lowest possible bitrate.''
  
[[CBR]] is only recommended for usage in streaming situations where the upper bitrate must be strictly enforced.
+
VBR is best used to target a specific quality level, instead of a specific bitrate. The final file size of a VBR encode is less predictable than with [[ABR]], but the quality is usually better.
  
'''Usage:''' <code>-b <bitrate></code> where <bitrate> (bitrate in kbit/s) must be chosen from the following values: 8, 16, 24, 32, 40, 48, 64, 80, 96, 112, 128, 160, 192, 224, 256, or 320.
+
Unlike other MP3 encoders which do VBR encoding based on predictions of output quality, LAME's default VBR method tests the ''actual'' output quality to ensure the desired quality level is always achieved.
  
'''Example:''' <code>-b 192</code>
+
'''Usage:''' {{code|-V &lt;number>}} where &lt;number> is between 0 and 9, 0 being highest quality, 9 being the lowest. (Note: The "V" has to be a capital letter.)
  
'''Important:''' ''[[CBR]] setting is tuned from 320 kbit/s down to 80 kbit/s.''
+
'''Example:''' {{code|-V 2}}
  
===Remarks===
+
Fractional values out to three decimal places are also accepted, with 9.999 being the absolute lowest quality.
The <code>--vbr-new</code> switch enables the new [[VBR]] mode.  Lame will encode much faster than the old/default [[VBR]] mode.  In terms of quality, <code>--vbr-new</code> appears to be better than the old model, but reports of artifacts when using the new model do exist. Despite these possible issues, <code>--vbr-new</code> is currently recommended over the default [[VBR]] mode due to both the speed and quality increases afforded by the new algorithm.
+
  
===Quick start===
+
'''Example:''' {{code|-V 2.75}}
'''Best quality: <font style="color:red">'archiving'</font>'''
+
  
<code><font style="color:red">-b 320</font></code>. This is the strongest setting for [[MP3]], with the lowest risk of [[artifact]]s.
+
'''Note:''' The switch {{code|--vbr-new}}, which enabled a superior VBR mode in LAME 3.97 and some previous versions, is no longer needed with LAME 3.98 and higher, as it is now the default VBR mode. However, if you're still using LAME 3.97 or older, you have to add {{code|--vbr-new}} to your command line to use that mode.
With the exception of a few situations, quality is rarely better than the highest [[VBR]] profiles described below. However, 'archiving' music using a lossy format like [[MP3]] is never recommended &ndash; no matter how transparent the resulting files might be.
+
The alternative is to use [[Lossless]] formats like [[WavPack]], [[FLAC]] etc. that allow true archiving bit for bit like on original CD.
+
  
'''High quality: <font style="color:green">HiFi, home or quiet listening</font>'''
+
The target bitrate and actual typical bitrate for each VBR quality level is shown in the [[#Technical information|Technical details for recommended LAME settings]] section below.
  
<code><font style="color:green">-V3 --vbr-new</font></code> (~175 kbps), <code><font style="color:green">-V2 --vbr-new</font></code> (~190 kbps), <code><font style="color:green">-V1 --vbr-new</font></code> (~210 kbps) or <code><font style="color:green">-V0 --vbr-new</font></code> (~230 kbps) are recommended.
+
If you need a predictable bitrate (in a streaming application, for example), use ABR or CBR modes, described below.
These settings will produce [[transparent]] encoding (transparent = most people cannot distinguish the [[MP3]] from the original in an [[ABX]] blind test).
+
Audible differences between these presets exist, but are extremely rare.
+
  
'''Portable: <font style="color:purple">background noise and low bitrate requirement, small sizes</font>'''
+
===ABR (average bitrate) settings===
 +
'''[[ABR]]:''' ''average bitrate mode. A compromise between VBR and CBR modes, ABR encoding varies bits around a specified target bitrate.''
  
<code><font style="color:purple">-V6 --vbr-new</font></code> (~115 kbps), <code><font style="color:purple">-V5 --vbr-new</font></code> (~130 kbps) or <code><font style="color:purple">-V4 --vbr-new</font></code> (~160 kbps) are recommended for this use.
+
Use ABR when you need to know the final size of the file but still want to allow the encoder some flexibility to decide which passages need more bits. The output is an ordinary VBR file compatible with all MP3 players that support VBR; ABR is not a special type of file, just a LAME-specific strategy for producing VBR.
<code><font style="color:purple">-V6 --vbr-new</font></code> produces an acceptable quality, while <code><font style="color:purple">-V4--vbr-new</font></code> should be close to perceptual [[transparency]].
+
  
'''Very low bitrate, small sizes: <font style="color:blue">eg. for voice, radio, [[mono]] encoding etc.</font>'''
+
'''Usage:''' {{code|--preset <bitrate>}} where &lt;bitrate> (desired averaged bitrate in kbit/s) is a value between 8 and 320.
  
For very low bitrates, up to 100kbps, [[ABR]] is most often the best solution.
+
'''Example:''' {{code|--preset 200}}
Use <code><font style="color:blue">--abr <bitrate></font></code> (e.g. --abr 80).
+
  
 +
'''Important:''' ''ABR setting is tuned from 320 kbit/s down to 80 kbit/s.''
  
[[Image:lame-chart-2.png|frame|center|Here a trial to get a view, how the <font style="color:red">perceived listening quality</font> improves with settings/<font style="color:blue">averaged filesize</font>]]
+
===CBR (constant bitrate) settings===
 +
'''[[CBR]]:''' ''constant bitrate mode. CBR encoding is not efficient. Whereas VBR and ABR modes can supply more bits to complex music passages and save bits on simpler ones, CBR encodes every frame at the same bitrate.''
  
 +
CBR is only recommended for usage in streaming situations where the upper bitrate must be strictly enforced. There is still some variability in bitrate behind the scenes, through LAME's use of the [[bit reservoir]] feature of the MP3 format, but it is much less flexible than actual VBR.
  
'''Hey! What happened to "--alt-preset"?'''
+
'''Usage:''' {{code|-b <bitrate>}} where <bitrate> (bitrate in kbit/s) must be chosen from the following values: 8, 16, 24, 32, 40, 48, 64, 80, 96, 112, 128, 160, 192, 224, 256, or 320.
  
The revolutionary <code>--alt-preset</code> system was introduced in LAME 3.90; it was replaced by the <code>--preset</code> flags in later versions. Starting with version 3.94, the <code>-Vx</code> quality system was introduced, which allows finer control over the desired bitrate; the <code>--preset</code> switches were made into aliases to the corresponding <code>-V</code> flags for the sake of backwards compatibility. '''There is no difference between the output you get if you use <code>-V2</code> or <code>--alt-preset standard</code>.''' (Although adding <code>--vbr-new</code> is recommended for now, see above for details.)
+
'''Example:''' {{code|-b 192}}
  
More encoding options are available under the new system, such as <code>-V1</code>, which provides a level of quality between the old "standard" and "extreme" presets, or <code>-V3</code>, which is between the old "medium" and "standard" presets.
+
'''Important:''' ''CBR setting is tuned from 320 kbit/s down to 80 kbit/s.''
  
LAME 3.97 features more streamlined command line options, and it's recommended to stick to one of the values described in the text or shown in the tables above. <font style="color:blue">You don't need to worry</font> anymore about quality, settings, arcane combinations of switches, or presets.
+
===Remarks===
 +
* The rule of thumb when considering encoding options: at a given bitrate, [[VBR]] is higher quality than [[ABR]], which is higher quality than [[CBR]] (VBR > ABR > CBR in terms of quality). However, [[ABX]] tests demonstrate that as bitrate increases, the perceptual differences diminish, with all modes generally reaching [[transparency]] well before their maximum settings; when you can't tell the difference, the modes are qualitatively the same.
  
For example, the following command lines will all produce the same output:
+
* In terms of filesize [[VBR]] tends to produce the smallest files down to -V7. For lower quality (e.g. for non-music audio such as speech) [[ABR]] will produce smaller files than [[VBR]], starting from --abr 115.
  
<code>--alt-preset insane</code> = <code>--preset insane</code> = <code>-b 320</code> = <code>--preset 320</code> = <code>--preset cbr 320</code>
+
* All modes and settings mentioned in this topic belong to the specifications of the MP3 standard, and the resulting MP3s should be playable by every MP3 decoder that conforms with the standard. If your decoder or device does not play MP3s produced by LAME, blame the manufacturer or developer, not LAME.
  
(<code>--preset cbr 320</code> is the exact same thing as <code>--alt-preset insane</code>, etc.)
+
* Prior to LAME 3.98, the {{code|--vbr-new}} switch enabled the new VBR mode. This is now the default VBR mode, with the old mode being available via {{code|--vbr-old}}. In terms of quality, the new mode appears to be better than the old, but reports of artifacts when using the new mode do exist. Despite these possible issues, the new mode is currently recommended due to both the speed and quality increases afforded by the new algorithm.
  
 
==Technical information==
 
==Technical information==
The table below contains technical details about the recommended settings.
+
===Recommended settings details===
 
+
  
 
{| class="wikitable" style="margin: 1em auto 1em auto;"
 
{| class="wikitable" style="margin: 1em auto 1em auto;"
|+'''Technical details of the recommended settings'''
+
|+ Technical details of the recommended settings
| '''Switch''' || '''Preset''' || '''Target Kbps''' || '''Y Switch''' || '''-b''' || '''Lowpass''' || '''Resample'''
+
! style="vertical-align: bottom" | Switch !! style="vertical-align: bottom" | Preset !! style="width: 4em; vertical-align: bottom" | Target Kbps !! style="width: 4em; vertical-align: bottom" | Typical Kbps<ref>Typical bitrates are mostly based on the results of testing with LAME 3.98.2.</ref> !! style="width: 6em; vertical-align: bottom" | [[LAME Y switch|Y Switch]] enabled by default !! style="vertical-align: bottom" | Lowpass<ref>This range is the transition band of the lowpass filter, as of LAME 3.99.5 with 44100 Hz input. Signal components are at full intensity at the lower frequency. Higher frequencies are attenuated on a slope which reaches zero at (and beyond) the high end of the given range. Further info can be found [http://www.hydrogenaud.io/forums/index.php?s=&showtopic=106868&view=findpost&p=874354 in the HA forum].</ref> !! style="vertical-align: bottom" | Resample !! style="width: 6em; vertical-align: bottom" | Formerly Known As
|- style="background:white;"
+
| -V 0 || --preset extreme || ~240 || || 128 || 19383 Hz - 19916 Hz ||
+
 
|-
 
|-
| -V 0 --vbr-new || --preset fast extreme || ~240 || || || 19383 Hz - 19916 Hz ||
+
|- style="background:white;color:black"
|- style="background:white;"
+
| style="text-align: center" | <code>-b 320</code> || <code>--preset insane</code> || style="text-align: right" | 320 || style="text-align: center" | 320 || style="text-align: center" | Y<ref>CBR mode uses <code>-Y</code> in effect; see the [[LAME Y switch]] article.</ref> || 20094 Hz – 20627 Hz || || api
| -V 1 || || ~210 || || 128 || 18671 Hz - 19205 Hz ||
+
 
|-
 
|-
| -V 1 --vbr-new || || ~210 || || || 18671 Hz - 19205 Hz ||
+
|- style="background:white;color:black"
|- style="background:white;"
+
| style="text-align: center" | <code>-V 0</code> || <code>--preset extreme</code> || style="text-align: right" | ~240 || style="text-align: center" | 220–260 || || style="text-align: center" | none || || ape or apx
| -V 2 || --preset standard || ~190 || || 128 || 18671 Hz - 19205 Hz ||
+
 
|-
 
|-
| -V 2 --vbr-new || --preset fast standard || ~190 || || || 18671 Hz - 19205 Hz ||
+
|- style="background:white;color:black"
|- style="background:white;"
+
| style="text-align: center" | <code>-V 1</code> || || style="text-align: right" | ~220 || style="text-align: center" | 190–250 || || style="text-align: center" | 19383 Hz – 19916 Hz || ||
| -V 3 || || ~175 || Y || || 17960 Hz - 18494 Hz ||
+
 
|-
 
|-
| -V 3 --vbr-new || || ~175 || Y || || 17960 Hz - 18494 Hz ||
+
|- style="background:white;color:black"
|- style="background:white;"
+
| style="text-align: center" | <code>-V 2</code> || <code>--preset standard</code> || style="text-align: right" | ~190 || style="text-align: center" | 170–210 || || style="text-align: center" | 18671 Hz – 19205 Hz || || aps
| -V 4 || --preset medium || ~165 || Y || || 17960 Hz - 18494 Hz ||
+
 
|-
 
|-
| -V 4 --vbr-new || --preset fast medium || ~165 || Y || || 17960 Hz - 18494 Hz ||
+
|- style="background:white;color:black"
|- style="background:white;"
+
| style="text-align: center" | <code>-V 3</code> || || style="text-align: right" | ~170 || style="text-align: center" | 150–195 || style="text-align: center" | Y || style="text-align: center" | 17960 Hz – 18494 Hz || ||
| -V 5 || || ~130 || Y || || 16538 Hz - 17071 Hz ||
+
 
|-
 
|-
| -V 5 --vbr-new || || ~130 || Y || || 16538 Hz - 17071 Hz ||
+
|- style="background:white;color:black"
|- style="background:white;"
+
| style="text-align: center" | <code>-V 4</code> || <code>--preset medium</code> || style="text-align: right" | ~160 || style="text-align: center" | 140–185 || style="text-align: center" | Y || style="text-align: center" | 17249 Hz – 17782 Hz || || apm
| -V 6 || || ~115 || Y || || 15826 Hz - 16360 Hz ||
+
 
|-
 
|-
| -V 6 --vbr-new || || ~115 || Y || || 15826 Hz - 16360 Hz ||
+
|- style="background:white;color:black"
|- style="background:white;"
+
| style="text-align: center" | <code>-V 5</code> || || style="text-align: right" | ~130 || style="text-align: center" | 120–150 || style="text-align: center" | Y || style="text-align: center" | 16538 Hz – 17071 Hz || ||
| -V 7 || || ~100 || Y || || 14581 Hz - 14968 Hz || 32000 Hz
+
 
|-
 
|-
| -V 7 --vbr-new || || ~100 || Y || || 14581 Hz - 14968 Hz || 32000 Hz
+
|- style="background:white;color:black"
|- style="background:white;"
+
| style="text-align: center" | <code>-V 6</code> || || style="text-align: right" | ~120 || style="text-align: center" | 100–130 || style="text-align: center" | Y || style="text-align: center" | 16538 Hz – 17071 Hz || ||
| -V 8 || || ~85 || Y || || 12516 Hz - 12903 Hz || 32000 Hz
+
<!--
 
|-
 
|-
| -V 8 --vbr-new || || ~85 || Y || || 12516 Hz - 12903 Hz || 32000 Hz
+
|- style="background:white;color:black"
|- style="background:white;"
+
| style="text-align: center" | <code>-V 7</code> || || style="text-align: right" | ~100 || style="text-align: center" | 80–120 || style="text-align: center" | Y || style="text-align: center" | none || style="text-align: right" | 32000 Hz ||
| -V 9 || || ~65 || Y || || 9774 Hz - 10065 Hz || 24000 Hz
+
 
|-
 
|-
| -V 9 --vbr-new || || ~65 || Y || || 9774 Hz - 10065 Hz || 24000 Hz
+
|- style="background:white;color:black"
 +
| style="text-align: center" | <code>-V 8</code> || || style="text-align: right" | ~80 || style="text-align: center" | 70–105 || style="text-align: center" | Y || style="text-align: center" | none || style="text-align: right" | 24000 Hz ||
 +
|-
 +
|- style="background:white;color:black"
 +
| style="text-align: center" | <code>-V 9</code> || || style="text-align: right" | ~70 || style="text-align: center" | 45–85 || style="text-align: center" | Y || style="text-align: center" | none || style="text-align: right" | 22050 Hz ||
 +
-->
 
|}
 
|}
  
 +
The default lowpass settings were not chosen at random; for general use, they are as high as they can be without putting quality at risk. Raising the the cutoff via command-line options is not recommended. See the [[high-frequency content in MP3s]] article for more info.
  
==See also==
+
===Resampling===
* [[MP3]]
+
* [[Exact_Audio_Copy|Exact Audio Copy]]
+
* [[EAC_and_Lame | Configuring EAC and LAME]]
+
  
 +
When the input sample rate is greater than 48 kHz, LAME will [[resampling|resample]] it to a maximum of 48 kHz (the maximum supported by MP3). In VBR modes 7 to 9.999, and at CBR bitrates below 104 kbps, the input is resampled to 32000, 24000, 22050, 16000, 12000, 11025, or 8000, depending on the target quality level or bitrate.
  
==Notes and references==
+
Since it is required when resampling, a filter is always applied to remove frequencies above one-half the sample rate. The lowpass info above is indicating whether any ''additional'' filtering is done.
A big thanks to all LAME developers for making one kickass [[MP3]] codec.
+
  
'''People who took part in suggesting the different settings:'''
+
LAME's internal resampler is not ideal.<ref>https://hydrogenaud.io/index.php/topic,97479.0.html</ref> If resampling is needed, better results (especially when targeting low bitrates) can be obtained by using a high-quality sample rate converter, such as SoX or SSRC.
  
Dibrom, r3mix, ff123, Hans Heijden, kjempen, Benjamin Lebsanft, GeSomeone, Wombat & GuruBoolez for his immense testing.
+
===Fraunhofer decoder incompatibility===
 +
Differing interpretations of an unclear portion of the MP3 spec led to a Windows-specific version of the Fraunhofer IIS MP3 decoder being unable to properly play certain MP3s created with certain versions of LAME.
  
'''Creation of the alt preset system and related special code level quality enhancements:'''
+
In order to demonstrate the problem, the problematic MP3 must have been created with LAME 3.97 or earlier, and must contain a frame with certain parameters and a very large amount of data, such as a 320-kbps frame which makes heavy use of the [[bit reservoir]]. The decoder must be the DirectShow filter <code>l3codecx.ax</code> version 1.5.0 or lower, as used by Windows Media Player on versions of Windows prior to Windows Vista. An [http://support.microsoft.com/kb/2115168/en-us August 2010 security update] for Windows XP and Server 2003 upgraded this filter to version 1.6.0, which can play the problematic MP3s. Windows Vista shipped with the older version but Windows Media Player uses a different filter, and later versions of Windows don't have the old filter at all.
  
Dibrom, with technical assistance from Robert Hegemann and Naoki Shibata, Gabriel and extensive tuning help and quality verification via listening tests from JohnV and also initial help (--dm-preset era) from Hans Heijden, ff123, Wombat, and others. Test clips, bitrate information, and further listening tests provided by TheBashar, zbutsam, Pio2001, BadDuDeX, r3mix, h, TarX, Hans Heijden, ff123, Wombat, Filburt, Volcano, Garf, MrDrew, TrNSZ, nyaochi, Amadeus93, in no particular order, and many, many others we (Dibrom, user) probably forgot to mention.
+
A workaround was implemented in LAME 3.98.0 beta 1 through LAME 3.98.2, and in LAME 3.99 alpha 1, whereby 320-kbps frames were limited in how much of the bit reservoir they could use. This resulted in wasted space when the bit reservoir would grow beyond the limit. In LAME 3.98.3 and beyond, and in LAME 3.99 alpha 2 and beyond, the method was changed such that the bit reservoir can't grow beyond the limit.
  
'''Idea (also exposing the need for a unified preset system), Original post and list of original settings collected by:''' user
+
Related discussion threads:
 +
* [http://www.hydrogenaudio.org/forums/index.php?showtopic=40308 LAME high bitrate files in l3codeca.ax]
 +
* [http://www.hydrogenaudio.org/forums/index.php?showtopic=78114 Lame 3.98 wastes bits]
  
'''Layout and additional work by:''' dev0, CiTay, SNYder, Dibrom.
+
===VBR header and LAME tag===
  
And finally...
+
LAME supports the ''de facto'' standard of adding an extra frame of silence to the beginning of MP3 files. This "VBR header" or "Info tag" provides a home for precise info about the audio duration and a table of seek points. It is mainly for the benefit of players working with VBR files. Decoders usually treat the frame as informational, rather than playing the audio.
  
Thank you ALL in the community for making it what it is, providing interest and discussion and helping to work towards the most concise, well tuned, and most thought out MP3 quality "paradigm" seen yet! -- Dibrom
+
LAME uses the Xing format for this header, and extends it by embedding a 20-byte "LAME tag" with additional info:
 +
* a short version string (9 ASCII bytes; see [[LAME version string]])
 +
* audio and info tag CRCs (since LAME 3.90)
 +
* separate delay & padding values for gapless playback (since LAME 3.90)
 +
* various encoder settings (since LAME 3.90, expanded in 3.94 to include presets)
  
 +
Prior to LAME 3.94, the VBR header was only written in VBR files. Since 3.94, it is written to CBR files, too, with "Info" instead of "XING" at the beginning.
  
==Further reading==
+
Details are in this wiki's [[MP3#VBRI, XING, and LAME headers|MP3 article]] and [[LAME version string]] article, and in LAME developer Gabriel Bouvigne's [http://gabriel.mp3-tech.org/mp3infotag.html MP3 Info Tag] documentation.
*[[CBR]]
+
*[[ABR]]
+
*[[VBR]]
+
  
 +
===Hey! What happened to "--alt-preset"?===
 +
 +
The revolutionary {{code|--alt-preset}} system was introduced in LAME 3.90. It was replaced by the {{code|--preset}} flags in later versions.
 +
 +
Starting with version 3.94, the {{code|-Vx}} quality system was introduced, allowing finer control over the desired quality level and bitrate. The <code>--preset</code> switches were made into aliases to the corresponding {{code|-V}} flags for the sake of backward compatibility. '''There is no difference between the output you get if you use {{code|-V2}} or {{code|--alt-preset standard}}.'''
 +
 +
Recent LAME versions feature more streamlined command-line options, and it's recommended to stick to one of the values described in the text or shown in the table above.
 +
 +
For example, the following command-line options will all produce the same output:
 +
 +
* <code>--alt-preset insane</code>
 +
* <code>--preset insane</code>
 +
* <code>-b 320</code>
 +
* <code>--preset 320</code>
 +
* <code>--preset cbr 320</code>
 +
 +
==See also==
 +
* [[LAME Y switch|The -Y switch]]
 +
* [[MP3]]
 +
* [[CBR]]
 +
* [[VBR]]
 +
* [[ABR]]
 +
* [[Exact Audio Copy]]
 +
* [[EAC and Lame | Configuring EAC and LAME]]
 +
 +
==Notes and references==
 +
<references/>
  
 
==External links==
 
==External links==
*[http://lame.sourceforge.net LAME official homepage]
+
* [http://lame.sourceforge.net LAME official homepage]
 +
<!--ReallyRarewares and the rest of rjamorim.com is gone. If the content is back online, please restore & update these links.
 
*[http://www.rjamorim.com/rrw/lame.html Historical versions of LAME] at ReallyRareWares
 
*[http://www.rjamorim.com/rrw/lame.html Historical versions of LAME] at ReallyRareWares
*[http://www.rjamorim.com/test/ Several multiformat listening tests] featuring LAME and other encoders.
+
-->
*[http://www.rarewares.org/mp3.html RareWares MP3 page]
+
*[http://www.hydrogenaudio.org/forums/index.php?showtopic=478&st=0 Discussion of recommended Lame compiles in the Hydrogenaudio forum]
+
* [http://www.hydrogenaudio.org/forums/index.php?act=ST&f=16&t=32288 Forum discussion of the recommended settings]
+
* [http://www.hydrogenaudio.org/forums/index.php?act=ST&f=15&t=203 Forum discussion of the recommended settings (older)]
+
* [http://www.hydrogenaudio.org/forums/index.php?showtopic=32288&view=findpost&p=327262 Previous recommendations (outdated)]
+
  
 
[[Category:Software]]
 
[[Category:Software]]
 
[[Category:Encoder/Decoder]]
 
[[Category:Encoder/Decoder]]
 +
[[Category:MP3]]

Latest revision as of 13:21, 16 March 2020

Featured article
LAME
LAME official logo

LAME ain't an MP3 encoder
Developer(s) The LAME project
Release information
Initial release {{{released}}}
Stable release 3.100
Preview release none
Compatibility
Operating system Windows, Mac OS/X, Linux/BSD
Additional information
Use Encoder/Decoder
License LGPL
Website LAME website, Download site: Rarewares LAME-bundle

LAME (Lame Ain't an MP3 Encoder) is the Hydrogenaudio recommended MP3 encoder. It has been developed by the open-source community since 1998, and has become the highest quality MP3 encoder for most purposes.

Some benefits of using LAME:

  • Highly optimised presets
  • Fast encoding
  • CBR, ABR and quality-optimized VBR encoding methods
  • Gapless playback with LAME-header compliant decoders
  • Supported by recommended CD rippers Exact Audio Copy and CDex
  • Highly tunable


History[edit]

LAME development began around mid-1998. Mike Cheng started it as a patch against the 8hz-MP3 encoder sources. After some quality concerns raised by others, he decided to start from scratch based on the dist10 sources.[1] That branch (a patch against the reference sources) became LAME 2.0. By the release of LAME 3.81, all dist10 code was removed, making LAME a completely new program, not a mere patch of an existing encoder.

The project quickly became a team effort. Mike Cheng eventually left leadership and started working on tooLAME, an MP2 encoder. Mark Taylor became leader and released version 3.0 featuring gpsycho, a new psychoacoustic model developed by him.

Nowadays LAME is considered the best MP3 encoder at mid & high bitrates, and features the best VBR model among MP3 implementations, mostly thanks to the dedicated work of talented developers Takehiro Tominaga, Naoki Shibata, Darin Morrison, Gabriel Bouvigne, Robert Hegemann, and others. Development is ongoing.

Although LAME is generally considered to be an encoder, according to the LAME technical FAQ, it's technically not an encoder, but rather is officially just "a development project which uses the open source model to improve MP3 technology." This improved technology is only released in source code form in order to minimize the risk of violating patents. When the source code is compiled and distributed, it may require a license from Thomson, depending on where and how it's to be used. The LAME project's position is "Source code is considered as speech, which may contain descriptions of patented technology. Descriptions of patents are in the public domain."

LAME source code is maintained in a CVS repository, and the only official codebase for public use is the trunk code tagged "MAIN". There are also numerous experimental branches of this code in which the developers test new ideas. One of these branches was started after the release of LAME 3.92 in 2002. To keep it from being confused with LAME 3.93 alpha versions, the code was made to self-identify as LAME 4.0 alpha 1 (in late 2002) through 4.0 alpha 14 (since 2005). This code is mainly for the developers to test optimizations and architectural changes in LAME's foundational code, ideas that may eventually be used in the main branch if and when development actually begins on LAME 4.0. However, some members of the public used this code to build working copies of "LAME 4.0" alpha versions in 2003-2005. These should not be considered actual LAME 4.0 releases and the developers do not want public feedback on them, nor do they want any more public builds to be made from this branch.

Recommended encoder compiles and source code[edit]

Unless noted otherwise, the recommended LAME compile for optimal quality is always the latest stable version.

Download the latest LAME from these links:

Avoid using alpha versions of LAME. These versions have "a" in their version string and are usually only for testing changes and new features, and may result in lower quality MP3s. Use them only if you want to help the developers and provide feedback.

Recommended encoder settings[edit]

This section describes the Hydrogenaudio recommended settings to be used with LAME for highest quality MP3 encoding. These settings require LAME 3.98 or later (the latest stable version is recommended).

Maximum quality and archiving[edit]

Maximum quality is achieved when, regardless of listening conditions, you are unable to detect a difference between the MP3 and the original. As demonstrated by blind ABX tests, LAME-encoded MP3s typically achieve this level of transparency when encoded with the default settings, at bitrates well below maximum. Encoding with higher-bitrate settings will have no effect on the perceived quality.

For archiving, only lossless formats like WavPack, FLAC, etc. are ideal; they will preserve the audio with no changes, sample-for-sample, regardless of encoder settings. In contrast, lossy formats like MP3 are designed to save space by changing the audio in subtle, often imperceptible ways, even at the encoder's maximum settings.

[VBR] Very high quality: HiFi, home, or quiet listening, with best file size[edit]

-V 0 (~245 kbps), -V 1 (~225 kbps), -V 2 (~190 kbps) or -V 3 (~175 kbps) are recommended.

These VBR settings will normally produce transparent results. Audible differences between these presets may exist, but are rare.

[CBR] Very high quality: HiFi, home, or quiet listening, with maximum file size[edit]

-b 320 is an alternative to the VBR settings above.

This CBR mode will maximize the MP3's bitrate and overall file size. The extra space may allow for some parts of the audio to be compressed with fewer sacrifices, but to date, no one has produced ABX test results demonstrating that perceived quality is ever better than the highest VBR profiles described above.[2]

Portable: listening in noisy conditions, lower bitrate, smaller file size[edit]

-V 4 (~165 kbps), -V 5 (~130 kbps) or -V 6 (~115 kbps) are recommended.

-V 6 produces an "acceptable" quality, while -V 4 should be close to perceptual transparency.

Very low bitrate, small sizes: eg. for voice, radio, mono encoding etc.[edit]

For very low bitrates, up to 100kbps, ABR is most often the best solution. Use --abr <bitrate> (e.g. --abr 80).

--preset voice is only available in the command line front-end, and is there for compatibility. It is currently mapped to --abr 56 -mm, so that means that the recommendation would be to encode in mono, and use ABR.

Understanding the bitrate settings[edit]

MP3s are divided into frames, each frame being a particular size, expressed as a bitrate. If the bitrate of every frame is the same throughout the file, then the file is considered to be constant bit rate (CBR). Otherwise, it is variable bit rate (VBR). LAME offers CBR and VBR encoding modes, as well as a special VBR encoding mode called ABR (average bit rate).

VBR (variable bitrate) settings[edit]

VBR: variable bitrate mode. Use variable bitrate modes when the goal is to achieve a fixed level of quality using the lowest possible bitrate.

VBR is best used to target a specific quality level, instead of a specific bitrate. The final file size of a VBR encode is less predictable than with ABR, but the quality is usually better.

Unlike other MP3 encoders which do VBR encoding based on predictions of output quality, LAME's default VBR method tests the actual output quality to ensure the desired quality level is always achieved.

Usage: -V <number> where <number> is between 0 and 9, 0 being highest quality, 9 being the lowest. (Note: The "V" has to be a capital letter.)

Example: -V 2

Fractional values out to three decimal places are also accepted, with 9.999 being the absolute lowest quality.

Example: -V 2.75

Note: The switch --vbr-new, which enabled a superior VBR mode in LAME 3.97 and some previous versions, is no longer needed with LAME 3.98 and higher, as it is now the default VBR mode. However, if you're still using LAME 3.97 or older, you have to add --vbr-new to your command line to use that mode.

The target bitrate and actual typical bitrate for each VBR quality level is shown in the Technical details for recommended LAME settings section below.

If you need a predictable bitrate (in a streaming application, for example), use ABR or CBR modes, described below.

ABR (average bitrate) settings[edit]

ABR: average bitrate mode. A compromise between VBR and CBR modes, ABR encoding varies bits around a specified target bitrate.

Use ABR when you need to know the final size of the file but still want to allow the encoder some flexibility to decide which passages need more bits. The output is an ordinary VBR file compatible with all MP3 players that support VBR; ABR is not a special type of file, just a LAME-specific strategy for producing VBR.

Usage: --preset <bitrate> where <bitrate> (desired averaged bitrate in kbit/s) is a value between 8 and 320.

Example: --preset 200

Important: ABR setting is tuned from 320 kbit/s down to 80 kbit/s.

CBR (constant bitrate) settings[edit]

CBR: constant bitrate mode. CBR encoding is not efficient. Whereas VBR and ABR modes can supply more bits to complex music passages and save bits on simpler ones, CBR encodes every frame at the same bitrate.

CBR is only recommended for usage in streaming situations where the upper bitrate must be strictly enforced. There is still some variability in bitrate behind the scenes, through LAME's use of the bit reservoir feature of the MP3 format, but it is much less flexible than actual VBR.

Usage: -b <bitrate> where <bitrate> (bitrate in kbit/s) must be chosen from the following values: 8, 16, 24, 32, 40, 48, 64, 80, 96, 112, 128, 160, 192, 224, 256, or 320.

Example: -b 192

Important: CBR setting is tuned from 320 kbit/s down to 80 kbit/s.

Remarks[edit]

  • The rule of thumb when considering encoding options: at a given bitrate, VBR is higher quality than ABR, which is higher quality than CBR (VBR > ABR > CBR in terms of quality). However, ABX tests demonstrate that as bitrate increases, the perceptual differences diminish, with all modes generally reaching transparency well before their maximum settings; when you can't tell the difference, the modes are qualitatively the same.
  • In terms of filesize VBR tends to produce the smallest files down to -V7. For lower quality (e.g. for non-music audio such as speech) ABR will produce smaller files than VBR, starting from --abr 115.
  • All modes and settings mentioned in this topic belong to the specifications of the MP3 standard, and the resulting MP3s should be playable by every MP3 decoder that conforms with the standard. If your decoder or device does not play MP3s produced by LAME, blame the manufacturer or developer, not LAME.
  • Prior to LAME 3.98, the --vbr-new switch enabled the new VBR mode. This is now the default VBR mode, with the old mode being available via --vbr-old. In terms of quality, the new mode appears to be better than the old, but reports of artifacts when using the new mode do exist. Despite these possible issues, the new mode is currently recommended due to both the speed and quality increases afforded by the new algorithm.

Technical information[edit]

Recommended settings details[edit]

Technical details of the recommended settings
Switch Preset Target Kbps Typical Kbps[3] Y Switch enabled by default Lowpass[4] Resample Formerly Known As
-b 320 --preset insane 320 320 Y[5] 20094 Hz – 20627 Hz api
-V 0 --preset extreme ~240 220–260 none ape or apx
-V 1 ~220 190–250 19383 Hz – 19916 Hz
-V 2 --preset standard ~190 170–210 18671 Hz – 19205 Hz aps
-V 3 ~170 150–195 Y 17960 Hz – 18494 Hz
-V 4 --preset medium ~160 140–185 Y 17249 Hz – 17782 Hz apm
-V 5 ~130 120–150 Y 16538 Hz – 17071 Hz
-V 6 ~120 100–130 Y 16538 Hz – 17071 Hz

The default lowpass settings were not chosen at random; for general use, they are as high as they can be without putting quality at risk. Raising the the cutoff via command-line options is not recommended. See the high-frequency content in MP3s article for more info.

Resampling[edit]

When the input sample rate is greater than 48 kHz, LAME will resample it to a maximum of 48 kHz (the maximum supported by MP3). In VBR modes 7 to 9.999, and at CBR bitrates below 104 kbps, the input is resampled to 32000, 24000, 22050, 16000, 12000, 11025, or 8000, depending on the target quality level or bitrate.

Since it is required when resampling, a filter is always applied to remove frequencies above one-half the sample rate. The lowpass info above is indicating whether any additional filtering is done.

LAME's internal resampler is not ideal.[6] If resampling is needed, better results (especially when targeting low bitrates) can be obtained by using a high-quality sample rate converter, such as SoX or SSRC.

Fraunhofer decoder incompatibility[edit]

Differing interpretations of an unclear portion of the MP3 spec led to a Windows-specific version of the Fraunhofer IIS MP3 decoder being unable to properly play certain MP3s created with certain versions of LAME.

In order to demonstrate the problem, the problematic MP3 must have been created with LAME 3.97 or earlier, and must contain a frame with certain parameters and a very large amount of data, such as a 320-kbps frame which makes heavy use of the bit reservoir. The decoder must be the DirectShow filter l3codecx.ax version 1.5.0 or lower, as used by Windows Media Player on versions of Windows prior to Windows Vista. An August 2010 security update for Windows XP and Server 2003 upgraded this filter to version 1.6.0, which can play the problematic MP3s. Windows Vista shipped with the older version but Windows Media Player uses a different filter, and later versions of Windows don't have the old filter at all.

A workaround was implemented in LAME 3.98.0 beta 1 through LAME 3.98.2, and in LAME 3.99 alpha 1, whereby 320-kbps frames were limited in how much of the bit reservoir they could use. This resulted in wasted space when the bit reservoir would grow beyond the limit. In LAME 3.98.3 and beyond, and in LAME 3.99 alpha 2 and beyond, the method was changed such that the bit reservoir can't grow beyond the limit.

Related discussion threads:

VBR header and LAME tag[edit]

LAME supports the de facto standard of adding an extra frame of silence to the beginning of MP3 files. This "VBR header" or "Info tag" provides a home for precise info about the audio duration and a table of seek points. It is mainly for the benefit of players working with VBR files. Decoders usually treat the frame as informational, rather than playing the audio.

LAME uses the Xing format for this header, and extends it by embedding a 20-byte "LAME tag" with additional info:

  • a short version string (9 ASCII bytes; see LAME version string)
  • audio and info tag CRCs (since LAME 3.90)
  • separate delay & padding values for gapless playback (since LAME 3.90)
  • various encoder settings (since LAME 3.90, expanded in 3.94 to include presets)

Prior to LAME 3.94, the VBR header was only written in VBR files. Since 3.94, it is written to CBR files, too, with "Info" instead of "XING" at the beginning.

Details are in this wiki's MP3 article and LAME version string article, and in LAME developer Gabriel Bouvigne's MP3 Info Tag documentation.

Hey! What happened to "--alt-preset"?[edit]

The revolutionary --alt-preset system was introduced in LAME 3.90. It was replaced by the --preset flags in later versions.

Starting with version 3.94, the -Vx quality system was introduced, allowing finer control over the desired quality level and bitrate. The --preset switches were made into aliases to the corresponding -V flags for the sake of backward compatibility. There is no difference between the output you get if you use -V2 or --alt-preset standard.

Recent LAME versions feature more streamlined command-line options, and it's recommended to stick to one of the values described in the text or shown in the table above.

For example, the following command-line options will all produce the same output:

  • --alt-preset insane
  • --preset insane
  • -b 320
  • --preset 320
  • --preset cbr 320

See also[edit]

Notes and references[edit]

  1. dist10 is the rudimentary "demonstration" MP3 encoder described in the MPEG-2 standard, ISO/IEC 13818.
  2. Prior to version 3.99, CBR and VBR modes were encoded differently by LAME. In some unusual problem samples, these differences were sometimes audible, even at very high bitrates. Current versions of LAME encode CBR and VBR with the same psychoacoustic model, so such differences shouldn't arise from normal use.
  3. Typical bitrates are mostly based on the results of testing with LAME 3.98.2.
  4. This range is the transition band of the lowpass filter, as of LAME 3.99.5 with 44100 Hz input. Signal components are at full intensity at the lower frequency. Higher frequencies are attenuated on a slope which reaches zero at (and beyond) the high end of the given range. Further info can be found in the HA forum.
  5. CBR mode uses -Y in effect; see the LAME Y switch article.
  6. https://hydrogenaud.io/index.php/topic,97479.0.html

External links[edit]