Saturday, August 20, 2005

The "best" choices for encoding your music

[UPDATED: After 10 years, storage, science, and codecs have changed conclusions here. See strikethroughs...]

I have been working in the digital music business for a long time. As a result, people ask me certain questions all the time. One that I get a lot these days is
"What bit rate and format should I use for encoding my music?"
Most of these folks are using iTunes. I think iTunes is good, but far from perfect. The best technical solution is probably the latest version of Rhapsody, which supports tons of devices (including the iPod) and every format (including AAC), but right now it's not as simple or easy to use for many people as iTunes.

So here's what I usually tell people...

The Short Answer:
  • If you have an iPod and plan on sticking with the iPod family, use AAC at 320 kbps either 192 kbps or 160 kbps. Use 192 kbps if you value quality over number of tracks, and vice versa.
  • If you don't have an iPod (or may consider switching away from one in the future), use MP3 or AAC at 320 kbps. If you use MP3, make sure "high quality" options are turned on, "True Stereo" (rather than "Joint Stereo") is active. VBR is optional. at 192 kbps with "high quality" selected.
  • If you only listen on your PC/Mac and want the absolute best sound quality, use Apple Lossless Encoding or FLAC.
  • Rhapsody and iTunes both encode in MP3 and AAC. If you have an iPod, use iTunes. If you don't have an iPod, use Rhapsody or whatever came with your portable player.
The Long Answer:
There are two ways to describe "best" audio quality:
  • What's "absolutely" the best ("objective best")
  • What's best for you ("subjective best")
For absolute audio quality, there are 2 approaches to take: mathematically lossless and perceptually lossless.

"Mathematically lossless" means the bits stored on your computer are numerically identical to the bits on your CD when played back. You could do this by ripping directly to WAV file - this effectively copies the audio data from the CD to your hard drive without changing anything. The main drawback to doing this file size - 10 MB per minute of CD-quality stereo, equivalent to 1411 kbps.

However, Apple includes an "Apple Lossless Encoding" option which is like a Stuffit or ZIP for audio files. This will produce files that are around half the size of WAV files (5 MB per minute or about 705 kbps), but when played back, the bits output are absolutely identical to the original CD data.

If you want the absolute best quality audio, this is the format in which you should rip. Note that the iPod Shuffle cannot play back these kinds of files, nor can any other portable devices other than the iPod. It's best as an archival format. Apple does include a way to "convert" (transcode) these files during transfer, but currently limits it to 128 kbps, and only for the Shuffle.

"Perceptually lossless" means that you can't hear the difference between the original CD audio and the audio that is reproduced. MP3, AAC, and WMA are all examples of "perceptual" coding systems. If you crank either of them up to a high enough bit rate, you should not be able to hear a difference (in theory, more on this in a bit).

In my experience, WMA doesn't get truly perceptually lossless on most material even if you crank it way up - it's best for low bit rates. Doesn't matter, because iTunes won't encode in WMA and the iPod won't play it back natively.

MP3 is an older codec, but if you crank it up to 256 kbps and use "high quality" options, most people can't tell the difference. However, at that point, you're creating files that are "only" 1/5 the size of the originals - I would say you might as well go to lossless at that point. 192 kbps is a good trade-off. AAC and MP3 are now supported by almost every single portable player and computer-based player.

AAC is a newer, better codec. For most people, AAC is "transparent" (another way of saying perceptually lossless) at 192 kbps, and does well on a lot of material down at 160 kbps.

Both AAC and MP3 use something called "joint stereo" at bit rates below 192 kbps. For best stereo reproduction, you want to stay at 192 kbps or higher.

320 kbps is indistinguishable from original source material. Use that.

So all that is the "objective best".

The "subjective best" really depends on what you want to do with these files and what your personal requirements may be.

Remember when I mentioned that AAC, MP3, and WMA are perceptually lossless "in theory"? This has to do with the nature of perceptual coding. Aside from bit rate, there are 2 other factors: the material being encoded, and your particular set of ears.

Due to the way all these encoding systems work, the material being encoded affects how well it is encoded. Hypothetically, some content will sound better (at the same bit rate) as MP3, some better as AAC, and some better as WMA. They each compress audio in different fashions, and work better on different types of things. The clearest example I've encountered is that WMA is not particularly good for music with lots of transients (percussive sounds) but works very nicely on things with long, sustained sounds (like string quartets).

The other aspect is your ears. These encoding systems are all based on generalized models of how people hear. But like "one size fits all" clothing, you are unlikely to match this generalized model perfectly. This means that some content and encoding systems are going to sound better and worse to you relative to other people.

Subjective recommendations:
  • Listening only on your PC and need the best audio quality? Use Apple Lossless, but make sure you have good speakers or headphones, or it's a waste of space. Those Labtecs won't cut it.
  • Use an iPod and plan on using iPods forever? Use AAC. Choose your bit rate based on how much music you want to put on your device. I'd recommend 320 192. 160 is also fine if you value track quantity over track quality.
  • Use some other MP3 player, or considering switching from iPod in the future? Use MP3 at 320 192 kbps with HQ option turned on. This is the "safest" choice and what most people should be doing. Right now, there are very few portable players that support AAC, but everyone supports MP3. If you rip everything at 192 kbps/MP3, you will have decent sound quality, reasonable file size, and the ability to put your collection on any device.
Conclusion:
Since you're listening to the music, trust your own ears. The best thing you can do is run some tests yourself - take 1 or 2 tracks and encode them at different bit rates and using the different codecs. Play them back in random order without looking at them and see if you can hear a difference. Throw in a lossless file or a WAV as well. Choose the lowest bit rate you can stand.

Me? I have most of my collection at 320 160 kbps AAC, though newer things or things I really like I am encoding at 192 kbps AAC. I've re-encoded my entire collection more than once, and probably will have to do so again.

Bonus for Audio Nerds:
Yeah, there's OGG. Not enough portable players support it, so it's not worth using for the average consumer.

Yeah, there's other lossless codecs like FLAC. Again, not enough PC/Mac players support it, and no portable devices that I'm aware of. Even if there's one that does, it's still not worth using for the average customer.

I will post about "which portable device should I use?" at a later date.

3 comments:

isaacjosephson said...

I've been doing MP3 at 160kbps since the dawn of my MP3 player days. An agnostic format is crucial for me. I don't want to be tied to any particular kind of hardware (firmware, really, but you know). Also, at 160, I definitely notice the difference, but it's palatable compared to the crappy 128. And it still leaves enough space to cram tons of music in.

Brad said...

What if I'm stuck with a bunch of albums encoded at 128 kbps and don't have the CD's laying around anymore? Any advice?

Unknown said...

Brad, if this is the case then you are left with a few choices. 1.) Keep listening to the 128 kbps. 2.) Go out and buy the music again. 3.) Download the music

thats about it. Once encoded down to 128 kbps you can't do anything to that file to make it greater than 128 at that time.