On ALAC’s Open Sourcing

Apple open sourced their lossless audio codec last week. Pretty awesome! I have a theory that, given enough time, absolutely every codec will be open source in one way or another.

I know I shouldn’t bother reading internet conversation around any news related to multimedia technology. And if I do read it, I shouldn’t waste any effort getting annoyed about them. But here are some general corrections:

  • ALAC is not in the same league as — nor is it a suitable replacement for — MP3/AAC/Vorbis or any other commonly used perceptual audio codec. It’s not a matter of better or worse; they’re just different families of codecs designed for different purposes.
  • Apple open sourced ALAC, not AAC– easy mistake, though there’s nothing to ‘open source’ about AAC (though people can, and will, argue about its absolute ‘open-ness’).
  • There’s not much technical room to argue between ALAC and FLAC, the leading open source lossless audio compressor. Both perform similarly in terms of codec speeds (screamingly fast) and compression efficiency (results vary slightly depending on source material).
  • Perhaps the most frustrating facet is the blithe ignorance about ALAC’s current open source status. While this event simply added an official “open source” status to the codec, ALAC has effectively been open source for a very long time. According to my notes, the ALAC decoding algorithm was reverse engineered in 2005 and added into FFmpeg in March of the same year. Then in 2008, Google — through their Summer of Code program — sponsored an open source ALAC encoder.

From the multimedia-savvy who are versed in these concepts, the conversation revolves around which would win in a fight, ALAC or FLAC? And who between Apple and FFmpeg/Libav has a faster ALAC decoder? The faster and more efficient ALAC encoder? I contend that these issues don’t really matter. If you have any experience working with lossless audio encoders, you know that they tend to be ridiculously fast to both encode and decode and that many different lossless codecs compress at roughly the same ratios.

As for which encoder is the fastest: use whatever encoder is handiest and most familiar, either iTunes or FFmpeg/Libav.

As for whether to use FLAC or ALAC — if you’ve already been using one or the other for years, keep on using it. Support isn’t going to vanish. If you’re deciding which to use for a new project, again, perhaps choose based on software you’re already familiar with. Also, consider hardware support– ALAC enjoys iPod support, FLAC is probably better supported in a variety of non-iPod devices, though that may change going forward due to this open sourcing event.

For my part, I’m just ecstatic that the question of moral superiority based on open source status has been removed from the equation.

Code-wise, I’m interested in studying the official ALAC code to see if it has any corner-case modes that the existing open source decoders don’t yet account for. The source makes mention of multichannel (i.e., greater than stereo) configurations, but I don’t know if that’s in FFmpeg/Libav.

7 thoughts on “On ALAC’s Open Sourcing

  1. Reimar

    FFmpeg ALAC obviously only supports up to stereo (there is a MAX_CHANNELS define). Good chance it wasn’t implemented due to lack of samples.

  2. Reimar

    Forgot to say: That might mean you might want to stay with FLAC for now if you want more than 2 channels, how well ALAC works for that case seems a bit unclear currently :-)

  3. Multimedia Mike Post author

    @Reimar: Excellent analysis of trade-offs. :-) That’s a point I didn’t see mentioned in any conversations.

    @Flameeyes: What part of Apple’s file production process are you curious about?

  4. Colin

    It’s my understanding (although I could be remembering entirely wrong here), that the open source ALAC encoder occasionally generates bitstreams which don’t play properly on iPods. Presumably the reference sources don’t suffer this problem.

  5. Multimedia Mike Post author

    @Colin: Entirely possible, and would be worth scanning through the FFmpeg/Libav bug bases for corroboration.

  6. Diego E. "Flameeyes" Pettenò

    Mike, I’ve been fighting quite a bit about getting iTunes to accept files created with FFmpeg, some time ago. I know it now works, but I’d be curious to see how they manage it, but I haven’t had time to look into their sources (you know how it is :/).

Comments are closed.