LinuxCommandLibrary

lame

Encode audio files into MP3 format

TLDR

Encode an audio file to MP3 using CBR 320 kbit/second

$ lame -b 320 [path/to/file].wav [path/to/output].mp3
copy

Encode an audio file to MP3 using the V0 preset
$ lame -V 0 [path/to/file].wav [path/to/output].mp3
copy

Encode an audio file to AAC
$ lame [path/to/file].wav [path/to/output].aac
copy

SYNOPSIS

lame [options] input_file [output_file]

Example:
lame audio.wav audio.mp3
Example: lame --preset standard input.flac output.mp3
Example: cat input.pcm | lame -r -s 44.1 - output.mp3

PARAMETERS

-h, --help
    Display a brief usage message and exit.

-v, --version
    Display the LAME version number and exit.

-r, --raw-input
    Input is raw PCM (WAV header not present).

--raw-input-smpfreq
    Specify raw input sample frequency (e.g., 44.1 for 44100 Hz).

--mp3input
    Input file is an MP3 file. LAME will decode it and then re-encode it.

-b
    Specify Constant Bitrate (CBR) in kbps (e.g., -b 128).

-V
    Specify Variable Bitrate (VBR) quality (0=highest, 9=lowest).

-q
    Specify algorithm quality (0=best, 9=fastest). Usually set by presets.

--preset
    Use predefined quality presets (e.g., --preset standard, --preset extreme).

-m
    Set stereo mode (s=stereo, j=joint stereo, m=mono, a=auto).

--silent
    Don't print any processing info, only warnings or errors.

-x
    Swap bytes in the input file (for big-endian machines).

--lowpass
    Apply a lowpass filter at freq Hz.

--highpass
    Apply a highpass filter at freq Hz.

DESCRIPTION

LAME (Lame Ain't an MP3 Encoder) is a widely used, open-source software encoder for converting audio into the MP3 format (MPEG-1 Audio Layer III).
It began as a research project to improve the psychoacoustic model and quality of other existing MP3 encoders. Over time, it evolved into a powerful, standalone command-line tool, renowned for its superior audio quality, especially at lower bitrates, and its rich set of encoding options.
LAME implements various encoding modes, including Constant Bitrate (CBR), Average Bitrate (ABR), and Variable Bitrate (VBR), allowing users to balance file size and audio fidelity.
It's frequently used by audiophiles, developers, and integrated into many multimedia applications and frameworks like FFmpeg and Audacity, making it a cornerstone in digital audio processing.

CAVEATS

While LAME is widely used and highly regarded, users should be aware of past MP3 patent issues. Although most relevant patents have expired, some countries may still have specific intellectual property laws that could affect commercial use. Always verify the legal status in your jurisdiction.
Additionally, LAME's extensive array of options can be overwhelming for new users; using the recommended --preset options is often the best starting point for quality encoding without deep dives into technical specifics.

MP3 PRESETS

LAME offers convenient --preset options that automatically configure multiple encoding parameters for optimal quality-to-filesize ratios.
Common presets include:
--preset standard: Very good quality, suitable for most uses.
--preset extreme: Higher quality, larger file sizes.
--preset insane: Maximum quality (CBR 320kbps), largest files.
--preset fast: Faster encoding, slightly lower quality than standard.
These presets simplify the encoding process, allowing users to achieve excellent results without needing to understand every technical option.

LICENSE

LAME is distributed under the GNU Lesser General Public License (LGPL), which allows it to be linked with proprietary applications provided certain conditions are met. This open-source licensing has contributed significantly to its widespread adoption and integration into various commercial and non-commercial software products.

HISTORY

The LAME project was started by Mike Cheng in 1998 as a set of improvements (patches) to an existing MP3 encoder called 8hz-mp3. The goal was to enhance its psychoacoustic model, which is crucial for achieving high audio quality at lower bitrates by intelligently discarding inaudible information.
As the project grew and became more sophisticated, it evolved into a standalone encoder. The development focus shifted towards continuous quality improvements, especially for variable bitrate (VBR) encoding, and implementing a more accurate psychoacoustic model.
LAME quickly surpassed other available MP3 encoders in terms of sound quality and became the de facto standard for MP3 encoding due to its open-source nature, continuous development, and commitment to delivering the best possible audio fidelity.

SEE ALSO

ffmpeg(1), sox(1), oggenc(1), flac(1), mpv(1)

Copied to clipboard