From Hydrogenaudio Knowledgebase
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
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. 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."
 Recommended encoder compiles and source code
Unless noted otherwise, the recommended LAME compile for optimal quality is always the latest stable version.
It is suggested that the compiles available here be used with the recommended encoder settings you can find below.
Download the latest LAME from these links:
- RareWares MP3 Page - Compiles for Win32, Mac OS X universal binary, Linux etc.
- LAME source code on SourceForge
Avoid using alpha versions of LAME. These versions have "a" in their version string. More often than not those are exclusively for testing purposes. Use them only if you want to help developers with feedback.
 Recommended encoder settings
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).
 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).
 VBR (variable bitrate) settings
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.
-V<number> where <number> is 0-9, 0 being highest quality, 9 being the lowest.
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 commandline to use that mode.
|Switch||Preset||Target Kbit/s||Bitrate range kbit/s|
|-b 320||--preset insane||320||320 CBR|
|-V 0||--preset fast extreme||245||220...260|
|-V 2||--preset fast standard||190||170...210|
|-V 4||--preset fast medium||165||140...185|
If you need a predictable bitrate (in a streaming application, for example), use ABR or CBR modes, described below.
 ABR (average bitrate) settings
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.
--preset <bitrate> where <bitrate> (desired averaged bitrate in kbit/s) is a value between 8 and 320.
Important: ABR setting is tuned from 320 kbit/s down to 80 kbit/s.
 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.
-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.
Important: CBR setting is tuned from 320 kbit/s down to 80 kbit/s.
- 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.
- 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-newswitch 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.
 Hey! What happened to "--alt-preset"?
--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, which allows finer control over the desired bitrate; the
--preset switches were made into aliases to the corresponding
-V flags for the sake of backwards compatibility. There is no difference between the output you get if you use
--alt-preset standard. (Although adding
--vbr-new is recommended for now, see above for details.)
More encoding options are available under the new system, such as
-V1, which provides a level of quality between the old "standard" and "extreme" presets, or
-V3, which is between the old "medium" and "standard" presets.
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 tables above.
For example, the following command-line options will all produce the same output:
--preset cbr 320
 Technical information
 Recommended settings details
The table below contains technical details about the recommended settings.
|Switch||Preset||Target Kbps||Y Switch||Lowpass||Resample|
|-V 0||--preset fast extreme||~245|
|-V 1||~225||19383 Hz - 19916 Hz|
|-V 2||--preset fast standard||~190||18671 Hz - 19205 Hz|
|-V 3||~175||Y||17960 Hz - 18494 Hz|
|-V 4||--preset fast medium||~165||Y||17249 Hz - 17782 Hz|
|-V 5||~130||Y||16538 Hz - 17071 Hz|
|-V 6||~115||Y||15115 Hz - 15648 Hz|
|-V 7||~100||Y||14581 Hz - 14968 Hz||32000 Hz|
|-V 8||~85||Y||12516 Hz - 12903 Hz||32000 Hz|
|-V 9||~65||Y||9336 Hz - 9602 Hz||24000 Hz|
 Fraunhofer decoder incompatibility
Differing interpretations of an unclear portion of the MP3 spec led to certain versions 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. That filter is the decoder used by Windows Media Player. The filter was upgraded to 1.6.0 by an August 2010 security update; the newer version can play the problematic MP3s.
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:
 LAME version string formatting
The 9-character LAME short version string, as written in the LAME tag, has the following format:
LAME" + major version + "
." + minor version + flag
When the minor version is > 99, as is expected to happen when LAME 3.100 is released, the "
." will be omitted:
LAME" + major version + minor version + flag
If the version string is ever is less than 9 bytes, it is null-padded when written to the LAME tag.
The flag is normally one of the following:
a" for alpha versions
b" for beta versions
r" for release versions with patch version > 0, starting with 3.96.1
- "" (empty string) for release versions with patch version = 0 and minor version > 99
For LAME 3.99.1, the format was changed such that release versions with a patch version > 0 would be identified with the following format:
L" + major version + "
." + minor version + flag + patch version
However, the new code contained a minor error which resulted in the patch version being omitted, and the change of "
LAME" to "
L" proved to be problematic for hardware and software players which failed to recognize the LAME tags as such, adversely affecting gapless playback and encoder identification, so the new scheme was abandoned for 3.99.2 and up.
- 3.98 = 3.98.0 = "
LAME3.98" followed by a space character (byte 0x20)
- 3.98.1 through 3.98.4 = "
- 3.99 alpha versions = "
- 3.99 beta versions = "
- 3.99 = 3.99.0 = "
LAME3.99" followed by a space character
- 3.99.1 = "
L3.99r" followed by three null characters (byte 0x00)
- 3.99.2 through 3.99.n = "
- 3.100 alpha versions = "
Related discussion thread:
- LAME 3.99 is out (reports and discussion from 9 through 18 Nov 2011).
- version.c in CVS (revisions 1.31 through 1.34)
 See also
 Notes and references
People who took part in suggesting the different settings:
Dibrom, r3mix, ff123, Hans Heijden, kjempen, Benjamin Lebsanft, GeSomeone, Wombat & GuruBoolez for his immense testing.
Creation of the alt preset system and related special code level quality enhancements:
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.
Idea (also exposing the need for a unified preset system), Original post and list of original settings collected by: user
Layout and additional work by: dev0, CiTay, SNYder, Dibrom.
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
- ↑ dist10 is the rudimentary "demonstration" MP3 encoder described in the MPEG-2 standard, ISO/IEC 13818.
- ↑ 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 the same way, so such differences shouldn't arise from normal use.