Introduction
Apple Lossless (ALAC) is Apple’s lossless audio codec, introduced in 2004 for iTunes and the iPod. Like FLAC it decodes to exactly the original samples, at roughly half the size of uncompressed audio. Apple published the encoder and decoder as open source in 2011, and the format is now royalty-free.
ALAC has no file format of its own. It is almost always stored in an MPEG-4 file with
the extension .m4a, the same extension used for AAC, so the extension
alone does not say whether a file is lossless. It can also be stored in a CAF
file.
Structure
An ALAC .m4a file is an MPEG-4 file made of boxes, each a 32-bit size and
a four-character type. It starts with an ftyp box, usually with the brand
M4A . The moov box describes the track: inside its sample
description (stsd) is an alac entry carrying the codec’s
settings, such as frame length, bit depth, channel count and sample rate. The sample
tables give the size and position of every frame. The encoded frames themselves sit
in an mdat box, and tags are stored as iTunes metadata in
moov.
0ftyp file type and brandsvaries…moov track, alac settings, sample tables, tagsvaries…mdat encoded ALAC framesvaries
Also used for
- AAC audio in MPEG-4 – MP3’s successor: ADTS frames in .aac, or MPEG-4 boxes in .m4a.
Links
Software
- Apple Music – Apple’s music app, which rips CDs to ALAC and plays it (macOS, Windows, iOS)
- foobar2000 – free music player and converter (Windows, macOS, mobile)
- VLC media player – free player for almost any audio or video file (Windows, macOS, Linux, mobile)
- FFmpeg – command-line tool that encodes and decodes ALAC (Windows, macOS, Linux)
Developers
- Apple Lossless Audio Codec – Apple’s open-source encoder and decoder (C++)
- Mutagen – library that reads and writes MP4 tags (Python)