Skip to content

qaac

current

CLI QuickTime AAC/ALAC encoder

Latest release
v3.07
Last commit
Stars
999

qaac is a command-line frontend to Apple’s Core Audio AAC encoder. Apple’s encoder is generally regarded as the best AAC encoder available, which is why people use qaac on Windows: it gives you Apple’s AAC-LC, HE-AAC and ALAC from a normal command line, without iTunes.

It is Windows-only. The Apple encoder itself is not bundled and not redistributable, so it has to come from an Apple installer. On macOS use afconvert (or FFmpeg’s aac_at) instead. On Linux the repository only builds refalac, the ALAC-only sibling.

  1. Download qaac_3.07.zip from the GitHub releases. It contains 32-bit (x86) and 64-bit (x64) builds; use qaac64.exe on 64-bit Windows.
  2. Get Apple Application Support (it contains CoreAudioToolbox.dll). Download the iTunes installer from Apple’s “other versions” link, not the Microsoft Store version, which does not work. You do not have to install iTunes: unpack the installer with 7-Zip and install the AppleApplicationSupport64.msi inside, or just install iTunes.
  3. Optionally add libFLAC.dll, wavpackdll.dll or libsndfile DLLs next to qaac64.exe so qaac can read FLAC, WavPack and others directly. Without them, pipe the input from FFmpeg.

Run qaac64 --check to see the loaded Apple library versions and qaac64 --formats to list the rate and channel combinations your installation supports.

True VBR (--tvbr, quality 0–127) is the normal choice for music. The resulting bitrate depends on the material. Typical stereo music averages, measured on Hydrogenaudio and quoted on Doom9:

—tvbrApprox. kbit/s (stereo)
127320
109255
91195
82165
73150
64135

The default for AAC-LC is --tvbr 90. Apple’s encoder snaps the value to 15 steps (0, 9, 18 … 91, 100, 109, 118, 127), so 90 and the often-quoted 91 encode identically; step up to 100 or 109 for more margin. 127 only makes sense if you want the largest file the encoder can produce. Multichannel sources scale up a lot (a 5.1 file at --tvbr 91 ran at roughly 450 kbit/s in the same thread).

Terminal window
qaac64 --tvbr 91 -o output.m4a input.wav
ffmpeg -i input.flac -f wav - | qaac64 --tvbr 91 -o output.m4a -

--quality (0–2, default 2) is encoder effort, not an audio-quality setting; leave it at 2.

HE-AAC has no TVBR; use constrained VBR with a bitrate:

Terminal window
qaac64 --he --cvbr 64 -o he-aac.m4a input.wav

Apple ALAC (lossless) is qaac64 -A -o output.m4a input.wav.

  • Only one rate mode (--tvbr, --abr, --cvbr, --cbr) may be given.
  • qaac keeps the input sample rate when it can (-r keep). Pass -r 48000, or -r auto to let the encoder choose.
  • Gapless playback metadata is written in iTunes style by default. --no-smart-padding disables the boundary extrapolation that makes gapless transitions smooth; it exists as a workaround for a Core Audio HE-AAC bug, and can break gapless playback.
  • --drc and --gain change the audio samples; they do not write AAC metadata.
  • -o - writes to stdout only for ADTS or WAV output, not M4A.

Every qaac 3.07 option, with defaults from the option parser. Which sample rates, bitrates and HE-AAC modes are accepted depends on the installed Apple encoder; --formats lists them. The --fast switch in the source belongs to refalac, not qaac.

Pick one of -V, -a, -v or -c; qaac rejects more than one.

ParameterDefaultValues / unitsEffect
-V, --tvbr N90 (the default mode for AAC-LC)0–127True VBR quality. Apple uses 15 steps (0, 9, 18, 27, 36, 45, 54, 63, 73, 82, 91, 100, 109, 118, 127) and maps other values onto them, so 90 encodes as q91. Not available with --he.
-a, --abr NOffkbit/s; 0 = highest availableAverage bitrate.
-v, --cvbr NOff; 0 with --hekbit/s; 0 = highest availableConstrained VBR. The default mode for HE-AAC.
-c, --cbr NOffkbit/s; 0 = highest availableConstant bitrate.
--heOff (AAC-LC)FlagHE-AAC (SBR). TVBR is unavailable, so the default becomes -v 0.
-q, --quality N20–2Encoder effort; 2 is slowest and best. Separate from the TVBR quality.
-A, --alacOffFlagEncode ALAC (lossless) instead of AAC.
-D, --decodeOffFlagDecode to WAV instead of encoding.
--playOffFlagDecode and play to a WaveOut device.
--peakOffFlagPrint the peak level after any DSP options; writes no file. Can’t be combined with an encoding mode or -D.
--adtsOff (M4A)FlagWrite raw ADTS instead of M4A. AAC only.
--cafOffFlagWrite CAF instead of M4A, WAV or ADTS. Not with --adts.
--no-optimizeOffFlagAccepted, but has no effect in 3.x.
--no-smart-paddingOffFlagDisable the extrapolation at the start and end that gives smooth gapless transitions. Output then matches iTunes bit for bit, but gapless playback can suffer, especially with HE-AAC. Can’t be combined with --num-priming.
--gapless-mode N00 iTunSMPB, 1 ISO (elst + sbgp + sgpd), 2 bothHow encoder delay and padding are signalled.
--num-priming N21120–2112 samplesExperimental: change the AAC-LC encoder delay (priming). LC only.
--no-delayOffFlagSame as --num-priming 0: prepends 960 samples of silence and trims the first three AAC frames so the output has no encoder delay. Intended for A/V sync in video.
ParameterDefaultValues / unitsEffect
-r, --rate VALUEkeepkeep, auto or HzOutput sample rate: keep the input rate where the encoder supports it, let the encoder choose, or resample to the given rate.
--lowpass N0 (Apple default)HzUse a lower cut-off than Apple’s default.
--native-resampler[=MODE,QUALITY]Offline, norm or bats, then quality 0–127Use Core Audio’s resampler instead of libsoxr. Without arguments it uses bats (best), quality 0. Arguments must follow =, e.g. --native-resampler=norm,96.
--builtin-resamplerOffFlagUse qaac’s built-in polyphase resampler instead of libsoxr. It is used anyway when libsoxr is missing.
-b, --bits-per-sample NFrom input2–32Output bit depth, WAV and ALAC only.
--no-ditherOffFlagDon’t dither when reducing bit depth.
--gain N0dBChange the level; use a negative value to avoid clipping after DSP.
-N, --normalizeOffFlagPeak-normalize in two passes. Piped input is spooled to a temporary file, which can be huge.
--drc SPECOffthreshold:ratio:knee:attack:release[:statfile]Dynamic range compressor applied to the samples: threshold below 0 dBFS, ratio above 1, knee in dB, attack and release in ms. Repeatable.
--limiterOffFlagSoft-clip peaks that reach about 0 dBFS.
--matrix-preset NAMENonePreset nameRemix channels with a user-defined matrix preset.
--matrix-file FILENoneFilenameRemix channels with coefficients from a file.
--no-matrix-normalizeOffFlagDon’t normalize the matrix coefficients.
--chanmap LISTInput order1-based list, e.g. 2,1Reorder input channels; 2,1 swaps left and right.
--chanmask NFrom inputDecimal or 0x hex; 0 ignores the input maskOverride the input channel mask (speaker layout). Doesn’t remix.
ParameterDefaultValues / unitsEffect
--start TIMEStart of input[[hh:]mm:]ss[.sss], <n>s (samples) or <mm:ss:ff>f (cue frames)Start point. A negative value prepends silence instead.
--end TIMEEnd of inputAs --startEnd point (exclusive).
--delay TIMENoneAs --start--start with the sign reversed: a positive value prepends silence. Not with --start.
-R, --rawOffFlagRead headerless PCM described by the --raw-* options.
--raw-channels N21–8Raw channel count.
--raw-rate N44100HzRaw sample rate.
--raw-format SPECS16LS, U or F, bit width, optional L/BRaw sample format, case-insensitive (S24L, F32L). F needs 32 or 64 bits.
-i, --ignorelengthOffFlagTreat the input as WAV and ignore its data-chunk length, for piped WAV. Not with --raw.
--concatOffFlagEncode all inputs into one file; needs -o.
--cue-tracks LISTAll tracksn[-n][,n[-n]]…, 0–99Tracks to extract from a cue sheet; 2-99 skips track 1 and the hidden pregap.
ParameterDefaultValues / unitsEffect
-o FILEInput name, new extensionFilename; - for stdout (ADTS or WAV output)Output file, for a single input or with --concat.
-d DIRCurrent directoryDirectoryOutput directory.
--fname-from-tagOffFlagName output files from the input tags, using --fname-format.
--fname-format TEXT${tracknumber}${title& }${title}TemplateOutput filename template for --fname-from-tag.
--tmpdir DIR%TMP%DirectoryDirectory for temporary files.
--sort-argsOffFlagSort input filenames before processing.
--text-codepage N0 (auto-detect)Code page, e.g. 65001 UTF-8, 1252 Latin-1Encoding of cue sheets, chapter and lyrics files; set it when auto-detection writes garbled tags.
--threadingOffFlagRun decoding and DSP on a separate thread from the encoder (AAC and ALAC).
-n, --niceOffFlagRun at lower process priority.
-s, --silentOffFlagNo console output.
--verboseOffFlagMore detailed console output.
-S, --statOffFlagSave per-frame bitrate statistics to <output>.stat.txt.
--log FILENoneFilenameAlso write messages to a file.
-h, --help—FlagPrint help.
--check—FlagPrint the versions of the loaded Apple and helper libraries, then exit.
--formats—FlagList the AAC formats, sample rates and bitrates your Apple encoder supports, then exit.
--exec COMMAND ARG...OffProgram and arguments; must come lastDecode each track and pipe it as WAV (or CAF with --caf, which also carries tags) to a program, e.g. --exec ffmpeg -i - -c:a libopus {}.opus. {} becomes the output name without extension. No shell is involved.

Tags from the input are copied; these options set or override them. The same values go to every file in one invocation.

ParameterDefaultValues / syntaxEffect
--title TEXT—TextTitle.
--artist TEXT—TextArtist.
--band TEXT—TextAlbum artist.
--album TEXT—TextAlbum.
--grouping TEXT—TextGrouping.
--composer TEXT—TextComposer.
--comment TEXT—TextComment.
--genre TEXT—TextGenre.
--date TEXT—TextDate.
--track N[/TOTAL]—N or N/TOTALTrack number.
--disk N[/TOTAL]—N or N/TOTALDisc number.
--compilation[=N]Off0/1; the bare flag means 1iTunes compilation flag.
--lyrics FILE—FilenameLyrics from a text file.
--artwork FILE—Image file; repeatableAttach cover art.
--artwork-size N0 (no limit)PixelsDownscale attached or copied artwork whose width or height exceeds this.
--copy-artworkOffFlagCopy the front cover from the input. Ignored when --artwork is given.
--chapter FILE—FilenameChapters from a file.
--tag FCC:VALUE—FCC:VALUESet an iTunes atom by four-character code; a three-character code gets the © prefix.
--tag-from-file FCC:FILE—FCC:FILEAs --tag, with the value read from a file.
--long-tag NAME:VALUE—NAME:VALUECustom iTunes (----) tag, stored as UTF-8.