Skip to content

AAC

currentMigrated from docs/audio/AAC.mdx at 37c3317fd058; modified for Encode Wiki · CC BY-SA 4.0

AAC is a family of lossy MPEG audio profiles. “AAC” on its own almost always means AAC-LC, the profile every phone, player, TV and browser can decode. It is the right default whenever the file has to play everywhere: MP4 video, iTunes/Apple Music, Bluetooth, broadcast. If compatibility is not a constraint, Opus is usually the better lossy codec.

Profile What it is When to use it
AAC-LC The standard profile. Default for everything from about 96 kbit/s stereo up.
HE-AAC (v1) LC core at half the sample rate plus Spectral Band Replication (SBR), which rebuilds the high frequencies from side data. Stereo below roughly 64 kbit/s, e.g. streaming and spoken word. Above ~96 kbit/s, plain LC is as good or better.
HE-AAC v2 HE-AAC plus Parametric Stereo (PS), which codes stereo as a mono downmix plus spatial parameters. Stereo at 32 kbit/s and below. Stereo only.
AAC-LD / AAC-ELD Low-delay variants for conferencing. Real-time use. Almost no file or player support; encoded by FDK-AAC and Apple’s encoder.
xHE-AAC (USAC) MPEG-D USAC with MPEG-D DRC loudness metadata; handles speech and music well at very low rates. Low-rate streaming where you control the player. exhale is the only free encoder.

xHE-AAC is natively decodable on current Android, Apple (iOS, macOS, tvOS, watchOS) and Windows 11 platforms, but not in most other players, and FFmpeg’s decoder does not handle every stream (see exhale). Keep an AAC-LC version if you cannot control the player.

In MP4, the profile is signalled by the codec string: mp4a.40.2 (LC), mp4a.40.5 (HE-AAC), mp4a.40.29 (HE-AAC v2), mp4a.40.42 (xHE-AAC). HE-AAC decoders output at double the core sample rate, which matters if you handle the decoded audio yourself.

Encoder Profiles Notes
Apple Core Audio LC, HE-AAC, LD, ELD (FFmpeg’s aac_at also requests HE-AAC v2; qaac has no v2 mode) Generally regarded by the Hydrogenaudio community as the best AAC encoder. Use qaac on Windows, afconvert or FFmpeg’s aac_at on macOS.
FDK-AAC (fdkaac, libfdk_aac) LC, HE-AAC, HE-AAC v2, LD, ELD Close to Apple at typical rates and available everywhere. Its license is GPL-incompatible: an FFmpeg build that also uses --enable-gpl (as any build with x264 or x265 does) needs --enable-nonfree and cannot be redistributed, so most downloadable builds leave it out. The standalone fdkaac tool avoids building FFmpeg yourself.
FFmpeg native aac LC Free and built into every FFmpeg. Behind Apple and FDK, most noticeably at low bitrates; give it more bitrate (160–192 kbit/s stereo) to compensate. Use -b:a: its -q:a VBR mode works but has no calibrated scale.
exhale xHE-AAC See above.

FAAC and the discontinued Nero encoder still turn up in old guides; there is no reason to use either today.

For stereo music the usual targets are 128 kbit/s for small files, 160–192 kbit/s for a comfortable margin, and 256 kbit/s as overkill insurance. Bitrate is the total for all channels.

Terminal window
# FFmpeg native encoder
ffmpeg -i input.flac -c:a aac -b:a 192k output.m4a
# FDK-AAC through the standalone tool: VBR 4 is roughly 150 kbit/s for stereo
fdkaac -m 4 -o output.m4a input.wav
# FDK-AAC through an FFmpeg build that includes libfdk_aac
ffmpeg -i input.flac -c:a libfdk_aac -vbr 4 output.m4a
# Apple encoder through qaac (Windows), true VBR around 190 kbit/s
qaac64 --tvbr 91 -o output.m4a input.wav

FDK’s VBR modes 1–5 target roughly 32, 40, 48–56, 64 and 80–96 kbit/s per channel; FFmpeg documents its libfdk_aac VBR as experimental, and it is only dependable with AAC-LC. For HE-AAC, use a plain bitrate:

Terminal window
fdkaac -p 5 -b 64000 -o he-aac.m4a input.wav
fdkaac -p 29 -b 32000 -o he-aac-v2.m4a input.wav

fdkaac reads WAV or raw PCM (-R), not FLAC; pipe from FFmpeg with ffmpeg -i input.flac -f wav - | fdkaac -m 4 -o output.m4a -. Its -b takes bit/s, and -m 1–5 selects VBR and overrides -b.

Container Notes
MP4/M4A The normal choice. Stores the profile and encoder delay, so gapless playback works. Add -movflags +faststart for web delivery.
ADTS (.aac) Raw frames with a header on each. Needed by some hardware and streaming tools; carries no tags or gapless information. fdkaac -f 2 writes it.
LATM/LOAS Broadcast transport (fdkaac -f 10, libfdk_aac -latm 1).
MPEG-TS, Matroska Fine for video; check the player.

Neither .aac nor .m4a tells you the profile. Run ffprobe on the file if you need to know.

For gapless playback in iTunes-style players, keep the encoder-delay metadata (fdkaac -G 2 writes both the iTunes and ISO forms; qaac does this by default). Do not trim decoded samples by hand.

  • Re-encoding an AAC (or any lossy) source stacks artefacts. Encode from the lossless original.
  • Downmixing with -ac 1 or -ac 2 can cause phase cancellation on some mixes; check by ear.

Opus for open, royalty-free lossy audio. FLAC for lossless. Vorbis in older Ogg/WebM workflows.

Every option of the encoders above in FFmpeg 9.0.2 and fdkaac 1.0.9 (with FDK-AAC 2.0.3). Defaults are what you get when the option is omitted.

Private options of the native aac encoder. The anmr coder and the aac_pred/aac_ltp options in older guides no longer exist.

Parameter Default Values / units Effect
-aac_coder twoloop twoloop, fast Quantizer search. twoloop gives the best quality; fast is quicker and worse.
-aac_ms auto auto, 0, 1 Mid/side stereo. auto decides per band, 1 forces M/S on every band, 0 disables it. Always off for more than three channels.
-aac_is 1 0/1 Intensity stereo: codes some high bands as one channel plus a position. Saves bits at low bitrates.
-aac_pns 1 0/1 Perceptual noise substitution: replaces noise-like bands with synthesized noise. Turned off for -profile:a mpeg2_aac_low.
-aac_tns 1 0/1 Temporal noise shaping; reduces pre-echo on transients.
-aac_pce 0 0/1 Signal the channel layout with a Program Config Element even for standard layouts. Non-standard layouts always get one.

Generic audio controls used by AAC encoders

Section titled “Generic audio controls used by AAC encoders”
Parameter Native aac libfdk_aac Notes
-profile:a aac_low (default), mpeg2_aac_low aac_low (default), aac_he, aac_he_v2, aac_ld, aac_eld, mpeg2_aac_low, mpeg2_aac_he The native encoder can’t do HE-AAC or xHE-AAC.
-b:a 128k per channel pair, 69k per single channel, 16k per LFE (128k stereo) About 96k mono or 128k stereo at 44.1 kHz, scaled with sample rate; halved for HE-AAC Total bitrate for all channels.
-q:a Constant quality: fixed quantizer, no rate control 1–5, same as -vbr Selects VBR instead of -b:a. Higher means more bits.
-cutoff Encoder chooses Library chooses; at most 20000 Hz Low-pass in Hz.
-ar 7350–96000 Hz (the 13 AAC rates) Depends on profile FFmpeg resamples to a supported rate.
-sample_fmt fltp s16 Input format; FFmpeg converts automatically.

Private options of the FFmpeg 9.0.2 libfdk_aac wrapper. It needs FFmpeg built with --enable-libfdk-aac (non-free, so not in most distributed builds).

Parameter Default Values / units Effect
-afterburner 1 0/1 Extra analysis for better quality at some CPU cost. Leave it on.
-eld_sbr 0 0/1 Enable SBR with -profile:a aac_eld. HE-AAC gets SBR from -profile:a aac_he/aac_he_v2.
-eld_v2 0 0/1 ELDv2 (LD-MPS) for stereo AAC-ELD. Only present when FFmpeg is built against fdk-aac 2.0 or later.
-signaling default default, implicit, explicit_sbr, explicit_hierarchical How SBR/PS are signalled. default uses explicit_hierarchical when the muxer stores a global header (MP4, Matroska) and implicit for ADTS/LATM.
-latm 0 0/1 Write LOAS/LATM instead of ADTS when the muxer doesn’t use a global header. No effect for MP4 or Matroska.
-header_period 0 0–65535 frames With -latm 1, repeat the StreamMuxConfig/PCE every N frames. 0 keeps the library default.
-vbr 0 0–5 0 uses -b:a. 1–5 are FDK’s VBR modes; its documented stereo averages are about 32 (HE-AAC v2), 72 (HE-AAC), 112, 148 and 228 kbit/s. FFmpeg warns that VBR only works with some parameter combinations.
-drc_profile 0 0 none, 1 film standard, 2 film light, 3 music standard, 4 music light, 5 speech MPEG-4 DRC profile written as metadata for the decoder; the encoded audio is unchanged.
-drc_target_ref 0 Integer dB, -31–0 Target reference level for -drc_profile.
-comp_profile 0 Same as -drc_profile ETSI heavy-compression profile; only written when -drc_profile is non-zero.
-comp_target_ref 0 Integer dB, -31–0 Target reference level for -comp_profile.
-prog_ref 0 Integer dB, -31–0 Programme (dialogue) reference level metadata. 0 means it is not written.
-frame_length -1 1024 (LC, HE), 512/480 (LD, ELD), 256/240/128/120 (downscaled ELD) Core frame length in samples. -1 keeps the profile default.

Standalone fdkaac 1.0.9 parameter reference

Section titled “Standalone fdkaac 1.0.9 parameter reference”

fdkaac is a separate command-line frontend to FDK-AAC; its options and units differ from FFmpeg’s wrapper. Its help lists --header-period as -h, but the working short form is -P (-h prints help).

Parameter Default Values / units Effect
-p, --profile N 2 2 AAC-LC, 5 HE-AAC, 29 HE-AAC v2, 23 AAC-LD, 39 AAC-ELD Audio object type.
-b, --bitrate N None; required unless -m is 1–5 bit/s; values below 10000 are read as kbit/s CBR target. -b 128 and -b 128000 are the same.
-m, --bitrate-mode N 0 0 CBR, 1–5 VBR VBR modes ignore -b. Mode 1 is tuned for HE-AAC v2, 2 for HE-AAC, 3–5 for AAC-LC; FDK’s documented stereo averages are about 32, 72, 112, 148 and 228 kbit/s.
-w, --bandwidth N 0 (auto) Hz Low-pass frequency, AAC-LC only. At most 20 kHz or half the sample rate; the automatic choice is usually better.
-a, --afterburner N 1 0/1 Extra analysis for better quality. Leave it on.
-L, --lowdelay-sbr N 0 -1 auto, 0 off, 1 on SBR for AAC-ELD.
-s, --sbr-ratio N 0 (library default) 0, 1 downsampled, 2 dual-rate SBR sampling ratio. The library defaults to downsampled SBR for ELD+SBR and dual-rate for HE-AAC.
-f, --transport-format N 0 (M4A) 0 M4A, 1 ADIF, 2 ADTS, 6 LATM MCP=1, 7 LATM MCP=0, 10 LOAS/LATM Anything other than 0 writes a raw AAC stream (default extension .aac) instead of M4A.
-C, --adts-crc-check Off Flag Add CRC protection to ADTS headers.
-P, --header-period N 0 (library default) Frames StreamMuxConfig/PCE repetition period for LATM/LOAS.
-o FILE Input name with .m4a, or .aac if -f is not 0 Filename; - (stdout) only when -f is not 0 Output file. M4A output must be seekable.
-G, --gapless-mode N 0 0 iTunSMPB, 1 ISO (edts + sgpd), 2 both How encoder delay and padding are signalled in M4A.
--include-sbr-delay Off Flag Count the SBR decoder delay in the signalled encoder delay. This is FDK’s own convention but is not iTunes-compatible.
--moov-before-mdat Off Flag Put the moov index before the audio data, for progressive playback.
--no-timestamp Off Flag Write zero creation/modification times, for reproducible output.
Parameter Default Values / units Effect
-h, --help — Flag Print the version and help, then exit.
-I, --ignorelength Off Flag Ignore the WAV data-chunk length, for WAV piped from tools that write a placeholder length.
-S, --silent Off Flag No progress output.
-R, --raw Off Flag Read headerless PCM described by the --raw-* options instead of WAV or CAF.
--raw-channels N 2 Channel count Raw channel count.
--raw-rate N 44100 Hz Raw sample rate.
--raw-format SPEC S16L S or U with 8–32 bits, or F with 32/64; then L or B Raw sample format, case-insensitive (S24L, F32L). Endianness defaults to little.

M4A tags. Tags from the input file are copied; these options set or override them.

Parameter Default Values / syntax Effect
--title TEXT — Text Title.
--artist TEXT — Text Artist.
--album TEXT — Text Album.
--genre TEXT — Text Genre.
--date TEXT — Text Date.
--composer TEXT — Text Composer.
--grouping TEXT — Text Grouping.
--comment TEXT — Text Comment.
--album-artist TEXT — Text Album artist.
--track N[/TOTAL] — N or N/TOTAL Track number.
--disk N[/TOTAL] — N or N/TOTAL Disc number.
--tempo N — Integer Tempo (BPM).
--tag FCC:VALUE — FCC:VALUE Set an iTunes atom by four-character code; a three-character code gets the © prefix (day → ©day).
--tag-from-file FCC:FILE — FCC:FILE As --tag, with the value read from a file.
--long-tag NAME:VALUE — NAME:VALUE Custom iTunes (----) tag.
--tag-from-json FILE[?PATH] — FILE or FILE?dotted.path Read tags from a JSON object, e.g. ffprobe -print_format json -show_format output with ?format.tags.