What are the afconvert settings for the iTunes Plus AAC encoding setting?

Solution 1:

I had the exact same obsession, and ended up creating a FLAC-to-iTunes importer that decodes FLAC files to WAV and imports them into iTunes using iTunes' own encoder: https://github.com/cbguder/FLAC2iTunes

It should be easy enough to modify FLAC2iTunes to support direct WAV input.

As for the soundcheck values, I compared iTunes, XLD and afconvert by encoding WAV files to AAC and decoding them back to WAV and comparing the decoded audio data. I also compared afinfo outputs for the encoded files. While the souncheck values are different for each file, the decoded WAVs are exactly the same, so even if you use XLD or afconvert, the chances are the resulting files will sound exactly the same.

For afconvert, I used the parameters suggested by Apple in the "Mastered for iTunes" guide, with an intermediate CAF file:

afconvert source.wav intermediate.caf -d 0 -f caff --soundcheck-generate
afconvert intermediate.caf -d aac -f m4af -u pgcm 2 --soundcheck-read -b 256000 -q 127 -s 2 final.m4a

For XLD, I used these settings:

Format: MPEG-4 AAC
Mode: VBR (Constrained)
Encoder Quality: Max
Sample Rate: Auto
Target bitrate: 256 kbps
Add gapless information for iTunes: checked
Write accurate bitrate information: checked

Solution 2:

You can use the "Mastering For iTunes" droplet available on apple's website.

http://www.apple.com/itunes/mastered-for-itunes/

I did need to modify the script to run on Yosemite/ El Capitan, but it's fairly trivial:

  • Show the package contents of the app in Finder (Applications/ Utilities/ Master for iTunes Droplet).
  • Navigate to Contents/ Resources/ Scripts
  • Open main.scpt
  • Update system version compare lines to "10.10" (there are two lines that need this change):

    if systemVersion is less than "10.10" then

  • Save main.scpt

Now you can simply drag and drop your FLAC or WAV files onto the droplet and it will create an intermediate CAFF file followed by the iTunes Plus AAC file.

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

For those interested, it looks like the afconvert subroutines use the following commands (note these are pulled out of context of the code and will not run as-is):

  • WAV/FLAC to CAFF:

    • if the sampleRate is greater than "44100":

    afconvert -d LEF32@44100 -f caff --soundcheck-generate --src-complexity bats -r 127

    • else

    afconvert -d 0 -f caff --soundcheck-generate

  • CAFF to AAC

    afconvert -d aac -f m4af -u pgcm 2 --soundcheck-read -b 256000 -q 127 -s 2