AAC: Advanced Audio Coding — The Format Behind Every MP4 and iPhone
AAC (Advanced Audio Coding) is the audio codec embedded in virtually every video you have watched online and every song stored on an iPhone. It is the default audio format in MP4 containers, the standard for iTunes/Apple Music, YouTube, Instagram, TikTok, and streaming platforms globally. Understanding AAC's profiles, quality settings, and container variants is fundamental for anyone working with digital media.
What Is AAC?
AAC was developed as the successor to MP3 by a joint effort of Fraunhofer (MP3's creators), AT&T Bell Labs, Dolby Laboratories, Sony, and Nokia. It was standardized as ISO/IEC 13818-7 (MPEG-2 AAC, 1997) and enhanced as ISO/IEC 14496-3 (MPEG-4 Audio, 1999). Apple adopted it as the iTunes standard in 2003, which drove rapid ecosystem adoption.
At equal bitrates, AAC delivers noticeably better quality than MP3, particularly:
- At low bitrates (64–96 kb/s): AAC is dramatically clearer
- Stereo imaging: AAC uses joint stereo more effectively
- High frequencies: AAC's filterbank better preserves frequencies above 15 kHz (MP3 often cuts these)
AAC Profiles
AAC is not a single codec — it is a family of profiles:
| Profile | Full Name | Bitrate Range | Best For |
|---|---|---|---|
| AAC-LC | Low Complexity | 64 – 320 kb/s | Music, podcasts, general audio |
| HE-AAC v1 | High Efficiency + SBR | 24 – 64 kb/s | Streaming, radio, low-bandwidth |
| HE-AAC v2 | HE-AAC + PS | 12 – 32 kb/s | Very low bitrate streaming |
| AAC-LD | Low Delay | 32 – 128 kb/s | Real-time communication |
| AAC-ELD | Enhanced Low Delay | 16 – 64 kb/s | VoIP, FaceTime |
| xHE-AAC | Extended HE-AAC (USAC) | 6 – 128 kb/s | Adaptive streaming, podcasts |
AAC-LC is the baseline used everywhere. HE-AAC adds Spectral Band Replication (SBR): the encoder transmits only the lower half of the spectrum and includes a compact description of the upper half; the decoder reconstructs the highs synthetically. HE-AAC v2 additionally adds Parametric Stereo (PS): stereo is encoded as mono + stereo parameters, halving the stereo data.
AAC Container Formats
AAC audio is wrapped in different containers:
| Extension | Container | Contents | Use |
|---|---|---|---|
.m4a |
ISOBMFF/MP4 | AAC-LC or HE-AAC | Apple Music, iTunes downloads |
.aac |
ADTS (raw) | AAC-LC | Streaming, some broadcast |
.mp4 |
ISOBMFF | Video + AAC audio | Video files |
.m4b |
ISOBMFF | AAC + chapter marks | Audiobooks (iTunes) |
.m4r |
ISOBMFF | Short AAC clip | iPhone ringtones |
.3gp |
3GPP | AAC + H.263 video | Mobile video (legacy) |
.m4a is the standard Apple/lossless audio container for AAC. .aac (ADTS) is a bare bitstream with sync words — simpler to parse but no metadata. Always prefer .m4a for music storage.
Converting to AAC with FFmpeg
# MP3/WAV/FLAC → AAC-LC at 256 kb/s (iTunes quality)
ffmpeg -i input.flac -c:a aac -b:a 256k output.m4a
# AAC-LC using FDK AAC (higher quality encoder — needs separate compilation)
ffmpeg -i input.flac -c:a libfdk_aac -b:a 256k output.m4a
# HE-AAC v1 (streaming, 48 kb/s)
ffmpeg -i input.mp3 -c:a libfdk_aac -profile:a aac_he -b:a 48k output.m4a
# HE-AAC v2 (very low bitrate, 32 kb/s stereo)
ffmpeg -i input.mp3 -c:a libfdk_aac -profile:a aac_he_v2 -b:a 32k output.m4a
# VBR mode (variable bitrate — use quality scale 1-5, lower=better)
ffmpeg -i input.flac -c:a libfdk_aac -vbr 4 output.m4a
# VBR modes: 1=~32 kb/s 2=~40 kb/s 3=~96 kb/s 4=~128 kb/s 5=~192 kb/s
# Extract audio from MP4 without re-encoding (copy)
ffmpeg -i input.mp4 -c:a copy -vn output.m4a
# Convert M4A to MP3
ffmpeg -i input.m4a -c:a libmp3lame -q:a 2 output.mp3
# Convert M4A to FLAC (lossless decode of AAC)
ffmpeg -i input.m4a -c:a flac output.flac
# Normalize audio + encode AAC
ffmpeg -i input.wav \
-af "loudnorm=I=-16:TP=-1.5:LRA=11" \
-c:a libfdk_aac -b:a 192k output.m4a
AAC Encoder Quality: Built-in vs FDK AAC
FFmpeg includes a built-in AAC encoder (-c:a aac) and optionally can use libfdk_aac (Fraunhofer Development Kit — the reference encoder). Quality ranking:
- libfdk_aac VBR 5 — best quality (requires building FFmpeg with
--enable-libfdk-aac) - libfdk_aac CBR 256 kb/s — very high quality
- FFmpeg native aac 256 kb/s — good but audibly inferior to fdk at low bitrates
- qaac (Apple's encoder, macOS/Windows) — arguably the best CBR encoder
At high bitrates (192+ kb/s), the difference between encoders is minimal. At 128 kb/s and below, libfdk_aac or qaac outperform FFmpeg's native encoder significantly.
Python: Converting AAC with Pydub and Mutagen
from pydub import AudioSegment
import mutagen.mp4
# Convert MP3 to M4A (AAC) using pydub
audio = AudioSegment.from_mp3("input.mp3")
audio.export("output.m4a", format="mp4",
codec="aac", bitrate="192k",
parameters=["-strict", "-2"]) # Allow experimental AAC
# Read M4A metadata with mutagen
tags = mutagen.mp4.MP4("input.m4a")
print(f"Title: {tags.get('©nam', ['?'])[0]}")
print(f"Artist: {tags.get('©ART', ['?'])[0]}")
print(f"Album: {tags.get('©alb', ['?'])[0]}")
print(f"Year: {tags.get('©day', ['?'])[0]}")
print(f"Genre: {tags.get('©gen', ['?'])[0]}")
# Write M4A metadata
tags['©nam'] = ['My Song Title']
tags['©ART'] = ['Artist Name']
tags['©alb'] = ['Album Name']
tags['©day'] = ['2024']
tags.save()
# Check AAC stream properties
audio_info = mutagen.mp4.MP4("input.m4a").info
print(f"Duration: {audio_info.length:.1f}s")
print(f"Bitrate: {audio_info.bitrate} kb/s")
print(f"Channels: {audio_info.channels}")
print(f"Sample rate: {audio_info.sample_rate} Hz")
AAC Quality Comparison
Approximate quality thresholds (AAC-LC stereo, FDK encoder):
| Bitrate | Quality | Notes |
|---|---|---|
| 320 kb/s | Transparent | Indistinguishable from original |
| 256 kb/s | Transparent | iTunes Plus standard (2007) |
| 192 kb/s | Near-transparent | Excellent for most content |
| 128 kb/s | High quality | Standard streaming (Spotify 128) |
| 96 kb/s | Good | Acceptable for casual listening |
| 64 kb/s | Fair | Noticeable artifacts on critical listening |
| 48 kb/s HE-AAC | Good | Broadcast radio quality |
| 32 kb/s HE-AAC v2 | Fair | Streams intelligibly |
AAC vs MP3 vs Opus vs FLAC
| Feature | MP3 | AAC-LC | Opus | FLAC |
|---|---|---|---|---|
| Standard | ISO (MPEG-1/2) | ISO (MPEG-2/4) | IETF RFC 6716 | Xiph |
| Patent status | Free (expired 2017) | Licensed (Fraunhofer) | Royalty-free | Open source |
| Quality @ 128 kb/s | Good | Better | Best | N/A (lossless) |
| Quality @ 64 kb/s | Fair | Good | Excellent | N/A |
| Channels | Up to 2 (stereo) | Up to 48 | Up to 255 | Up to 8 |
| Bit depth | 16-bit | 16/24-bit | 16-bit float | 8–32 bit |
| Device support | Universal | Near-universal | Good (Android/web) | Medium |
| Container | .mp3 (raw) | .m4a / .mp4 | .opus / .webm | .flac |
| Streaming latency | ~100 ms | ~100 ms | ~5–26 ms | Not for streaming |
Common AAC Scenarios
Archiving music from CDs: Rip to FLAC first (lossless), then optionally transcode to AAC-LC 256 kb/s for device copies. Never transcode lossy-to-lossy.
Podcast publishing: AAC-LC mono 64–96 kb/s for voice-only content. Stereo only if you have music beds.
iPhone ringtone creation: Convert any audio to AAC, wrap in M4A, rename to .m4r, import to iTunes. Duration must be ≤40 seconds.
YouTube upload: YouTube re-encodes audio to AAC 128 kb/s or Opus 128 kb/s regardless of what you upload. Upload at 256 kb/s+ to avoid double-encoding degradation at frequencies above 16 kHz.
Summary
AAC is the dominant audio codec of the streaming era — embedded in every MP4, M4A, and iTunes purchase. Its superior quality versus MP3 at low bitrates, combined with wide hardware support (virtually all modern devices include hardware AAC decoders), makes it the practical choice for any audio that needs to be compatible with Apple ecosystem, YouTube, or broadcast TV. For new applications where Apple-compatibility is not a constraint, Opus offers better quality at lower bitrates, but AAC remains irreplaceable for M4A file storage and MP4 video audio tracks.
Related conversions
Common video conversions that pair well with this guide: