-->
Save your seat for Streaming Media NYC this May. Register Now!

Media Cleaner Pro II: Compression Parameters for Web Codecs

This tutorial installment will focus on options for compressing audio and video with the three major web delivery platforms: QuickTime, RealMedia and Windows Media. This is not a technology show-down, but rather a detailed look at the features which can help you achieve higher quality streaming media. A basic outline of this report follows:

1. Common Components of Compression

  • Target Bit Rates
  • Balancing Audio and Video Bit Rates
  • Image Size
  • Frame Rate
  • Keyframes
2. QuickTime Streaming Formats
  • QuickTime Streaming vs. Progressive Download
  • Sorenson Video Codec
3. RealVideo Codecs
  • Single Stream, G2 Codecs
  • Surestream and Scalability
4. Windows Media Codecs for the Web
  • WM MPEG-4 Codecs
  • Intellistream and Scalability
Choosing a preset option from the left hand side of the Advanced Settings window is the best way to get started, shown in Figure 1. For audio-only encoding, the categories are:
  • QuickTime Stream. Audio
  • QuickTime WWW Audio
  • RealVideo - Web Audio
  • Windows Media - Audio
Available Options for Movies:
  • QuickTime Streaming
  • QuickTime WWW
  • RealVideo - WebMovie
  • Windows Media - Video.
Note: The distinction between QT Streaming and QT WWW will be covered in Section 2. Your chosen presets will dictate the codecs and settings available within the right panels.

Common Components of Compression

As discussed in Media Cleaner Pro Tutorial, Part I ("Preprocessing Audio and Video for the Web"), it's always important to know your target audience when setting up the basic parameters for your web movies. Regardless of the technology you choose to deliver your media, it's important to make decisions about the following parameters prior to encoding:

  • Target Bit Rate
  • Balancing Audio Bit Rate vs. Video Bit Rate
  • Image Size
  • Frame Rate
  • KeyFrames
Target Bit Rate

To compensate for congested networks --especially relevant for true streaming-- the target bit rate is set lower than the ideal bit rate for the connection (e.g. 56kbps modems can only achieve 53kbps). Many encoding technicians will target a bit rate at 42 kbps or even 36 kbps. For full blown, two-channel ISDN connections that have a maximum bandwidth of 128k, set your target at 100kbps or even 80kbps.

Note: Broadband connections can generally be set closer to the full capacity, although keep in mind that a corporate LAN using a T1 will often require sharing the 1.5Mbps with several users simultaneously.

Audio vs. Video Bit Rate

By necessity, video requires much more of the bit rate than the audio signal - although you should never sacrifice quality audio. Compression experts and user experience have shown that better audio quality provides a better overall impression of the video. There is not much room to maneuver in a 56k stream, so you must choose a very low bit rate on the audio (5-8 kbps) in order to leave enough for the video.

Ultimately, the content and your audience will be the deciding factors in how to deliver the audio and you have more flexibility at higher bit rates for broadband delivery. You will need to choose the sampling rate and whether you want to deliver the audio in stereo. Most of the audio codecs dictate these parameters based on the bit rate you choose.

Image Size

Scaling down the frame size is one of the best ways to lower your bit rate requirements, but again you must understand your customer expectations and preferences. Most 56K streams will use a 160x120 or 176x120 image size, depending on the source video. Always keep the dimensions of the entire frame and the individual pixels constant. For example, if you capture at the broadcast resolution of 720x480, you might want to crop a total of 16 pixels off top and bottom, then resize by a factor of 4 to get 176x120.

Larger frame sizes are generally expected at broadband rates, usually 240x180 or 320x240. In the latter case, if the client allows doubling of the image, you can start to describe your streaming video as "full-screen." (Of course, 640x480 will not fully consume many computer screens set to 800x600 or higher).

Frame Rate

Frame rates are another important parameter to choose carefully in order to cut down on your bit rate requirements. At modem rates, 10 fps movies or lower are common. You can increase the rate to 15 fps for broadband delivery, but full motion video is only achieved at 30 fps. We'll start to see full motion video as the compression technologies develop, but sticking with 15 fps can save you many bits and increase the image quality of the delivered frames.

KeyFrames

Video codecs use keyframes as anchor frames, which generally require more bits to encode. All the information needed to code and decode a keyframe comes from a single source frame. For this reason, they are sometimes referred to as Intraframes or I-frames. Keyframes are useful for random access in a movie, but using less of them will help reduce overall data rate.

Between the keyframes are difference frames (also referred to as delta frames) because they code the difference between themselves and the previous frame. Difference frames attempt to code only the motion in the video. Since noise and transitions will appear as changes from frame to frame, it's important to prepare your video diligently for web compression.

The unique way that each technology handles these basic parameters, and the other features of their codecs, are discussed in the next three sections.

QuickTime Movies on the Web

Apple's QuickTime is historically the most prevalent movie format on the Web -- long before streaming was possible. Starting with QuickTime 2.0, video producers placed short clips on their web sites for download and viewing via Apple's MoviePlayer application, or a plug-in for the standard browsers. With the upgrade to QT 2.5, Apple added a fast-start feature allowing the movie to begin playing before it was entirely downloaded. This became known as "progressive download" and is still used today to offer higher quality movies even on slow connections. Movie trailers and product demonstrations are often encoded as progressive download movies.

Cinepak was traditionally the codec of choice for cross-platform delivery of QuickTime, but it's an older technology intended for CD-ROM delivery of media. With the advent of Web video, Apple teamed up with several companies to offer more efficient compression. These included Sorenson Video, Qualcomm's PureVoice and QDesign's Music Codec, all of which are still used today to compress quality content into very small packages.

Apple introduced true streaming with QuickTime 4.0, which requires a QuickTime streaming server and permits real-time delivery of content. As shown in Figure 1, Media Cleaner Pro offers presets for QuickTime streaming (QTS) and progressive download via the QuickTime WWW settings. For more information on the QT Streaming Server technology, see http://www.apple.com/quicktime/servers/


Figure 1. MediaCleanerPro has many preset templates under the Advanced Settings option.

Sorenson Video Codec

Sorenson Video is the codec of choice for streaming or downloading QuickTime movies because it is designed to package large amounts of information into very low bit rates. Media Cleaner Pro comes with a Basic edition of the codec with parameters shown in the Compress Panel of Figure 2.

Frame Rate

It is recommended that you choose a frame rate evenly divided into the source frame rate. The default choices are shown in Figure 2, but you can highlight the number in the box and enter the frame rate of your choice. And while 7.5 fps may seem odd, it allows the codec to keep one out of every 4 frames in a 30 fps movie. For very low bit rate movies, 5 and 6 fps are also viable options.


Figure 2. The Sorenson Video, Basic Edition, compression parameters.

The Maintain Long Frames check box is used if you have edited your content in an application like Adobe Premiere, which allows you to set the duration of frames if they contain no moving information. Less frames to encode means more bits dedicated to those frames containing motion. If you had a series of still frames instead, you might have noise or slight lighting differences which the codec would pick up and try to encode. Note: This option is only available in the QuickTime format.

KeyFrames

Sorenson has a default setting of one key frame every 10 seconds, which is a good place to start. If you find the video deteriorating too much between key frames, try placing them closer together. If you encounter problems keeping the bit rate down, spread them out, or try the Natural Key Frames Only option in the Keyframes pull-down.

You can also lessen the codec's burden by using the Compare Uncompressed Frames checkbox with some discretion. When checked, the difference (delta) frames are generated by comparing the current frame to the previous source (or uncompressed) frame. If left unchecked as a default, the codecs take the compressed previous frame and decode it before initiating the differencing.

You can only limit the data rate with the basic edition of Sorenson. As shown in Figure 3, Sorenson has other features built into the Developer's Edition, which are grayed out with the basic model. Clicking on the Options Settings will bring up a dialog box with default settings -- all of which are controllable if you have the Advanced version. For more information on the Developer's Edition, visit http://www.terran.com/products/SorensonVideoOverview.html


Figure 3. The Sorenson Video, Developer's Edition gives the codec more control over the video data rate, but these options are grayed out in the Basic Edition.

RealVideo Codecs

The RealSystem was designed especially for the Web and the earliest contender in this arena. When standard modems were 14K, Real introduced RealAudio to the world. As outlined below, their audio codecs are well developed and highly specialized for many different connections. Video codec development came next, with new versions introduced each year -- requiring new player downloads for users.The latest version of this system is called "G2," with an announcement of Real 8 video at their Developer's conference in May. Terran also announced support for Real 8, although not yet commercially available. Figure 4 shows the many presets available in MCP for Web Audio and Web Video. You can choose Realtime for Streaming, the WWW Movie Settings for progressive download, or the Surestream format for dynamic scaling of your streams. The WWW Movie presets select a higher overall bit rate for the stream than the Realtime settings.


Figure 4. There are many presets for encoding RealMedia in MCP and standard compression parameters can be set in the Compress Panel.

Single Stream, G2 Codecs

The RealVideo codecs are selected under the Compress Tab of the Advanced Setting Panel. For full backwards compatibility, the straight RealVideo codec (listed first in the Codec pull-down) is your option. If you want to take advantage of Real's latest server technology commercially available, use the G2 codec. G2 with SVT (Scalable Video Technology) is incorporated into the most recent G2 player, which can drop frames dynamically in order to keep up with a stream. This allows the encoder to supply a higher image quality for higher connections. RealVideo 8 is only available in the beta version of MCP 4.0.3 and won't be covered here.

The standard options for Frame Rate, Inserting Key Frames, and Setting Data Rate are available in the Compress Tab shown in Figure 4. Inserting Keyframes is not a default for Real because it has proprietary intelligence built into the encoder for this task. If you are looking for higher quality at the expense of a higher bit rate, select this option and experiment with the Keyframe Timing parameter.

Real does not give access to many other compression settings, other than allowing user's to select priorities for final quality. In the Video Prefs pull-down, shown in Figure 5, you can choose to give more or less weight to the quality of your images or the motion in your video by choosing Sharpest Image or Smoothest Video, respectively. Normal Quality will balance these two elements while Slideshow produces the highest image quality possible at a very low frame rate.


Figure 5. Real's Video Prefs pull-down allows the user to prioritize image quality or motion rendition in their encoded stream.

RealSystem also allows you to prioritize audio or video when network connections become congested. If you chose Audio Quality in the 'During Congestion, favor' pull-down (only available when using the RealServer system), expect dropped frames or frozen video when congestion occurs on a network. Conversely, choosing 'Video Quality' will result in skipped audio tracks during congestion. Most users would prefer the former.

Surestream Scalability

Surestream is Real's technology for dynamically scaling the content you serve based on the actual connection speed of your client. MCP encodes multiple streams in one file by selecting the Surestream format in the StreamType pull-down of the Output Tab, as shown in Figure 6. Select the connections you want to target within one Surestream and RealServer will provide the highest possible bit rate stream within the file based on the actual connection. The user can also select his/her connection in the player application to limit the amount of data to stream and the Surestream will deliver an appropriate bit rate to them as well.


Figure 6. SureStream allows different bit rate streams in one file.

After selecting the general speeds you want in your Surestream, notice the Compress Tab now has multiple selections for codecs and bit rates, as shown in Figure 7. A 'Max fps Parameter' is also included in case the encoder or client cannot maintain the designated frame rate. It will naturally drop frames in order to provide continuous playback performance.


Figure 7. Each component of a SureStream can have a different bit rate, frame rate and audio format.

Windows Media Codecs for the Web

Microsoft's Windows Media (WM) architecture also encompasses many delivery mechanisms, but the familiar .ASF format (Active Streaming Format), is clearly targeted at the streaming media market.

When Microsoft entered the web video market, they adopted the still-in-development standard MPEG-4 codec for their system. Since it is not a true MPEG-4 implementation, they renamed the codec, "Windows Media Video Codec."

When you select the Compress tab in the Advanced Settings and pull down the codec menu, note the options available for codecs in the Windows Media format. This section will concentrate on the MPEG-4 codecs -- the most prevalent on the web.

The latest version of the MPEG-4 codec is the one to choose for your WM video. On the Windows platform, it is currently 'V3' (on the Mac it is 'V2' until Microsoft provides the codec in the Mac API). An older version may provide better backwards compatibility, but since the Windows Media Player is built into all Windows systems and freely distributed, this shouldn't be a concern when delivering .ASFs.

If you check 'Options' in the Compress Panel and click on 'Set,' the dialog box shown in Figure 8 appears with Windows Media Codec Options built into the Windows Media Encoder application. You can set the Key Frame Interval, which WM Encoder refers to as Iframes. The default is 8, but you can experiment with 4 or 6 if you want higher quality at the expense of a higher bit rate.

The Compression Control Slider (as shown in Figure 8) has a scale from 0 to 100, referring to the smoothness or crispness of the image. If the motion in your video is important, edge the slider toward the low end for better smoothness. If image detail, such as text or edges, is more important, designate a higher setting for more crispness.


Figure 8. Configuration of Microsofts MPEG-4 codec is done by setting the Options in the Compress panel, bringing up this dialog box.

The Data Rate slider has a scale from 1 to 6000 in kilobits per Second (kbps), thereby making it difficult to set with accuracy. The best technique is choosing a rough number by moving the slider and fine-tuning using the left or right arrows -- adjusting your selection by increments of 1. In order for MCP to perform the data rate control, set the data rate in the main compress panel by checking the 'Video Data Rate' box and entering a target in the dialog box labeled, "Kilobits Per Second."There's one important nuance of MCP, version 4.02, deserving your attention. In order to save the Windows Media Options in this window, you need to select 'Cancel' rather than 'OK.' Note: According to Terran, this will be fixed in an upcoming version.

Intellistream and Scalability

Microsoft's current technology for dynamic scalability is called Intellistream. On a basic level, it works like Real's Surestream, whereby one file contains different bit rates and the server-client connection determines which is sent at any given time during the stream.

When creating an Intellistream in MCP, the limit is two video tracks and one audio track; meaning you can only incorporate two different bit rates into one file and both of those need to have the same audio bit rate and encoding format.

The Compress Tab of the Intelligent Stream presets in MCP contains a second panel under Video Data Ratefor Video 2. This is where you enter the bit rates for the two video tracks. Otherwise, both tracks must have common frame rates, keyframe rates, and other options.

Wrapping Up

Media Cleaner Pro covers all the major compression technologies for the web in great detail. Here we've discussed the video codecs most often used for QuickTime, Real and Windows Media. Look for future tutorials to cover the new developments in these technologies as they unfold.

Streaming Covers
Free
for qualified subscribers
Subscribe Now Current Issue Past Issues