I challenge anyone to come up with a complete list of the audio and video formats currently in use today! There are so many that it's not productive to survey all of the different multimedia file types, their extensions, and MIME types. So, I'll just cover the most popular ones, or at least the ones you might be inclined to include in your web pages.
Before I list them, however, it would be useful for you to understand what factors to consider when choosing a multimedia format. By this, I mean sound or video quality, the size of the final file, how many plug-ins or players are compatible with the format, and how readily available the file format is.
The quality of sound and video files depends primarily on the original sampling rate, number of bits used per sample, and the number of channels.
The sampling rate is the number of times per second the sound or video is sampled or measured. This value is represented in thousands of cycles per second or kilohertz (KHz). Imagine yourself walking through a room and being able to open your eyes only once every five seconds. Do you see how that might be dangerous? Now imagine yourself opening and closing your eyes every second. You get a much better picture of what is around you and a closer approximation of reality. It's the same with sampling rates: The faster the sample, the closer the sound or video will represent the original recording. The only problem with this is that when you increase the number of times you sample per second, the amount of data quickly becomes voluminous.
The number of bits you use determines the fidelity of the sound. An 8-bit sample, for example, can measure 256 discrete values, whereas 16-bit samples measure more than 65,000 values. The more bits you use, the closer you come to the actual pitch of a sound or the color in a video clip.
The number of channels refers primarily to audio files, where you can have mono (one channel) recordings, stereo (two channel), and even more. Having more channels enriches the sound and makes for a more enjoyable experience, but again, at the price of file size.
Six audio file types are in common use on the Web today, each with its own unique advantages and drawbacks.
Musical Instrument Digital Interface (MIDI) files are synthesized rather than recorded sound. The file sizes are small; however, because you can't play back recorded sound, MIDI plays a niche role. (In fact, MIDI files can be so grating to listen to that you should probably never use them in a web page at all.)
MP3 audio offers four types (or layers) of sound files and is very popular because of MPEG's widespread acceptance as an audio and video format. MP3 audio is by far the most popular and common format for MPEG audio because it can compress audio files very efficiently. MP3 remains the more popular format, and is supported by devices ranging from portable audio players like the iPod, to DVD players, to car stereos. MP3 files can also be streamed, which means that they can be played as they're being downloaded, and sites can provide a constant stream of MP3-encoded audio to act as an Internet radio station.
Waveform (WAV) files originally were created by Microsoft and IBM, but can be played by nearly any audio program. WAV files are popular for small sound clips. Larger files are generally stored in MP3 or another format.
Windows Media Audio (WMA) files are supported by Microsoft's Windows Media Player and anyone who licenses the formats. WMA is a format that's designed to compete with MP3, and offers both quality and compression better than MP3. There are actually a number of different formats that live under the WMA banner, including a straight MP3 competitor, a lossless audio format for distributing music purchases, and a compression scheme that's designed for speech rather than music. WMA files can be protected using a DRM scheme created by Microsoft that prevents the files from being shared freely.
AAC audio files are compressed using the Advanced Audio Coding format. AAC is another MP3 competitor, and is the default audio format for Apple's iTunes music player. Audio tracks purchased through the iTunes Music Store are encoded using AAC, and are protected by a DRM scheme that prevents them from being shared freely. AAC is the encoding format behind the MPEG 4 audio format.
RealAudio is an audio format designed for streaming. It's generally associated with Real Networks's line of media players. Unlike the other formats listed here, it sacrifices quality for compression so that even users with low bandwidth can receive live audio feeds over the Internet.
Table 11.8 summarizes the popular audio formats.
Table 11.8. Common Audio File Formats
The common video types available are AVI, MPEG, and QuickTime, and are described in the following list:
AVI, which stands for audio/video interleaved, is a very popular Microsoft Windows video format. It's very widely supported. AVI files can be encoded using any one of a number of formats, so users must not only have an AVI player on their computer, but they must also have the codec necessary to view a file installed a well.
MPEG video is used by things such as satellite television and digital cable. It's also a popular format for distributing video over the Internet.
QuickTime video is proprietary to Apple. However, there are QuickTime players available for both the Mac OS X and Windows.
Windows Media Video is the counterpart to Windows Media Audio. There are two Windows Media Video schemes. The first is a format designed for streaming and distributing video over the Internet; the second is a professional format designed for storing high-quality video for broadcast or archival.
RealVideo is a format designed for high compression and streaming to Real Networks's media players.
Flash Video is video that's embedded in Flash movies. The advantage of this approach is that the only dependency is the Flash player, which is already included with most browsers. The controls for video playback are also built into the Flash movie, so there's less confusion when it comes to figuring out what sizes to use when embedding the movie in a web page.
Table 11.9 summarizes these video formats.
Table 11.9. Common Video File Formats
Another factor you might want to consider is whether a particular file type is streamable. This means it can be played as it's being downloaded. At one time, RealAudio and RealVideo were the two main streamable audio and video formats. These days, though, there are players for many file types that allow the files to be streamed. For example, many MP3 players allow MP3s to be played as they're downloaded, and QuickTime files are also streamed to the player. When you're choosing a multimedia format, you should strongly consider one that supports streaming.