LAME MP3 Encoder Native Input Formats

This article provides a direct overview of the uncompressed input audio formats natively supported by the standalone LAME command-line binary. You will learn about the specific container formats the encoder can read without relying on external decoding libraries, as well as the requirements for processing raw audio streams.

The standalone LAME command-line tool natively supports three primary uncompressed audio input formats:

1. Microsoft WAV (RIFF)

LAME natively parses standard RIFF WAV files. This is the most common input format. The binary automatically reads the WAV header to determine essential audio properties, including: * Sample rate (e.g., 44.1 kHz, 48 kHz) * Bit depth (e.g., 16-bit, 24-bit, or 32-bit integer/float) * Number of channels (mono or stereo)

2. Apple/SGI AIFF

Audio Interchange File Format (AIFF and uncompressed AIFC) files are also supported natively. Similar to WAV files, LAME reads the AIFF header automatically to extract the sample rate, channel count, and bit depth without requiring manual user input.

3. Raw PCM (Pulse-Code Modulation)

LAME can accept raw, headerless PCM audio data. Because raw PCM files lack a header to describe the audio structure, you must explicitly tell the LAME binary the format of the incoming data using command-line switches. Key parameters include: * -r: Tells LAME the input is raw PCM. * -s: Defines the sample rate in kHz (e.g., -s 44.1). * --bitwidth: Defines the bit depth (e.g., --bitwidth 16 or --bitwidth 24). * -m: Defines the channel mode (e.g., -m s for stereo, -m m for mono).

Note on External Libraries

While LAME can sometimes accept other formats like FLAC or Ogg, this capability is not native to the core LAME codebase. It requires the LAME binary to be compiled with external helper libraries, such as libsndfile. Without these external dependencies, the standalone LAME binary is strictly limited to native WAV, AIFF, and raw PCM inputs.