The challenge
I would like to convert a large collection of WAV files to AAC using the "iTunes Plus" setting in iTunes. iTunes describes this setting as:
128 kbps (mono) / 256 kbps (stereo), 44.100 kHz, VBR, optimized for MMX/SSE2.
I would like to automate this import process.
Trial and error
The afconvert command line tool can convert between audio file formats. I've tried a few settings and the closest I could get is:
afconvert -v -d aac -b 256000 -f m4af -q 127 -s 2 --soundcheck-generate input.wav output.m4a
So: be verbose (-v), use the AAC data format (-d aac), encode at 256 kbps (-b 256000), store in the Apple MPEG-4 Audio file format (-f m4af), use the highest quality (-q 127), use VBR constrained (-s 2) and add SoundCheck data to the file.
I've also created an m4a file using the iTunes Plus setting.
The m4a file created by afconvert is about the same size as the iTunes file; just 65536 bytes smaller.
Results
Using the afinfo tool, I compared the file generated by iTunes to the file generated by afconvert. There are two differences in the afinfo output:
- The file generated by iTunes has an
audio data file offsetof 131072, the one byafconvert65536. This explains the difference in file size Somehow the file generated by iTunes has different
sound checkvalues than the one converted byafconvert:iTunes file:
sc ave perceived power coeff 343 407 sc max perceived power coeff 6873 8940 sc peak amplitude msec 154389 194861 sc max perceived power msec 194025 194025 sc peak amplitude 31129 30928afconvertfile:sc ave perceived power coeff 341 388 sc max perceived power coeff 6087 4157 sc peak amplitude msec 212509 152323 sc max perceived power msec 215481 185017 sc peak amplitude 31024 29857
Especially the
sc peak amplitude msecandsc max perceived power msecvalues differ quite a lot. These are the exact same input files, what could cause this difference?
Question
Is there a way to get results even closer to the "iTunes Plus" setting?