Chapter 6. Encoding, Serving, and Streaming Sound with RealAudio
The RealMedia System
RealAudio is the premier platform for streaming audio and video on the Web. While MP3 and QuickTime may have higher quality audio and video compression, neither provides RealAudio's advanced server functionality, reliability, and administrative tools -- features that are needed to carry out large-scale professional broadcasting. RealAudio not only provides a streaming media delivery format and media player, but its server technology optimizes audio playback over multiple modem connection speeds.
The RealMedia System works behind the scenes to deliver the best quality audio stream to both high- and low-bandwidth users. Interactive short-form audio formats such as Flash, Shockwave, and Beatnik are tailored for sound effects and loops and do not offer features for managing and controlling streams over various connection rates. Flash and Beatnik are also more likely to cause audio drop-outs and error messages when streaming long-form audio files.
Professional developers opt for RealAudio for a number of reasons, including:
In this chapter, we introduce you to the basic components of the RealMedia System and then show you how to encode and stream RealAudio content. We also explore advanced real-world case studies to show you how the technology is used in professional applications.
6.1. The RealMedia System
The RealMedia System is comprised of three core components: RealEncoder, RealServer, and RealPlayer. In addition, RealNetworks provides a suite of RealMedia tools and utilities. This chapter focuses primarily on RealMedia 5.0 components and features. A large portion of your listening audience may not have the G2 plug-in yet. Thus, for many developers, RealAudio 5.0 is still the preferred format. Figure 6-1 illustrates the process of RealMedia creation and delivery including the interaction between server-side and client-side components.
Figure 6-1. An overview of the RealSystem 5.0
In brief, when a listener clicks on a web page that contains a RealAudio link, the web server does not stream the audio file but instead prompts the web browser to start up the RealPlayer application. RealPlayer then requests the audio file from RealServer. RealServer in turn streams media content generated from RealEncoder and RealPublisher. Finally, RealServer keeps track of media usage via the Java performance monitor, log file records, and authentication software. Figure 6-1 also helps to distinguish the process of RealMedia delivery with a dedicated RealServer as opposed to streaming audio from a standard web server.
6.1.1. RealEncoder and RealPublisher
RealNetworks offers two applications for encoding audio and video: RealEncoder and RealPublisher. The free RealEncoder, shown in Figure 6-2, enables you to encode audio or video files or a live input signal from an audio or video device into one or more RealMedia codecs. The RealPublisher offers the basic features of the free encoder plus advanced features such as wizards for creating HTML and built-in FTP support. The RealPublisher is especially useful for creating web pages that contain an embedded RealPlayer. The RealEncoder and RealPublisher both feature static encoding (for Macintosh and Windows) for pre-existing audio or video files and live encoding for broadcasting live events.
Figure 6-2. The RealEncoder 5.0 lets you encode audio or video files or a live input signal.
With the release of RealSystem G2, the RealEncoder and RealPublisher content creation tools have been renamed the RealProducer. The current version of RealAudio uses RealNetwork's new G2 compression technology. G2's new codecs offer tremendous improvement in sound quality over the RealAudio 1.0 and 2.0, which had been inferior to Shockwave's MPEG-based compression algorithms and Liquid Audio's Dolby compression technology.
RealServer works in conjunction with a standard web server to stream encoded audio and multimedia content over the Internet. RealServer is the key component that separates RealAudio from other formats that primarily rely upon HTTP or TCP streaming from a web server. A dedicated RealAudio server offers greater reliability than a standard web server and features more sophisticated streaming capabilities, such as robust UDP and RTSP transmission, bandwidth negotiation, live splitting, IP multicasting, and clustering. RealServer also allows for more control over the stream, such as the ability to seek forward without waiting for the content to download. Additionally, data is sent across the network in a more consistent, regulated rate as compared to a web server's tendency to deliver data in bursts. The RealSystem also provides detailed usage logs and tracking analysis of hits and playback errors -- essential tools for system administrators and web developers.
The last piece of the puzzle is RealPlayer -- the player or "decoder" (shown in Figure 6-3) that receives the incoming audio signal. The RealPlayer decodes incoming audio packets that have been compressed with the RealEncoder. The RealPlayer is free and features random access controls such as scroll, stop, start, and pause. The RealPlayer Plus lets you set custom presets or channels that point to your favorite RealAudio broadcasting sites and record RealAudio clips to your desktop. The G2 RealPlayer Plus includes a graphic equalizer video brightness, contrast, and tint controls (see Chapter 7, "Designing Multimedia Presentations with SMIL and RealSystem G2" for more information about RealSystem G2).
Figure 6-3. RealPlayer 5.0 decodes incoming audio packets that are compressed with the RealEncoder.
6.1.4. RealAudio utilities
RealNetworks provides several RealMedia tools and utilities for editing and synchronizing RealMedia files, such as RMEdit and RMMerge. These tools come pre-installed with the RealEncoder.
RealMedia tools allow you to alter file information such as title, author, and copyright information, and features such as selective record and mobile playback. The selective record feature allows listeners to save RealAudio clips to disk, whereas mobile playback allows listeners to save audio clips for playback over an alternative listening device. The RealMedia tools also enable you to listen to the contents of a RealAudio file and perform simple editing to an .rm file, such as pasting multiple clips into one clip or shortening the length of a clip. For more information about specific utilities and tools, visit RealNetwork's Devzone.
6.1.5. RealAudio 5.0 file types and metafiles
The RealSystem 5.0 uses several file types, each identified by a specific file extension:
6.1.6. RealAudio delivery
Figure 6-4 illustrates how a RealMedia clip is delivered to a listener. The numbers in Figure 6-4 correspond to the sequence of events that lead to the final delivery of a RealMedia clip:
Copyright © 2002 O'Reilly & Associates. All rights reserved.