Difference between revisions of "Recommended LAME"

From Hydrogenaudio Knowledgebase
Jump to: navigation, search
(Minor fix on download instruction)
m (VBR (Variable bitrate) settings)
Line 28: Line 28:
 
| -V 0 || --preset extreme || 245 || 220...260
 
| -V 0 || --preset extreme || 245 || 220...260
 
|-
 
|-
| -V 1 --vbr-new || || 225 || 200...250
+
| -V 1 --vbr-new || || 225 || 200...250
 
|-
 
|-
| -V 1 || || 225 || 200...250
+
| -V 1 || || 225 || 200...250
 
|-
 
|-
 
| -V 2 --vbr-new || --preset fast standard || 190 || 170...210
 
| -V 2 --vbr-new || --preset fast standard || 190 || 170...210
Line 36: Line 36:
 
| -V 2 || --preset standard || 190 || 170...210
 
| -V 2 || --preset standard || 190 || 170...210
 
|-
 
|-
| -V 3 --vbr-new || || 175 || 155...195
+
| -V 3 --vbr-new || || 175 || 155...195
 
|-
 
|-
| -V 3 || || 175 || 155...195
+
| -V 3 || || 175 || 155...195
 
|-
 
|-
 
| -V 4 --vbr-new || --preset fast medium || 165 || 145...185
 
| -V 4 --vbr-new || --preset fast medium || 165 || 145...185
Line 44: Line 44:
 
| -V 4 || --preset medium  || 165 || 145...185
 
| -V 4 || --preset medium  || 165 || 145...185
 
|-
 
|-
| -V 5 --vbr-new || || 130 || 110...150
+
| -V 5 --vbr-new || || 130 || 110...150
 
|-
 
|-
| -V 5 || || 130 || 110...150
+
| -V 5 || || 130 || 110...150
 
|-
 
|-
| -V 6 --vbr-new || || 115 || 95...135
+
| -V 6 --vbr-new || || 115 || 95...135
 
|-
 
|-
| -V 6 || || 115 || 95...135
+
| -V 6 || || 115 || 95...135
 
|-
 
|-
| -V 7 --vbr-new || || 100 || 80...120
+
| -V 7 --vbr-new || || 100 || 80...120
 
|-
 
|-
| -V 7 || || 100 || 80...120
+
| -V 7 || || 100 || 80...120
 
|-
 
|-
| -V 8 --vbr-new || || 85 || 65...105
+
| -V 8 --vbr-new || || 85 || 65...105
 
|-
 
|-
| -V 8 || || 85 || 65...105
+
| -V 8 || || 85 || 65...105
 
|-
 
|-
| -V 9 --vbr-new || || 65 || 45...85
+
| -V 9 --vbr-new || || 65 || 45...85
 
|-
 
|-
| -V 9 || || 65 || 45...85
+
| -V 9 || || 65 || 45...85
 
|}
 
|}
 
See also [[Technical data for recommended LAME settings]]
 
See also [[Technical data for recommended LAME settings]]

Revision as of 22:44, 5 July 2006

Introduction

This article describes the Hydrogenaudio recommended settings to be used with LAME for highest quality MP3 encoding.

These settings require LAME 3.94 or later. LAME 3.97beta2 is the recommended version (click here to download).

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.

Note: 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.

Note: 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 (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.

-V(number) where number is 0-9, 0 being highest quality, 9 being the lowest.

List of recommended settings
Switch Preset Target Kbit/s Bitrate range kbit/s
-b 320 --preset insane 320 320 CBR
-V 0 --vbr-new --preset fast extreme 245 220...260
-V 0 --preset extreme 245 220...260
-V 1 --vbr-new   225 200...250
-V 1   225 200...250
-V 2 --vbr-new --preset fast standard 190 170...210
-V 2 --preset standard 190 170...210
-V 3 --vbr-new   175 155...195
-V 3   175 155...195
-V 4 --vbr-new --preset fast medium 165 145...185
-V 4 --preset medium 165 145...185
-V 5 --vbr-new   130 110...150
-V 5   130 110...150
-V 6 --vbr-new   115 95...135
-V 6   115 95...135
-V 7 --vbr-new   100 80...120
-V 7   100 80...120
-V 8 --vbr-new   85 65...105
-V 8   85 65...105
-V 9 --vbr-new   65 45...85
-V 9   65 45...85

See also Technical data for recommended LAME settings

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.

(128 kbit/s ABR: roughly the same filesize as 128 kbit/s CBR)

  • ABR Setting tuned from 320 kbit/s down to 80 kbit/s
    • --preset <bitrate>

<bitrate> (desired averaged bitrate in kbit/s) can be any value between 8 - 320 , like eg. 9, 17, 80, 128, 133, 200 etc.

Example: --preset 200

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.

  • CBR Setting tuned from 320 kbit/s down to 80 kbit/s
    • -b <bitrate>

<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.

Remarks

The ""--vbr-new"" switch enables the new VBR mode. Lame will encode much faster than the old/default VBR mode. In terms of quality, --vbr-new appears to be better than the old model, but reports of artifacts when using the new model do exist. Despite these possible issues, --vbr-new is currently recommended over the default VBR mode due to both the speed and quality increases afforded by the new algorithm.

Quick Start

Best Quality : 'archiving'

-b 320. This is the strongest setting for MP3, with the lowest risk of artifacts. 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-no matter how transparent the resulting files might be. Alternative: Lossless formats like WavPack, FLAC etc. allow true archiving bit for bit like on original CD.

High Quality : HiFi, home or quiet listening

-V3 --vbr-new (~175 kbps), -V2 --vbr-new (~190 kbps), -V1 --vbr-new (~210 kbps) or -V0 --vbr-new (~230 kbps) are recommended. 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 marginal.

Portable : background noise and low bitrate requirement, small sizes

-V6 --vbr-new (~115 kbps), -V5 --vbr-new (~130 kbps) or -V4 --vbr-new (~160 kbps) are recommended for this use. -V6 --vbr-new produces an acceptable quality, while -V4--vbr-new should be close to perceptual transparency.

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

For very low bitrates, up to 100kbps, ABR is most often the best solution.

Use --abr xx (e.g. --abr 80).

Here a trial to get a view, how the perceived listening quality improves with settings/averaged filesize

Hey! What happened to "--alt-preset"?

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 -V x 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 "-V2" or "--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".

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. You don't need to worry anymore about quality, settings, arcane combinations of switches, or presets.

For example, the following command lines will all produce the same output:

--alt-preset insane = --preset insane = -b 320 = --preset 320 = --preset cbr 320

(--preset cbr 320 is the exact same thing as --alt-preset insane, etc.)

Setting up EAC for LAME.exe with tagging

Important note

From EAC 1.0 beta 2, the replacement strings changed. For example:

  • "%s" is now "%source%"
  • "%d" is now "%dest%"
  • "%a" is now "%artist%"
  • "%l" is now "%islow%"
  • "%h" is now "%ishigh%"

See the full list in the EAC Placeholders page, the EAC Compression Options guide or in the original EAC FAQ.

Software Needed

Note: This guide has now been amended to reflect changes made to LAME as of 3.98. --vbr-new is now the default setting and is no longer explicitly required. In addition, non-standard genres are now handled more elegantly.

Installation

Note: This guide assumes that EAC has been configured for secure ripping, if not please follow this guide.

  • Unzip the chosen LAME version into the same directory as EAC.
  • If you would like to tag with APEv2 tags please download wapet.zip and unzip it into the same folder.

General Configuration

  • Open EAC and insert a CD into the drive.
  • Click the EAC menu and select Compression Options.
  • Click the External Compression Tab, and put a check box in Use external program for compression.
  • Change Parameter passing scheme to User Defined Encoder (see this thread for reasoning).
  • Change Use file extension to .mp3.
  • Click the Browse button and locate the lame.exe that you unzipped into the EAC directory earlier.

Note: If you want to tag with APEv2 tags using Wapet please locate wapet.exe, not lame.exe.

  • Don't worry which bit rate is shown in the Bit rate drop-down box, as this will not have any effect on the resultant MP3 file unless the %bitrate% placeholder is used (see end of the Advanced Command Line Usage section).
  • Don't worry about the Use CRC check setting; it won't affect the resultant MP3 file either.
  • It's a good idea to tick Check for external programs return code.

Configuring the Additional command line options

  • The green portion in the examples following this section is where you configure the LAME preset.
  • The %source% (formerly %s) and %dest% (formerly %d) in the examples following this section are placeholders for EAC. %source% means source filename and %dest% means destination filename. These are absolutely necessary!

Adding Tags

Note: Always use the [Test Encoder] Button to check your Command Line string. With EAC V1.0 beta 3 if you get a message: "Invalid replacement tag found !" try replacing
each occurence of "%" with "%%" since you need to use double percent so one can be escaped and allow the second one to be passed to Lame.


Let EAC create tags (Recommended)

To have EAC tag your files, tick Add ID3 tag; and in the Additional command line options box, copy and paste the following string:

-V2 %source% %dest%

Create files with no tags

If you do not wish to have tags, untick Add ID3 tag; and in the Additional command line options box, copy and paste the following string:

-V2 %source% %dest%

Let Lame create tags

If you prefer to have Lame tag the files based on information shown in the EAC GUI, untick the checkbox next to Add ID3 tag. This is recommended in the article about EAC Compression Options.

Here are some examples providing different tag types:

  • ID3v1 only:
-V2 --id3v1-only --ta "%artist%" --tt "%title%" --tg "%genre%" --tl "%albumtitle%" --ty "%year%" --tn "%tracknr%/%numtracks%" %source% %dest%
  • ID3v2 only :
-V2 --id3v2-only --pad-id3v2 --ta "%artist%" --tt "%title%" --tg "%genre%" --tl "%albumtitle%" --ty "%year%" --tn "%tracknr%/%numtracks%" %source% %dest%
  • ID3v2 only (before EAC version 1.0b2 - for comparison):
-V2 --id3v2-only --pad-id3v2 --ta "%a" --tt "%t" --tg "%m" --tl "%g" --ty "%y" --tn "%n" %s %d
  • ID3v1 and ID3v2:
-V2 --add-id3v2 --pad-id3v2 --ta "%artist%" --tt "%title%" --tg "%genre%" --tl "%albumtitle%" --ty "%year%" --tn "%tracknr%/%numtracks%" %source% %dest%
  • Automatic:
-V2 --ta "%artist%" --tt "%title%" --tg "%genre%" --tl "%albumtitle%" --ty "%year%" --tn "%tracknr%/%numtracks%" %source% %dest%

With Automatic, ID3v1 will always be created. If any ID3v1 field exceeds the length allowed by the ID3v1 specification then a complete ID3v2 tag will also be added.

Use Wapet to create APEv2 tags

If you prefer instead to have APEv2 tags based on information shown in the EAC GUI, untick the checkbox next to Add ID3 tag

Note: Creating APE tags requires wapet.exe. Remember to browse for wapet.exe instead of lame.exe as the external encoding program. Also, lame.exe needs to be in the same directory as wapet.exe.

Use the following string:

%dest% -t "Artist=%artist%" -t "Title=%title%" -t "Album=%albumtitle%" -t "Year=%year%" -t "Track=%tracknr%/%numtracks%" -t "Genre=%genre%" LAME.exe -V2 %source% %dest%

Advanced Command Line Usage

  • The %islow%...%islow% and '%ishigh%...%ishigh% placeholders are used to add text according to whether the High quality or Low quality radio button is selected, as shown below:
%islow%-V5%islow%%ishigh%-V0%ishigh% %source% %dest%

Therefore, if you select Low quality, EAC will invoke the LAME encoder with the following command line parameters:

-V5 %source% %dest%

..and if you select High quality EAC will invoke LAME with these command line parameters:

-V0 %source% %dest%
  • You can access the bitrate value in the drop-down list using the %bitrate% placeholder, for example:
-b%bitrate% %source% %dest%

So, if you selected 192 kBit/s in the Bit Rate drop-down list, the command line would be:

-b192 %source% %dest%

It is a generally accepted fact that the bitrate selected in the drop-down list doesn't affect the command line. In essence this is true, as it will not affect the command line unless you use the %bitrate% (formerly %r) placeholder. However, the bitrate needs only be set when using ABR or CBR over VBR, which is not recommended for better quality audio.


LAME configured with ID3v1 tagging (and replacement strings used before EAC version 1.0 beta 2)

Additional reading



Credits