O'Reilly logo

HTML5: Up and Running by Mark Pilgrim

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Audio Codecs

Unless you’re going to stick to films made before 1927 or so, you’re going to want an audio track in your video. Like video codecs, audio codecs are encoding algorithms, in this case used for audio streams. As with video codecs, there are lossy and lossless audio codecs. And like lossless video, lossless audio is really too big to put on the Web, so I’ll concentrate on lossy audio codecs.

Actually, we can narrow the focus even further, because there are different categories of lossy audio codecs. Audio is used in many places where video is not (telephony, for example), and there is an entire category of audio codecs optimized for encoding speech. You wouldn’t rip a music CD with these codecs, because the result would sound like a four-year-old singing into a speakerphone. But you would use them in an Asterisk PBX, because bandwidth is precious, and these codecs can compress human speech into a fraction of the size of general-purpose codecs. However, due to lack of support in both native browsers and third-party plug-ins, speech-optimized audio codecs never really took off on the Web. So I’ll concentrate on general-purpose lossy audio codecs.

As I mentioned in Video Codecs, when you “watch a video,” your computer is doing several things at once:

  1. Interpreting the container format

  2. Decoding the video stream

  3. Decoding the audio stream and sending the sound to your speakers

The audio codec specifies how to do #3—decoding the audio stream and turning it into digital waveforms that ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required