/nfo/linux/lame.mp3.options.inc
LAME is an MPEG Audio Layer III (MP3) encoder licensed under the LGPL.
Today, LAME is considered the best MP3 encoder at mid-high bitrates and
at VBR, mostly thanks to the dedicated work of its developers and the
open source licensing model that allowed the project to tap into
engineering resources from all around the world. Both quality and speed
improvements are still happening, probably making LAME the only MP3
encoder still being actively developed.
lame settings example to encode a 192kbs 44.1kHz mp3 file with info
tags from a in.wav file:
lame -h -b 192 -s 44.1 --tt title --ta artist --tl album --ty year --tc
comment --tn tracknumber --tg genre in.wav out.mp3
-------------------------
Lame Command Line Options
-------------------------
% lame [options] inputfile [outputfile]
For more options, just type:
% lame --help
=======================================================================
Constant Bitrate Examples:
=======================================================================
fixed bit rate jstereo 128 kbps encoding:
% lame sample.wav sample.mp3
fixed bit rate jstereo 128 kbps encoding, higher quality: (recommended)
% lame -h sample.wav sample.mp3
Fast encode, low quality (no noise shaping)
% lame -f sample.wav sample.mp3
=======================================================================
Variable Bitrate Examples:
=======================================================================
LAME has two types of variable bitrate: ABR and VBR.
ABR is the type of variable bitrate encoding usually found in other
MP3 encoders, Vorbis and AAC. The number of bits is determined by
some metric (like perceptual entropy, or just the number of bits
needed for a certain set of encoding tables), and it is not based on
computing the actual encoding/quantization error. ABR should always
give results equal or better than CBR:
ABR: (--abr means encode with an average bitrate of around x kbps)
lame -h --abr 128 sample.wav sample.mp3
VBR is a true variable bitrate mode which bases the number of bits for
each frame on the measured quantization error relative to the
estimated allowed masking. There are 10 compression levels defined,
ranging from 0=lowest compression to 9 highest compression. The resulting
filesizes depend on the input material. On typical music you can expect
-V5 resulting in files averaging 132 kbps, -V2 averaging 200 kbps.
Variable Bitrate (VBR): (use -V n to adjust quality/filesize)
% lame -V2 sample.wav sample.mp3
=======================================================================
LOW BITRATES
=======================================================================
At lower bitrates, (like 24 kbps per channel), it is recommended that
you use a 16 kHz sampling rate combined with lowpass filtering. LAME,
as well as commercial encoders (FhG, Xing) will do this automatically.
However, if you feel there is too much (or not enough) lowpass
filtering, you may need to try different values of the lowpass cutoff
and passband width (--resample, --lowpass and --lowpass-width options).
=======================================================================
STREAMING EXAMPLES
=======================================================================
% cat inputfile | lame [options] - - > output
=======================================================================
Scripts are included (in the 'misc' subdirectory)
to run lame on multiple files:
bach script: mlame Run "mlame -?" for instructions.
sh script: auenc Run auenc for instructions
sh script: mugeco.sh
Pearl script which will re-encode mp3 files and preserve id3 tags:
lameid3.pl
Windows scripts:
lame4dos.bat
Lame.vbs (and an HTML frontend: LameGUI.html)
=======================================================================
options guide:
=======================================================================
These options are explained in detail below.
Quality related:
-m m/s/j/f/a mode selection
-q n Internal algorithm quality setting 0..9.
0 = slowest algorithms, but potentially highest quality
9 = faster algorithms, very poor quality
-h same as -q2
-f same as -q7
Constant Bit Rate (CBR)
-b n set bitrate (8, 16, 24, ..., 320)
--freeformat produce a free format bitstream. User must also specify
a bitrate with -b, between 8 and 640 kbps.
Variable Bit Rate (VBR)
-v VBR
--vbr-old use old variable bitrate (VBR) routine
--vbr-new use new variable bitrate (VBR) routine (default)
-V n VBR quality setting (0=highest quality, 9=lowest)
-b n specify a minimum allowed bitrate (8,16,24,...,320)
-B n specify a maximum allowed bitrate (8,16,24,...,320)
-F strictly enforce minimum bitrate
-t disable VBR informational tag
--nohist disable display of VBR bitrate histogram
--abr n specify average bitrate desired
Operational:
-r assume input file is raw PCM
-s n input sampling frequency in kHz (for raw PCM input files)
--resample n output sampling frequency
--mp3input input file is an MP3 file. decode using mpglib/mpg123
--ogginput input file is an Ogg Vorbis file. decode using libvorbis
-x swap bytes of input file
--scale multiply PCM input by
--scale-l scale channel 0 (left) input (multiply PCM data) by
--scale-r scale channel 1 (right) input (multiply PCM data) by
-a downmix stereo input file to mono .mp3
-e n/5/c de-emphasis
-p add CRC error protection
-c mark the encoded file as copyrighted
-o mark the encoded file as a copy
-S don't print progress report, VBR histogram
--strictly-enforce-ISO comply as much as possible to ISO MPEG spec
--replaygain-fast compute RG fast but slightly inaccurately (default)
--replaygain-accurate compute RG more accurately and find the peak sample
--noreplaygain disable ReplayGain analysis
--clipdetect enable --replaygain-accurate and print a message whether
clipping occurs and how far the waveform is from full scale
--decode assume input file is an mp3 file, and decode to wav.
-t disable writing of WAV header when using --decode
(decode to raw pcm, native endian format (use -x to swap))
ID3 tagging:
--tt audio/song title (max 30 chars for version 1 tag)
--ta audio/song artist (max 30 chars for version 1 tag)
--tl audio/song album (max 30 chars for version 1 tag)
--ty audio/song year of issue (1 to 9999)
--tc user-defined text (max 30 chars for v1 tag, 28 for v1.1)
--tn