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.

ProfileWhat it isWhen to use it
AAC-LCThe 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 v2HE-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-ELDLow-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.

EncoderProfilesNotes
Apple Core AudioLC, 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, ELDClose 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 aacLCFree 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.
exhalexHE-AACSee 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.

ContainerNotes
MP4/M4AThe 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/LOASBroadcast transport (fdkaac -f 10, libfdk_aac -latm 1).
MPEG-TS, MatroskaFine 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.

ParameterDefaultValues / unitsEffect
-aac_codertwolooptwoloop, fastQuantizer search. twoloop gives the best quality; fast is quicker and worse.
-aac_msautoauto, 0, 1Mid/side stereo. auto decides per band, 1 forces M/S on every band, 0 disables it. Always off for more than three channels.
-aac_is10/1Intensity stereo: codes some high bands as one channel plus a position. Saves bits at low bitrates.
-aac_pns10/1Perceptual noise substitution: replaces noise-like bands with synthesized noise. Turned off for -profile:a mpeg2_aac_low.
-aac_tns10/1Temporal noise shaping; reduces pre-echo on transients.
-aac_pce00/1Signal 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”
ParameterNative aaclibfdk_aacNotes
-profile:aaac_low (default), mpeg2_aac_lowaac_low (default), aac_he, aac_he_v2, aac_ld, aac_eld, mpeg2_aac_low, mpeg2_aac_heThe native encoder can’t do HE-AAC or xHE-AAC.
-b:a128k 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-AACTotal bitrate for all channels.
-q:aConstant quality: fixed quantizer, no rate control1–5, same as -vbrSelects VBR instead of -b:a. Higher means more bits.
-cutoffEncoder choosesLibrary chooses; at most 20000 HzLow-pass in Hz.
-ar7350–96000 Hz (the 13 AAC rates)Depends on profileFFmpeg resamples to a supported rate.
-sample_fmtfltps16Input 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).

ParameterDefaultValues / unitsEffect
-afterburner10/1Extra analysis for better quality at some CPU cost. Leave it on.
-eld_sbr00/1Enable SBR with -profile:a aac_eld. HE-AAC gets SBR from -profile:a aac_he/aac_he_v2.
-eld_v200/1ELDv2 (LD-MPS) for stereo AAC-ELD. Only present when FFmpeg is built against fdk-aac 2.0 or later.
-signalingdefaultdefault, implicit, explicit_sbr, explicit_hierarchicalHow SBR/PS are signalled. default uses explicit_hierarchical when the muxer stores a global header (MP4, Matroska) and implicit for ADTS/LATM.
-latm00/1Write LOAS/LATM instead of ADTS when the muxer doesn’t use a global header. No effect for MP4 or Matroska.
-header_period00–65535 framesWith -latm 1, repeat the StreamMuxConfig/PCE every N frames. 0 keeps the library default.
-vbr00–50 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_profile00 none, 1 film standard, 2 film light, 3 music standard, 4 music light, 5 speechMPEG-4 DRC profile written as metadata for the decoder; the encoded audio is unchanged.
-drc_target_ref0Integer dB, -31–0Target reference level for -drc_profile.
-comp_profile0Same as -drc_profileETSI heavy-compression profile; only written when -drc_profile is non-zero.
-comp_target_ref0Integer dB, -31–0Target reference level for -comp_profile.
-prog_ref0Integer dB, -31–0Programme (dialogue) reference level metadata. 0 means it is not written.
-frame_length-11024 (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).

ParameterDefaultValues / unitsEffect
-p, --profile N22 AAC-LC, 5 HE-AAC, 29 HE-AAC v2, 23 AAC-LD, 39 AAC-ELDAudio object type.
-b, --bitrate NNone; required unless -m is 1–5bit/s; values below 10000 are read as kbit/sCBR target. -b 128 and -b 128000 are the same.
-m, --bitrate-mode N00 CBR, 1–5 VBRVBR 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 N0 (auto)HzLow-pass frequency, AAC-LC only. At most 20 kHz or half the sample rate; the automatic choice is usually better.
-a, --afterburner N10/1Extra analysis for better quality. Leave it on.
-L, --lowdelay-sbr N0-1 auto, 0 off, 1 onSBR for AAC-ELD.
-s, --sbr-ratio N0 (library default)0, 1 downsampled, 2 dual-rateSBR sampling ratio. The library defaults to downsampled SBR for ELD+SBR and dual-rate for HE-AAC.
-f, --transport-format N0 (M4A)0 M4A, 1 ADIF, 2 ADTS, 6 LATM MCP=1, 7 LATM MCP=0, 10 LOAS/LATMAnything other than 0 writes a raw AAC stream (default extension .aac) instead of M4A.
-C, --adts-crc-checkOffFlagAdd CRC protection to ADTS headers.
-P, --header-period N0 (library default)FramesStreamMuxConfig/PCE repetition period for LATM/LOAS.
-o FILEInput name with .m4a, or .aac if -f is not 0Filename; - (stdout) only when -f is not 0Output file. M4A output must be seekable.
-G, --gapless-mode N00 iTunSMPB, 1 ISO (edts + sgpd), 2 bothHow encoder delay and padding are signalled in M4A.
--include-sbr-delayOffFlagCount the SBR decoder delay in the signalled encoder delay. This is FDK’s own convention but is not iTunes-compatible.
--moov-before-mdatOffFlagPut the moov index before the audio data, for progressive playback.
--no-timestampOffFlagWrite zero creation/modification times, for reproducible output.
ParameterDefaultValues / unitsEffect
-h, --help—FlagPrint the version and help, then exit.
-I, --ignorelengthOffFlagIgnore the WAV data-chunk length, for WAV piped from tools that write a placeholder length.
-S, --silentOffFlagNo progress output.
-R, --rawOffFlagRead headerless PCM described by the --raw-* options instead of WAV or CAF.
--raw-channels N2Channel countRaw channel count.
--raw-rate N44100HzRaw sample rate.
--raw-format SPECS16LS or U with 8–32 bits, or F with 32/64; then L or BRaw 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.

ParameterDefaultValues / syntaxEffect
--title TEXT—TextTitle.
--artist TEXT—TextArtist.
--album TEXT—TextAlbum.
--genre TEXT—TextGenre.
--date TEXT—TextDate.
--composer TEXT—TextComposer.
--grouping TEXT—TextGrouping.
--comment TEXT—TextComment.
--album-artist TEXT—TextAlbum artist.
--track N[/TOTAL]—N or N/TOTALTrack number.
--disk N[/TOTAL]—N or N/TOTALDisc number.
--tempo N—IntegerTempo (BPM).
--tag FCC:VALUE—FCC:VALUESet an iTunes atom by four-character code; a three-character code gets the © prefix (day → ©day).
--tag-from-file FCC:FILE—FCC:FILEAs --tag, with the value read from a file.
--long-tag NAME:VALUE—NAME:VALUECustom iTunes (----) tag.
--tag-from-json FILE[?PATH]—FILE or FILE?dotted.pathRead tags from a JSON object, e.g. ffprobe -print_format json -show_format output with ?format.tags.