FLAC
An open, lossless audio coding and file format that reduces the size of PCM data through prediction and residual coding, and can restore the original samples after decoding.
Explanation
FLAC (Free Lossless Audio Codec, 自由无损音频编解码器) is an open, lossless encoding format for digital audio, initiated by Josh Coalson. The reference implementation was first released in 2001 and is now maintained by Xiph.Org. The FLAC stream specification is now fully described in RFC 9639. It refers both to the audio encoding method and to the stream and metadata structures used in native `.flac` files.
Lossless means that the decoded PCM samples match the encoder’s input exactly; it does not imply that the file is uncompressed. FLAC divides the audio into frames and subframes. For each channel, it selects one of several encoding methods—constant, run-length, fixed prediction, or linear prediction—and stores the prediction residuals using Rice coding. For stereo, left, right, center-side, or differential channel allocation can be used to reduce inter-channel redundancy. The encoding level primarily affects the time required for prediction look-up, blocking, and compression; it should not alter the audio data after correct decoding.
The native stream begins with the `fLaC` identifier, followed by the required STREAMINFO block, optional metadata blocks, and audio frames. The STREAMINFO block stores information such as sample rate, number of channels, effective bit depth, and total number of samples, and may include an MD5 checksum of the uncompressed audio; Other blocks may carry Vorbis Comment tags, cover art, index points, CUE sheets, and padding. The frames themselves contain synchronization and checksum information, facilitating streaming decoding and, to a certain extent, error localization.
FLAC is not an alias for WAVE or ZIP. WAVE is a RIFF file that can encapsulate PCM or other formats, whereas FLAC builds predictive models based on audio samples; general-purpose compressors typically struggle to take advantage of the continuous correlations in audio. FLAC can also be embedded within Ogg or Matroska containers; in such cases, the file structure differs from that of native `.flac` files, though the internal audio is still decoded according to FLAC rules.
Re-encoding lossless FLAC at different compression levels allows you to adjust file size and encoding speed without altering the sample data. Converting lossy sources such as MP3 or AAC to FLAC will only losslessly preserve the already decoded result; it cannot recover content discarded from the original bitstream. An increase in file size does not constitute proof that the source was a lossless master. Checksums can detect data changes but cannot verify the authenticity of the recording, master, or prior processing.