Quickly Convert Your Game Music to AAC on OSX

This is just a quick post aimed at iOS developers covering the incredibly easy command-line method to convert your music files to AAC format. The reason you might want to do this is because MP3 is encumbered with a patent which covers the distribution of MP3′s commercially, even as part of a game (see here). It should also be noted that Apple’s license for their hardware MP3 decoder does not in any way cover your distribution of MP3′s in your game.

You could convert to OGG Vorbis, which is of course free and clear to distribute as you please, however many devices (including iOS devices) do not support hardware accelerated decoding of OGG Vorbis files so you are losing some of your CPU cycles for your music decoding. Luckily, there is a third option: The Advanced Audio Coding or AAC format, which of course is supported in hardware by all of Apple’s portable devices. There are patents surrounding AAC but none of them restrict the distribution or streaming of files encoded in AAC.

Anyway now that I’ve spent all that time leading up to a single command, here it is…

afconvert -f m4af infile.mp3 outfile.m4a

And that’s it! As far as I’m aware you can use any of the iOS SDK methods for music playback with this new file.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>