.FLAC
Free Lossless Audio Codec
Introduction
FLAC is an open, royalty-free format for lossless audio compression. A FLAC file usually takes around half the space of the same audio as WAV, and decodes back to exactly the original samples. It is maintained by the Xiph.Org Foundation and is specified by the IETF in RFC 9639.
FLAC is widely used for music downloads, CD rips and archives, where sound quality must be kept and file size still matters. Tags such as artist and title, and cover art, are stored inside the file.
Software
- FLAC reference tools (Windows, macOS, Linux)
- foobar2000 (Windows, macOS, mobile)
- VLC media player (Windows, macOS, Linux, mobile)
- Audacity (Windows, macOS, Linux)
- MusicBee (Windows)
- FFmpeg (Windows, macOS, Linux)
Structure
A FLAC file starts with the four bytes fLaC. Metadata blocks follow,
each with a one-byte header (a flag marking the last block, then a 7-bit block type)
and a 24-bit big-endian length. The first block is always STREAMINFO,
which gives the sample rate, channel count, bits per sample, total number of samples
and an MD5 checksum of the decoded audio. Other blocks hold padding, a seek table,
Vorbis comment tags, a cue sheet and pictures.
The audio follows as a series of frames. Each frame starts with a 14-bit sync code and a header, holds one subframe per channel and ends with a CRC-16 checksum.
0fLaC stream marker4 bytes4STREAMINFO block header and stream properties38 bytes42Metadata blocks seek table, tags, pictures, paddingvaries…Frames header, one subframe per channel, CRC-16repeated