qaac
CLI QuickTime AAC/ALAC encoder
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.
Install
Section titled “Install”- Download
qaac_3.07.zipfrom the GitHub releases. It contains 32-bit (x86) and 64-bit (x64) builds; useqaac64.exeon 64-bit Windows. - 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 theAppleApplicationSupport64.msiinside, or just install iTunes. - Optionally add
libFLAC.dll,wavpackdll.dllorlibsndfileDLLs next toqaac64.exeso 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.
Good settings
Section titled “Good settings”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:
| —tvbr | Approx. kbit/s (stereo) |
|---|---|
| 127 | 320 |
| 109 | 255 |
| 91 | 195 |
| 82 | 165 |
| 73 | 150 |
| 64 | 135 |
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).
qaac64 --tvbr 91 -o output.m4a input.wavffmpeg -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:
qaac64 --he --cvbr 64 -o he-aac.m4a input.wavApple ALAC (lossless) is qaac64 -A -o output.m4a input.wav.
Things that bite
Section titled “Things that bite”- 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 autoto let the encoder choose. - Gapless playback metadata is written in iTunes style by default.
--no-smart-paddingdisables 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. --drcand--gainchange the audio samples; they do not write AAC metadata.-o -writes to stdout only for ADTS or WAV output, not M4A.
Full option reference
Section titled “Full option reference”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.
Codec, rate, and container
Section titled “Codec, rate, and container”Pick one of -V, -a, -v or -c; qaac rejects more than one.
| Parameter | Default | Values / units | Effect |
|---|---|---|---|
-V, --tvbr N | 90 (the default mode for AAC-LC) | 0–127 | True 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 N | Off | kbit/s; 0 = highest available | Average bitrate. |
-v, --cvbr N | Off; 0 with --he | kbit/s; 0 = highest available | Constrained VBR. The default mode for HE-AAC. |
-c, --cbr N | Off | kbit/s; 0 = highest available | Constant bitrate. |
--he | Off (AAC-LC) | Flag | HE-AAC (SBR). TVBR is unavailable, so the default becomes -v 0. |
-q, --quality N | 2 | 0–2 | Encoder effort; 2 is slowest and best. Separate from the TVBR quality. |
-A, --alac | Off | Flag | Encode ALAC (lossless) instead of AAC. |
-D, --decode | Off | Flag | Decode to WAV instead of encoding. |
--play | Off | Flag | Decode and play to a WaveOut device. |
--peak | Off | Flag | Print the peak level after any DSP options; writes no file. Can’t be combined with an encoding mode or -D. |
--adts | Off (M4A) | Flag | Write raw ADTS instead of M4A. AAC only. |
--caf | Off | Flag | Write CAF instead of M4A, WAV or ADTS. Not with --adts. |
--no-optimize | Off | Flag | Accepted, but has no effect in 3.x. |
--no-smart-padding | Off | Flag | Disable 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 N | 0 | 0 iTunSMPB, 1 ISO (elst + sbgp + sgpd), 2 both | How encoder delay and padding are signalled. |
--num-priming N | 2112 | 0–2112 samples | Experimental: change the AAC-LC encoder delay (priming). LC only. |
--no-delay | Off | Flag | Same 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. |
PCM processing, sampling, and channels
Section titled “PCM processing, sampling, and channels”| Parameter | Default | Values / units | Effect |
|---|---|---|---|
-r, --rate VALUE | keep | keep, auto or Hz | Output sample rate: keep the input rate where the encoder supports it, let the encoder choose, or resample to the given rate. |
--lowpass N | 0 (Apple default) | Hz | Use a lower cut-off than Apple’s default. |
--native-resampler[=MODE,QUALITY] | Off | line, norm or bats, then quality 0–127 | Use 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-resampler | Off | Flag | Use qaac’s built-in polyphase resampler instead of libsoxr. It is used anyway when libsoxr is missing. |
-b, --bits-per-sample N | From input | 2–32 | Output bit depth, WAV and ALAC only. |
--no-dither | Off | Flag | Don’t dither when reducing bit depth. |
--gain N | 0 | dB | Change the level; use a negative value to avoid clipping after DSP. |
-N, --normalize | Off | Flag | Peak-normalize in two passes. Piped input is spooled to a temporary file, which can be huge. |
--drc SPEC | Off | threshold: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. |
--limiter | Off | Flag | Soft-clip peaks that reach about 0 dBFS. |
--matrix-preset NAME | None | Preset name | Remix channels with a user-defined matrix preset. |
--matrix-file FILE | None | Filename | Remix channels with coefficients from a file. |
--no-matrix-normalize | Off | Flag | Don’t normalize the matrix coefficients. |
--chanmap LIST | Input order | 1-based list, e.g. 2,1 | Reorder input channels; 2,1 swaps left and right. |
--chanmask N | From input | Decimal or 0x hex; 0 ignores the input mask | Override the input channel mask (speaker layout). Doesn’t remix. |
Trimming and input interpretation
Section titled “Trimming and input interpretation”| Parameter | Default | Values / units | Effect |
|---|---|---|---|
--start TIME | Start 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 TIME | End of input | As --start | End point (exclusive). |
--delay TIME | None | As --start | --start with the sign reversed: a positive value prepends silence. Not with --start. |
-R, --raw | Off | Flag | Read headerless PCM described by the --raw-* options. |
--raw-channels N | 2 | 1–8 | Raw channel count. |
--raw-rate N | 44100 | Hz | Raw sample rate. |
--raw-format SPEC | S16L | S, U or F, bit width, optional L/B | Raw sample format, case-insensitive (S24L, F32L). F needs 32 or 64 bits. |
-i, --ignorelength | Off | Flag | Treat the input as WAV and ignore its data-chunk length, for piped WAV. Not with --raw. |
--concat | Off | Flag | Encode all inputs into one file; needs -o. |
--cue-tracks LIST | All tracks | n[-n][,n[-n]]…, 0–99 | Tracks to extract from a cue sheet; 2-99 skips track 1 and the hidden pregap. |
Output, files, and reporting
Section titled “Output, files, and reporting”| Parameter | Default | Values / units | Effect |
|---|---|---|---|
-o FILE | Input name, new extension | Filename; - for stdout (ADTS or WAV output) | Output file, for a single input or with --concat. |
-d DIR | Current directory | Directory | Output directory. |
--fname-from-tag | Off | Flag | Name output files from the input tags, using --fname-format. |
--fname-format TEXT | ${tracknumber}${title& }${title} | Template | Output filename template for --fname-from-tag. |
--tmpdir DIR | %TMP% | Directory | Directory for temporary files. |
--sort-args | Off | Flag | Sort input filenames before processing. |
--text-codepage N | 0 (auto-detect) | Code page, e.g. 65001 UTF-8, 1252 Latin-1 | Encoding of cue sheets, chapter and lyrics files; set it when auto-detection writes garbled tags. |
--threading | Off | Flag | Run decoding and DSP on a separate thread from the encoder (AAC and ALAC). |
-n, --nice | Off | Flag | Run at lower process priority. |
-s, --silent | Off | Flag | No console output. |
--verbose | Off | Flag | More detailed console output. |
-S, --stat | Off | Flag | Save per-frame bitrate statistics to <output>.stat.txt. |
--log FILE | None | Filename | Also write messages to a file. |
-h, --help | — | Flag | Print help. |
--check | — | Flag | Print the versions of the loaded Apple and helper libraries, then exit. |
--formats | — | Flag | List the AAC formats, sample rates and bitrates your Apple encoder supports, then exit. |
--exec COMMAND ARG... | Off | Program and arguments; must come last | Decode 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, artwork, and chapters
Section titled “Tags, artwork, and chapters”Tags from the input are copied; these options set or override them. The same values go to every file in one invocation.
| Parameter | Default | Values / syntax | Effect |
|---|---|---|---|
--title TEXT | — | Text | Title. |
--artist TEXT | — | Text | Artist. |
--band TEXT | — | Text | Album artist. |
--album TEXT | — | Text | Album. |
--grouping TEXT | — | Text | Grouping. |
--composer TEXT | — | Text | Composer. |
--comment TEXT | — | Text | Comment. |
--genre TEXT | — | Text | Genre. |
--date TEXT | — | Text | Date. |
--track N[/TOTAL] | — | N or N/TOTAL | Track number. |
--disk N[/TOTAL] | — | N or N/TOTAL | Disc number. |
--compilation[=N] | Off | 0/1; the bare flag means 1 | iTunes compilation flag. |
--lyrics FILE | — | Filename | Lyrics from a text file. |
--artwork FILE | — | Image file; repeatable | Attach cover art. |
--artwork-size N | 0 (no limit) | Pixels | Downscale attached or copied artwork whose width or height exceeds this. |
--copy-artwork | Off | Flag | Copy the front cover from the input. Ignored when --artwork is given. |
--chapter FILE | — | Filename | Chapters from a file. |
--tag FCC:VALUE | — | FCC:VALUE | Set an iTunes atom by four-character code; a three-character code gets the © prefix. |
--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, stored as UTF-8. |