Introduction
AAC is the lossy audio codec of the MPEG-2 and MPEG-4 standards, designed as the successor to MP3. At the same bit rate it usually sounds better. It is the standard audio of the iTunes Store and Apple Music, YouTube, digital television and most phones, and comes in several profiles, such as AAC-LC and the lower-rate HE-AAC.
AAC audio reaches users in two kinds of file. A .aac file is usually a
raw stream of ADTS frames. An .m4a file holds AAC inside an MPEG-4
container with tags and cover art; the same extension is used for Apple
Lossless.
Structure
An ADTS stream is a run of frames, each with its own header so a player can start
anywhere. The header is 7 bytes, or 9 with a CRC. It starts with a 12-bit sync word of
ones (FFF), then gives the MPEG version, whether a CRC is present, the
profile, a sampling-rate index, the channel configuration and the 13-bit frame length
including the header. The compressed audio follows. Each AAC frame normally decodes to
1024 samples per channel.
In an .m4a file the frames carry no headers. They sit in an
mdat box, and the moov box holds the codec settings (in an
mp4a sample entry), the sample tables and the tags.
0ADTS frame repeated to the end of the streamvaries+0Header sync, profile, rate index, channels, frame length7 or 9 bytes+7Raw data one AAC frame, 1024 samples per channelvaries
The reference pages cover every part of the format:
- ADTS frames – the header of a raw .aac file, field by field
- ADIF header – the rarer single-header .aac transport
- LATM and LOAS – the broadcast transport and its multiplex configuration
- AudioSpecificConfig – the configuration record, with every object type
- Raw data blocks – the audio elements, codebooks, TNS, gain control and extensions
- SBR and PS – the HE-AAC and HE-AAC v2 extensions
- M4A files – the mp4a sample entry, esds box and iTunes tags
The site’s file explorer opens .aac files (ADTS and ADIF) and
.latm and .loas streams: it shows every header field, each raw
data block down to its elements and fields, the SBR and parametric stereo data, and plays
the sound. It also plays AAC inside WAV files. The decoder is
explorer/formats/shared/audio/aac.js; it reads ADTS, ADIF, LOAS/LATM and
raw frames with an AudioSpecificConfig, and decodes AAC Main, LC and LTP, the
error-resilient LC, LTP and Low Delay types, HE-AAC (SBR) and HE-AAC v2 (parametric
stereo). Its output matches FFmpeg’s to within float rounding on every stream tested.
AAC SSR, the scalable types and the error-resilience tools are named but
not decoded: their decoding is set out only in the paid ISO standards. ER AAC ELD is
decoded, with low-delay SBR and, for ELD v2, the low-delay MPEG Surround 212 upmix to
stereo (checked against Apple’s decoder; the CAF overview has the numbers and what
does not yet agree).
Not described
Known, not yet covered
- Reference: AAC is specified in ISO/IEC 14496-3, a paid specification; these pages follow public descriptions and decoder source.
- Reference and viewer: the AAC object types not decoded here: SSR,
Scalable, TwinVQ, BSAC, the error-resilience tools,
epConfigabove 0, SBR with 960-sample frames, and USAC. They are named and shown as labelled bytes. - Viewer: Main-profile prediction, LTP, coupling channels, 34-band parametric stereo with IPD/OPD, and downsampled SBR are decoded but not checked against a reference, since no encoder here writes them.
- Viewer: a frame’s SBR and parametric-stereo data can only be read after an SBR header; if none is found in the 64 blocks before it, that frame’s SBR data shows as “not read”.
Unknown
- Reference and viewer: the window that AAC-ELD uses with 1,920 coefficients, which is not public.
Also used for
- Apple Lossless Audio Codec – Apple’s lossless codec, stored in an MPEG-4 .m4a file like AAC.
Links
Software
- Apple Music – Apple’s music app, which plays AAC and uses it for its own downloads (macOS, Windows, iOS)
- VLC media player – free player for almost any audio or video file (Windows, macOS, Linux, mobile)
- foobar2000 – free music player and converter (Windows, macOS, mobile)
- Audacity – free audio editor that opens and exports AAC through the FFmpeg library (Windows, macOS, Linux)
- FFmpeg – command-line tool that encodes and decodes AAC (Windows, macOS, Linux)
Developers
Reference
- ADTS – MultimediaWiki’s notes on the frame header
- MPEG-4 Audio – MultimediaWiki’s list of object types, rates and channel layouts
- ISO/IEC 13818-7 and ISO/IEC 14496-3 – the MPEG-2 AAC and MPEG-4 Audio standards (paid)
- ETSI TS 126 401 – 3GPP’s description of Enhanced aacPlus (AAC LC with SBR and parametric stereo), with the encoder in TS 126 403 and 126 404 and extra decoder tools in TS 126 402