Creating iTunes Plus AAC from the Command Line
For those who still maintain a local music collection, choosing an audio format is an important decision. While lossless formats offer the best quality, they can be demanding on storage and data usage. For mobile listening, converting your music to a lossy format is often the more practical choice.
Which format should you choose, then?
Those who lived through the iPod era might remember Apple’s “iTunes Plus AAC.” This format was originally introduced for the iTunes Store in 2007, described in the press release as a “high quality 256 kbps AAC encoding for audio quality virtually indistinguishable from the original recordings.” “iTunes Plus” also later became a transcoding option in iTunes and can still be found in the Music app on macOS today, referring to the settings “128 kbps (mono)/256 kbps (stereo), 44.100 kHz, VBR.”

Reference to iTunes Plus in the Music app
iTunes Plus AAC is well-received online. Besides the common benefits of AAC encoding — small file size and high quality — it has also been shown to outperform other AAC encoders in some blind tests. This is in part thanks to its use of a Constrained Variable Bitrate (CVBR) strategy. CVBR aims for an average bitrate (256 kbps here) but allows the rate to fluctuate (sometimes aggressively) to better balance file size and audio quality. Combined with its first-class support on Apple devices, iTunes Plus stands out as an ideal lossy format.
However, it would be inconvenient to rely on iTunes or its successor, the Music app, for every conversion. Apple also lacks support for lossless formats beyond WAV and their proprietary ALAC.
Indeed, the transcoding feature in iTunes and the Music app is just a front-end for the capabilities provided by Apple’s Audio Toolbox framework. Other software can also tap into this framework:
- On macOS, the built-in command-line tool
afconvert(1)
is a wrapper for Audio Toolbox’s transcoder and is the recommended tool in the technology brief for Apple Digital Masters; - On Windows, the open-source command-line tool
qaac
can call the Audio Toolbox libraries extracted from an iTunes installation to provide conversions equivalent to iTunes.
By using these in scripts or with other automation tools, we can easily convert music in batches into the iTunes Plus AAC format. This article shows how.
Disclaimers:
- The term “iTunes Plus AAC” in this article refers to AAC files created using Apple’s recommended encoder and settings. They are not identical in quality to the files sold on the iTunes Store, which are mastered from the source material and undergo optimizations like loudness normalization;
- The following steps assume a basic understanding of terminal and command-line operations;
- My knowledge of audio formats and encoding is limited and there may be errors or deviations from best practices in this guide. Corrections are welcome.
macOS
On macOS, you can create iTunes Plus AAC files using the built-in afconvert(1)
utility. According to the technology brief for Apple Digital Masters [PDF], the following settings should be used:
afconvert input.wav \
-d aac \
-f m4af \
-u pgcm 2 \
-b 256000 \
-q 127 \
-s 2 \
output.m4a
p. 7.
In the command above:
-d aac
sets the encoding format to AAC;-f m4af
sets the file format to Apple MPEG-4 Audio;-u pgcm 2
sets an undocumented Audio Converter property, possibly related to the encoder’s behavior;-b 256000
sets the bitrate to 256 Kbps;-q 127
sets the quality to the maximum (0-127); and-s 2
sets the bitrate strategy to CVBR (discussed above).
Note: The technology brief actually describes a two-step process: first converting to a CAF file with a loudness check, then generating a loudness-normalized AAC file, pp. 5, 7, which is intended for mastering from the source material. Since most lossless files obtained for personal use have already been post-processed, this extra step offers little benefit for our purposes and is thus omitted.
However, afconvert
only supports WAV, ALAC, and AIFF inputs. Since FLAC is a more common lossless format, a preprocessing step with ffmpeg
is required:
ffmpeg -i input.flac -ac 2 -ar 44100 temp.wav && \
afconvert -f m4af -d aac -u pgcm 2 -b 256000 -q 127 -s 2 temp.wav output.m4a && \
rm temp.wav
This command first uses ffmpeg
to convert the source file into a two-channel, 44.1kHz temporary WAV file, which would then be passed to afconvert
and removed after the final AAC output is created.
Note: Although ffmpeg
can theoretically call Audio Toolbox directly with the -c:a aac_at
option to create an iTunes Plus AAC file in one step, my tests show that the quality of the resulting file is significantly different from one produced by afconvert
. Therefore, this guide sticks with using afconvert
for the final AAC output.
You can automate this process using a macOS Shortcut (Download).

Before using the Shortcut, you need to:
- Enter the correct installation path for
ffmpeg
in the text box above theFFMPEG_PATH
variable. The pre-filled path is the Homebrew default for Apple Silicon Macs. You can find your path by runningwhich ffmpeg
in the Terminal; and - In System Settings > Privacy & Security, grant “Full Disk Access” to
/System/Library/CoreServices/Finder.app
.
After setup, you can run the shortcut and select your input files, or control-click files in Finder and select Quick Actions > Create iTunes AAC to quickly generate the AAC versions.

Windows
On Windows, you can use qaac
to transcode to iTunes Plus AAC, provided that Apple’s AAC encoder has been installed. Typically, this is only available by installing the standalone versions of iTunes or iCloud. For a “portable” approach that avoids installing bloatware, you can extract the necessary support files from the iTunes installer.
Here are the steps:
- Download the latest version of the iTunes installer (
iTunes64Setup.exe
) from Apple; - Download the extraction script,
makeportable2.cmd
, provided by theqaac
author, and place it in the same directory asiTunes64Setup.exe
. Run the script (you can ignore any security warnings). This will create aQTfiles64
folder containing the necessary Apple encoder support libraries (DLLs); - Download the latest version of
qaac
from its release page and unzip it. It contains bothx86
andx64
subdirectories. As it’s now 2025, we will only consider the x64 version; - Move the
QTfiles64
folder created in step 2 into thex64
directory, so it is in the same location asqaac64.exe
; - For handling FLAC input, download the latest release of FLAC (
flac-x.y.z-win.zip
) and place the extractedlibFLAC.dll
in the samex64
directory withqaac64.exe
.
After these steps, the directory where qaac64.exe
is in should look like this:
.
├── libFLAC.dll
├── libsoxconvolver64.dll
├── libsoxr64.dll
├── qaac64.exe
├── QTfiles64
│ ├── ...
│ ├── ASL.dll
│ ├── concrt140.dll
│ ├── CoreAudioToolbox.dll
│ ├── CoreFoundation.dll
│ ├── icudt62.dll
│ └── ...
└── refalac64.exe
According to the qaac
documentation, the following command produces an output equivalent to iTunes Plus (256k):
qaac64.exe -v256 input.flac
We can create a batch script to automate the process:
@echo off
setlocal
set “QAAC_OPTIONS=-v256″
set “QAAC_PATH=%ProgramFiles%\qaac\qaac64.exe”
if not exist ”%QAAC_PATH%” (
echo ERROR: Could not find qaac64.exe at the specified path.
goto :end
)
if ”%~1″==”″ (
echo No files were provided.
goto :end
)
for %%F in (%*) do (
echo Processing: ”%%~nxF”
”%QAAC_PATH%” %QAAC_OPTIONS% -o ”%%~dpnF.m4a” ”%%~F”
echo.
)
echo All done.
:end
echo.
echo Press any key to exit...
pause >nul
This script assumes you have placed the qaac
executable and libraries in C:\Program Files\qaac
. You can modify the QAAC_PATH
variable to your actual installation path.
Save the code above as makeitunesaac.bat
. You can now drag and drop files onto it to create converted AAC versions in the same directory.

Checking the Results
We can use MediaInfo to check if the AAC files generated by afconvert
and qaac
are consistent with the versions created by iTunes (or the Music app).
mediainfo output_itunes.m4a output_afconvert.m4a output_qaac.m4a
For my test file, the output from all three methods was identical:
...
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : mp4a-40-2
Duration : 4 min 1 s
Bit rate mode : Variable
Bit rate : 256 kb/s
Maximum bit rate : 341 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 44.1 kHz
Frame rate : 43.066 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 7.68 MiB (99%)
...
This shows that afconvert
and qaac
can indeed produce output that is functionally equivalent to that of iTunes or the Music app. You can also see that while the average bitrate is maintained at 256 kbps, the peak bitrate reaches 341 kbps, demonstrating that CVBR is working as intended.
Observing the spectrograms, the versions from afconvert
and qaac
retain more detail from the lossless source compared to a 320 Kbps MP3 (LAME encoder), while also being about 20% smaller in file size, which is an ideal outcome.

中文版
对于仍有聆听本地音乐文件需求的人来说,音频格式的选择是一个重要问题。无损格式虽好,但毕竟对存储空间和流量有一定压力;在移动端聆听时,转制一份有损压缩副本还是更实用的选择。
那该选择什么格式呢?
经历过 iPod 时代的人可能记得苹果曾宣传过 iTunes Plus AAC 的概念。这原本是 iTunes 商店在 2007 年上线的音频文件格式,新闻稿中宣称是一种「高品质 256 kbps AAC 编码」。这后来也成为 iTunes 导入音乐时的一个转码选项,至今可以在 macOS 上的 Music app 中看到,其参数标注为 128 kbps (mono)/256 kbps (stereo), 44.100 KHz, VBR。

Music app 设置中对 iTunes Plus AAC 的提述
iTunes Plus AAC 格式在网上评价很好,除了具有 AAC 编码的小体积、高音质特点外,在一些盲测中也被认为效果优于其他 AAC 编码器。这部分要归功于它采用的 CVBR(constrained variable bitrate)策略,即将平均比特率约束在一个定值(256 kbps),但允许(有时相当激进的)浮动,从而更好平衡了体积和音质。加上受到苹果设备的良好支持,应当说是一种比较理想的压缩格式。
但显然,如果每次转换都要用到 iTunes 或其继任者 Music app,未免太过麻烦;这些软件本身支持的无损格式也有限,基本上只有 WAV 和苹果的私有格式 ALAC。如何将这个过程自动化呢?
实际上,iTunes 和 Music app 的转换功能只是调用了苹果系统框架 Audio Toolbox 提供的转码能力,其他软件也可以调用:
- 在 macOS 上,内置的命令行工具
afconvert(1)
包装了 Audio Toolbox 的转码功能,也是 Apple Digital Masters 文档中推荐的转码工具; - 在 Windows 上,开源命令行工具
qaac
可以包装从 iTunes 中提取的 Audio Toolbox 支持库,提供与 iTunes 等效的转换。
将它们做成脚本或配合其他自动化工具使用,就能方便地批量获得 iTunes Plus AAC 格式输出。下文将具体说明。
说明:
- 本文所指的 iTunes Plus AAC,更准确地说,只是采用苹果推荐的编码器及设置参数所得的 AAC 文件,质量上并不能与 iTunes 商店销售的那种母带转制、且经过响度均衡等优化的版本相比;
- 后文步骤假定用户对终端操作有基础了解;
- 由于笔者对音频格式及编码的了解有限,文中描述可能存在错漏或不符合最佳实践,欢迎指正。
macOS
如上所述,用 macOS 内置的 afconvert(1)
即可创建 iTunes Plus AAC。根据 Apple Digital Masters 文档 [PDF] 中的说明,应当使用如下参数:
afconvert input.wav \
-d aac \
-f m4af \
-u pgcm 2 \
-b 256000 \
-q 127 \
-s 2 \
output.m4a
(p. 7.)
上述参数依次设置:
- 输出的编码格式(
-d
)为 AAC; - 文件格式(
-f
)为 Apple MPEG-4 Audio; - Audio Converter 自定义属性(
-u
)pgcm=2
(无文档说明,可能与编码器行为有关); - 比特率(
-b
)为 256Kbps; - 质量(
-q
)为最高(取值范围 0-127);以及 - 比特率分配策略(
-s
)为 CVBR(见前文说明)。
(注: 原文档实际上使用了两步转换:首先转为 CAF 格式并执行响度检查,然后再生成经响度均一化处理的 AAC。(pp. 5, 7.) 但该文档的场景是从母带文件转码,而现实中个人用户大多接触的无损文件已经过前期处理,再做此步骤意义不大,故略去。)
不过,afconvert
只支持 WAV、ALAC 或 AIFF 格式输入,而现实中更为常见的无损格式是 FLAC,故还需通过 ffmpeg
做一次预处理:
ffmpeg -i input.flac -ac 2 -ar 44100 temp.wav && \
afconvert -f m4af -d aac -u pgcm 2 -b 256000 -q 127 -s 2 temp.wav output.m4a
rm temp.wav
这里,首先用 ffmpeg
将源文件转为双声道、44.1Khz 的临时 WAV 文件,再交给 afconvert
处理,最后删除临时文件。
(注: 尽管 ffmpeg
支持通过 -c:a aac_at
选项来调用 Audio Toolbox,理论上可以一步到位地生成 iTunes Plus AAC;但根据笔者测试,这样生成的文件在质量上与 afconvert
输出的版本差异较大。因此,本文仍用 afconvert
执行 AAC 输出。)
我们可以用下图所示的快捷指令(下载)自动化上述过程。

使用该快捷指令之前,需要:
- 在
FFMPEG_PATH
变量上方的文本框中填写正确的ffmpeg
安装路径。这里预填的是 M 系列处理器机型上通过 Homebrew 安装的默认路径,具体可以通过在终端运行which ffmpeg
来确认;以及 - 在系统设置的「隐私与安全性」中,将
/System/Library/CoreServices/Finder.app
加入「完全磁盘访问权限」。
此后,直接运行该快捷指令并选择输入文件,或者选中文件后,通过右键菜单的 Quick Action > Create iTunes AAC 即可快速创建 AAC 版本。

Windows
如上所述,Windows 系统可以通过 qaac
转码到 iTunes Plus AAC,但前提是安装了苹果的 AAC 编码器。一般来说,这只有通过安装 iTunes 或 iCloud 才能获得(仅限独立安装版)。但很多人并不想安装这两个软件,因此更「绿色」的方法是从 iTunes 安装包中提取相应支持文件供 qaac
调用。具体步骤如下。
- 从苹果官网下载最新版的 iTunes 安装包,得到一个
iTunes64Setup.exe
; - 下载 qaac 作者提供的提取脚本
makeportable2.cmd
,将其放在iTunes64Setup.exe
同一目录下运行(可能有安全警告,忽略即可)。这将生成一个包含苹果编码器支持库 DLL 的QTfiles64
文件夹; - 从
qaac
的发布页面下载最新版并解压,其中包含x86
和x64
两个版本的子目录。因为今年是 2025 年,以下只考虑 x64 版本; - 将第 2 步所得的
QTfiles64
文件夹放至x64
目录中,即与qaac64.exe
同级; - 为了能处理 FLAC 输入,再从 FLAC 的发布页面下载最新版(
flac-x.y.z-win.zip
),将解压所得的libFLAC.dll
同样放至x64
目录中,与qaac64.exe
同级。
经过上述步骤,qaac64.exe
所在目录结构应如下所示:
.
├── libFLAC.dll
├── libsoxconvolver64.dll
├── libsoxr64.dll
├── qaac64.exe
├── QTfiles64
│ ├── ...
│ ├── ASL.dll
│ ├── concrt140.dll
│ ├── CoreAudioToolbox.dll
│ ├── CoreFoundation.dll
│ ├── icudt62.dll
│ └── ...
└── refalac64.exe
这就完成了准备工作。
根据 qaac
的文档,当使用如下方式调用时,输出结果等效于 iTunes Plus (256k):
qaac64.exe -v256 input.flac
为了使用更加方便,我们可以制作一个批处理脚本来自动化:
@echo off
setlocal
set "QAAC_OPTIONS=-v256"
set "QAAC_PATH=%ProgramFiles%\qaac\qaac64.exe"
if not exist "%QAAC_PATH%" (
echo ERROR: Could not find qaac64.exe at the specified path.
goto :end
)
if "%~1"=="" (
echo No files were provided.
goto :end
)
for %%F in (%*) do (
echo Processing: "%%~nxF"
"%QAAC_PATH%" %QAAC_OPTIONS% -o "%%~dpnF.m4a" "%%~F"
echo.
)
echo All done.
:end
echo.
echo Press any key to exit...
pause >nul
上述脚本假定你将之前步骤整理好的 qaac
安装文件放在系统盘的 Program Files\qaac
文件夹下,你也可以将 QAAC_PATH
变量修改为你实际使用的其他安装路径。
将以上代码保存为 makeitunesaac.bat
。此后,将要处理的文件拖至该脚本图标上,即可在同目录下获取转码好的 AAC 版本。

效果检查
我们可以使用 MediaInfo 检查通过 afconvert
和 qaac
生成的 AAC 文件与 iTunes(或 Music app)生成的版本是否一致:
mediainfo output_itunes.m4a output_afconvert.m4a output_qaac.m4a
对于我所用的测试音乐,三者的输出完全一致:
...
Format : AAC LC
Format/Info : Advanced Audio Codec Low Complexity
Codec ID : mp4a-40-2
Duration : 4 min 1 s
Bit rate mode : Variable
Bit rate : 256 kb/s
Maximum bit rate : 341 kb/s
Channel(s) : 2 channels
Channel layout : L R
Sampling rate : 44.1 kHz
Frame rate : 43.066 FPS (1024 SPF)
Compression mode : Lossy
Stream size : 7.68 MiB (99%)
...
这表明 afconvert
和 qaac
确实能获得 iTunes(或 Music app)基本等效的输出。还能看到,尽管整体比特率维持在 256 kbps,但峰值比特率达到了 341 kbps,表明 CVBR 在发挥作用。
再观察频谱,afconvert
和 qaac
输出的版本相比于 320Kbps MP3(LIME 编码)保留了更多无损版本的细节,并且体积小了约 20%,应当说是比较理想的。
