Sunday, December 16, 2007

Experiments in DRM removal and re-encoding

We don't let much DRM into our lives, but I have a few FairPlay'd tunes I bought the kids when I was less strict.

I'd like to include them in the AAC CDs I put the childrens' playlists on, but our SONY car stereo doesn't do FairPlay. Of course I could burn a CD then re-encode the tunes to MP3 or AAC, but I'd tried that before and the results were awful. The re-encoded tune sounded like AM music (few remember how bad that sounded!).

This time, though, I'd try re-encoding at 320 kbps, no VBR, 44.1 sampling. I figured I'd also try the iMovie HD DRM removal trick. [1]

The iMovie HD trick turned out to be a nuisance -- I'd rather just burn a CD. Curiously, however, I got much better results this time than previously.

The original 5.6 MB FairPlay'd tune turned into a 52MB AIFF audio file which I then turned into two non-FairPlay'd AAC files:
  • 128 kpbs (standard): 5.0 MB AAC (so smaller than the original - not good!)
  • 320 kbps non VBR 44.1 AAC (max quality AAC using iTunes encoder): 12.5 MB
Here's the surprise. They all sounded reasonable using my Bose noise canceling headphones. I'd expect the AIFF and original FairPlay'd tune to sound identical, but I'm not sure I'd be able to tell apart the 128 and 320 kpbs re-encoded tunes.

I don't know why I got better results today than in the past. Maybe last time I tried re-encoding as MP3, and the AAC to AIFF to MP3 transformations are tougher than AAC to AIFF to AAC. Maybe my ears are getting worse.

I wouldn't try it for Jazz or classical music, but at least some pop tunes survived the AAC to AIFF to AAC round trip better than I'd expected. I would favor a high bit rate for the reencoding though; I really don't have very good ears.

[1] The trick relies on a quirk of iMovie HD that is not present in iMovie '08. iMovie HD will export the combination of a FairPlay'd soundtrack and a JPG as a non-DRMd AIFF audio file.

2 comments:

marmoset said...

Here's my theory (perhaps overly simplistic, but, hey, you're getting it for free ;) )...

Every lossy audio encoder has certain quirks/artifacts/biases in terms of what "inaudible" material gets thrown away in the encoding process. When you decode a lossy-encoded file to a format like AIFF or WAV and then re-encode with the same encoder, the audio information that was in the original is no longer there, and the re-encoding process pretty much just finds the "meat" of the audio and packs it into the new, smaller file. If you did this over and over, you'd of course get to the point where this was very obvious and audible, but a single cycle is most likely not going to do it.

When you decode, say, an AAC and re-encode with MP3, you're dealing with two encoders that quite possibly throw away different "inaudible" information, so you're going to end up with a much more audibly lossy file than you did the first time. To demonstrate this with a sentence, imagine you were lossily encoding the sentence "We wish you a merry Christmas."

Imagine that AAC compresses this as "We wsh u a mry Xmas", and MP3 compresses it as "We wis you meri Chrstms." You could probably figure out what either of those meant on its own, but when you use 2 different algorithms you may end up with the equivalent of "We ws u mr ms."

John Gordon said...

We ws u mr ms.

I like that one!

I came to the same theory after I'd posted, but you said it better than I could have.

If we had lots of free time we could even test it!