Web Development Tutorials




  
  

Audio/Video Formats

One of the exciting results of the movement to broadband Internet connectivity is the growing reliance on sound and movies for delivering Web page content. High-speed network connections are capable of transmitting data at several megabytes per second which is a crucial need for delivering large audio and video files to the desktop.

Transmission Methods

There are two ways to receive audio and video files at your browser. One method is by downloading the file from a Web server. In this case, there are delays while the file is being transmitted to your browser. Despite the delay in downloading, modern browsers can begin playing the media before it all arrives at your desktop through progressive download methods. That is, playback takes place at the same time the file is being downloaded. After the file is downloaded, it is available on your PC for rapid reloading and replaying. Downloaded files can be saved to your desktop and thereafter accessed and played locally.

The second way of receiving multimedia content is through streaming methods. If audio and video files are hosted on a "media server" then that machine can transmit files as a continuous stream. It is not necessary to wait for a download to finish before playback begins. Usually there are a few seconds of delay while initial content is transmitted to the PC; thereafter, the browser receives a continuous stream of sound and pictures. While the transmitted portion of the file is being played, the next portion of the stream is being transmitted to and buffered (temporarily saved) on the PC to await playback. This interleaving of transmission and playback provides a continuous stream of multimedia content. Often, media files can be streamed at a rate that matches the bandwidth at which you are connected to the Internet. Streamed files are not downloaded; therefore, you do not receive a copy of the file.

Streaming methods are also used for live broadcasts. There are a few seconds of delay for initial transmissions to be received and buffered at the PC. While playback of the buffered content continues, the next portion of content is transmitted to and buffered on the PC to await playback. This ability of your computer to play buffered content at the same time that it receives and buffers transmissions produces a continuous stream of audio and video output.

Media Playback

In order to receive audio and video files, live media streams, and other types of media files, you must have the appropriate plug-in or helper application installed on your computer. When the browser loads a Web page that contains multimedia content, it will search for the appropriate plug-in configured to display the file type. If it cannot find the plug-in on the user's computer, the browser will prompt the user to download the file. The most common types of browser plug-ins include:

The player or application needed depends on the formats in which media content is provided.

The following sections include use of Windows Media player; however, Apple QuickTime or RealPlayer can also be used. You should have the latest version installed. When using Windows Media Player, there are two ways to provide Web access to media files. You can create links to the files or you can embed the media within a Web page.

Linking to Media

You can link to media files just like you link to Web pages, with an <a> tag. In this case, the href attribute gives the URL to the file that is located either locally on the PC or remotely on a Web server. When linking to a media file, either a Media Player opens externally and plays the media file or a separate browser tab opens and plays the file.

The Good, The Bad, and The Ugly
Separate browser window with video.

Figure 9-1. A separate browser window opens and plays a media file.


Embedding Media

The Media Player can be embedded on the Web page rather than opening in a separate window. In this case, the player is an element of the page, permitting close integration of sounds and pictures with other content on the page. When the player is embedded, the media plays only while viewing the page and stops when another page is accessed.

Figure 9-2. Embedding a video on a Web page.

The way in which access is provided to media files depends to a large extent on the capabilities of your Web clients. For browsers with slower Internet connections, presenting links to media files along with relevant information about file sizes gives the user the choice about whether to proceed with a download. An embedded player set for automatic playback could cause lengthy delays and an unhappy experience for the user.

For Web clients with broadband connections, the choice has more to do with page design considerations. If you anticipate continued browsing of your site with background or external playback, then you can provide links to media files. On the other hand, if playback is integral to other content on your page, then you will likely embed the media, and start playback when the page is opened.

Audio Formats

Several different sound formats are used for Web playback. They are characterized by the brands of computer systems they are designed to serve as well as by the sound quality that is provided. Sound quality depends on the type of sound compression technique used to digitize the file. This compression method is encapsulated within a sound codex (compression / decompression algorithm) that reduces file sizes by removing unnecessary signals or collapsing redundant or repeating signals. The most popular sound formats are briefly described in the following table.

Format Drescription
AIFF Audio Interchange File Format. Developed for use on Apple Macintosh computers. It is also supported on Windows platforms using the extension .aif
AU An older type of sound file that generally has poorer sound quality than new types of audio formats. Developed for use primarily on UNIX workstations. Provides mono playback.
MIDI Musical Digital Interface. Limited to playback of sounds generated by music synthesizers.
MP3 Uses advanced compression algorithm that results in smaller file sizes. Podcasts typically use this format.
RA RealAudio. Proprietary format for streamed audio in real time. Produces small file sizes for lower bandwidth connections. Requires special player.
WAV Developed for Windows computers. One of the most common formats for download files.
WMA Windows Media Audio. Developed for streamed audio files. Very good quality for a variety of bandwidths. One of the most common formats.
M4A Audio only MPEG-4 format supported by Quicktime, iTunes, and iPods

Figure 9-3. Sound file formats.

Video Formats

As with audio formats, video file formats are characterized by the brands of computer systems they are designed to serve, and by the video quality that is provided. Video quality also depends on the type of codex used to digitize the file. The most popular video formats are summarized in the following table.

Format Drescription
AVI Audio Video Interleave. Standard video format for Windows. Common for download files.
MPEG Moving Pictures Expert Group. High compression and small file sizes for both audio and video playback.
RV Real Video. Proprietary format for streamed video in real time. Produces small file sizes for low bandwidth connections.
MOV
(QuickTime)
Developed for Apple Macintosh computers. Files have .mov extension. One of the most common formats for Web downloads. Requires special player.
WMV Windows Media Video. Developed for streamed video files. Very good quality for a variety of bandwidths. One of the most common formats.
FLV
(Flash Video File)
Flash compatible format exported by the Adobe Flash Video Exporter plug-in. This format is commonly used on YouTube.
M4V, MP4
(MPEG-4)
Supported by Quicktime, iTunes, and iPods.

Figure 9-4. Video file formats.


TOP | NEXT: Playing Audio