Tuesday, December 28, 2010

"Why Won't Safari Play Some MP3s on My Web Site?"

While adding new MP3 audio files to my Web site recently, I discovered that Safari was refusing to play one of the MP3s already there. The frustrating part was that I could see no difference between this MP3 and any of the others that Safari did play.

Searching the Web, I found that this problem was neither uncommon nor particularly new. Safari under Snow Leopard has been having a lot of weird problems playing MP3s. And despite a fair amount of discussion, no one seems to have a solution.

So here's mine: Forget MP3. Though it's a common element of HTML5 audio, and though Apple is nominally supporting it, it's really a legacy format. Support may well dwindle further, going forward. My advice is to use MP4 instead.

But isn't MP4 a video format? As it turns out, not really. It's a file format that can contain video, audio, stills, and more. You can have audio with your video, or you can have audio without video.

Sound familiar? Yes, it's a direct descendant of Apple's QuickTime Movie. You can use it for just about anything, and in this incarnation, it has the wide support that the QuickTime Movie lacked. In fact, in my testing, MP4 was handled by various browsers in just the same ways they handled MP3. So, in many cases, you can meet all your media needs with this one format.

Of course, to switch from MP3 to MP4, it's best to go back to your original, uncompressed audio -- generally in AIFF format, or WAVE, if you're on Windows -- and convert to MP4 from there. You can instead convert directly from MP3, but you will lose quality.

Many audio or media programs can convert audio to MP4, including QuickTime 7 Pro. Generally, you can set a lower bitrate for MP4, about 75% of what you'd use for MP3. To differentiate MP4 audio from MP4 video, you can use the .m4a extension -- but the standard .mp4 will work just as well, maybe better. This does not affect the format.

So, what's the trouble with Safari and MP3s? It's just Apple telling you it's time to move on!