Requirements

Prerequisite knowledge

You should have a basic knowledge of the Flash Professional user interface and a basic knowledge of working with FLA files. Certain features, such as H.264 codec support, are available only in Flash Player 9.0.115 and later.

User level

Beginning

Before you can add on-demand (prerecorded) web video to your web page, you must acquire the video and encode it, which involves converting it to a format compatible with Adobe Flash Player (FLV or MPEG-4).

This section of the Video Learning Guide for Flash provides information on how to encode on-demand video, including background information about how web video is encoded and how to get best results when capturing video. We assume that you already have some video in a format other than FLV or a compatible version of MPEG-4. Many leading video editing tools allow you to capture video directly from your digital video camera. For some tips on capturing video, see the later section, "Capturing good video."

Robert Reinhardt's bitrate calculator helps you determine the optimal bitrate at which to encode your videos. See the FLV bitrate calculator links at the top of this page.

Note: To capture and publish live video, use Flash Player and Adobe Flash Media Server. For more information, see the Flash Media Server Developer Center. For higher-quality live video, you can also use Flash Media Live Encoder.)

Encoding FLV and F4V video files

Flash Professional CS5 provides several video-encoding solutions that let you encode your video clips into the FLV or F4V format.

Video Import Wizard

The Video Import Wizard lets you encode video clips into the FLV format when you import them. However, the Video Import wizard has limitations in that you can only encode one video clip at a time, and the process of encoding can be both time- and computing-intensive.

For users who work extensively with video-based content, Flash Professional CS5 includes Adobe Media Encoder and the QuickTime Exporter.

Adobe Media Encoder

The Adobe Media Encoder lets you batch process video clips, allowing you to encode several clips at a time without having to interrupt your workflow. In addition to selecting encoding options for video and audio content, Adobe Media Encoder also lets you embed cue points into video clips you encode, and edit the video using crop-and-trim controls.

For more information, see the online Help for the Adobe Media Encoder application as well as the article, Using Adobe Media Encoder CS5.

Note: Both the Video Import Wizard and the Adobe Media Encoder allow you to export encoding and cue point settings to XML files for reuse across other video production efforts.

About H.264, On2 VP6, and Sorenson Spark video codecs

A codec is an encoding/decoding algorithm that controls how video files are compressed during encoding, and decompressed during playback. H.264 is recommended for high-definition (HD) video. By default, Adobe Media Encoder exports encoded video using the On2 VP6 video codec for use with Flash Player 8 or later. Adobe Premiere Pro and After Effects (along with a multitude of third-party encoders) allow you to export encoded video using the H.264 video codec for use with Flash Player 9 or later.

If your content dynamically loads web video (using either progressive download or the Flash Media Server for streaming), you can use VP6 video without having to republish your SWF for Flash Player 9, as long as users use Flash Player 8 or later to view your content. By streaming or downloading VP6 video into SWF versions 6 or 7, and viewing the content using Flash Player 8 or later, you avoid having to recreate your SWF files for use with Flash Player 9. See Table 3 for more details.

Note: Although you can publish your SWF to be compatible with earlier versions of Flash Player, only Flash Player 8 or later supports playback of VP6 video.

Table 3. Publish and playback differences among video codecs

Codec Content (SWF) version (publish version) Flash Player version (required for playback)

Sorenson Spark

6 and later 6 and later

On2 VP6

6 and later 8 and later
H.264 9 and later 9 and later

Note: Adobe CS5 products no longer support encoding FLV files using the Sorenson Spark codec. FLV files previously encoded with the Spark codec can be viewed in Flash Player and imported into Flash Professional, but the codec cannot be encoded from Adobe products.

Capturing good video

In addition to the physical properties of your video there are a variety of factors that affect the efficiency of the encoder and, ultimately, the user experience of the video playback. Two factors play a significant role in the encoding process: source quality and frame motion.

Source quality

You determine the source quality of your video as soon as you press the recording button on your camera. The following are some basic guidelines for getting great source video quality and maximizing quality in your final compressed video.

  • Use a tripod to reduce camera movement. If your camera is not steady, most of the image moves, causing a high percentage of pixels in the video to change from frame to frame. A steady camera reduces the number of pixels that change from frame to frame, giving you better quality at higher compression rates (lower data rates).
  • Use good lighting techniques. A high-end camera resting on a tripod can still produce a low-quality image if there is not enough light. Low-light or light-gain filters produce video noise on the image. This noise is different for each frame of video and makes it difficult for the codec to compress the file at a good quality. You may need to use or exceed your maximum data rate to compensate for video noise.
  • Use the best camera possible. Low-grade cameras—specifically consumer-based ones that record an analog signal on magnetic tape (VHS, Hi-8, and so on)—produce much video analog noise. Still digital cameras in movie mode also have limited quality and generally produce high-noise video clips. Even if the camera is on a tripod, with excellent light, it will produce noise.
  • Do the best you can with what you have to work with. You do not need to have access to professional equipment, a tripod, and excellent lighting conditions. Just remember that the higher the quality of your video source, and the less noise in that source, the lower the data rate required to render a good playback file.
  • Whenever possible, always encode a file from its uncompressed form. If you convert a pre-compressed digital video format into the FLV or F4V video format, the previous encoder can introduce video noise. The first compressor has already performed its encoding algorithm on the video and has already reduced its quality, frame size, and rate. It may have also introduced some of its own digital artifacts or noise. This additional noise affects the encoding process and may require a higher data rate to play back a good-quality file.

Frame motion

Frame motion is another factor to consider in your encoding formula. It is the percentage of the pixels that change from one frame to another. This change can result from a person or object moving, camera effects, or post-production effects, such as the following:

  • People and objects moving can include someone walking past the lens, tree leaves blowing in the wind, cars driving by, or an extreme close-up of a face.
  • Camera effects such as camera panning, zooming, or shake from a hand-held camera result in almost 100% pixel change from frame to frame.
  • Postproduction effects such as dissolves, fades, wipes, or complex video effects result in a high percentage of pixel changes from frame to frame.
  • Excessive zooming and rolling can hinder temporal compression schemes. (Panning isn't as bad, since most modern encoders use motion vectors to account for linear motion of groups of pixels.)
  • Unstable (shaky) video is more difficult to compress, so shoot video with a tripod to minimize the shaking of the camera.
  • Auto-focus and auto-exposure features change the appearance of all of the pixels in an image from one frame to the next, making compression using interframe encoding schemes less efficient.

The greater the motion within your video clip, the more information the encoder has to compress. If your clip is relatively still (such as a talking head video), there isn't much pixel change from frame to frame. The video compressor uses a method of dropping frames and then encoding a series of fully uncompressed frames. These uncompressed frames, called key frames, are used to calculate and "rebuild" the missing frames during playback.

Best practices for encoding on-demand video

When you encode on-demand video, you must balance a variety of factors, including amount of motion depicted, file size, target bandwidth, frame rate, keyframe interval, and the pixel dimensions of the video.

You can specify values for some of those factors when you encode video for playback in Flash Player. A few of these settings are discussed in general terms in this section; for technical details on some of the other settings, see the NTSC and PAL video standards section of the Video Learning Guide for Flash. 

The following are some general guidelines to follow when compressing video to FLV or F4V format for web delivery:

  • A higher target bandwidth (also known as the data rate) allows for more motion in the video, larger files, better frame rates, and larger pixel dimensions.
  • The less motion there is in your video, the smaller the file size, which lowers the target bandwidth you can reach.
  • As motion increases, you must decrease the key frame distance, and increase the bitrate for the video file to maintain comparable image quality. High-motion clips require more information to flow to the player. They are not good for low-bandwidth delivery because they require additional uncompressed key frames to be encoded in the file.
  • Reduce frame size when bandwidth is limited and frame rate and quality are important.

About bit rate

Bit rate is the amount of data transferred per second. When you encode your video, you specify a bit rate for the encoding. Choose a bit rate appropriate to your audience; for example, if most of your visitors are likely to be using 56 kbps modems, don't provide video encoded at a bit rate of 2 Mbps. For further assistance, check out the web video bitrate calculator.

About key frames

FLV video is encoded as a sequence of key frames (full-frame uncompressed images taken from the video at regular intervals), each of which is followed by information about how to change the pixels of the key frame to produce the delta frames between that key frame and the next. During playback, the decoder recreates the delta frames based on the key frames.

The key frame interval is the number of delta frames between key frames. The greater the interval between key frames, the harder it is for the decoder to recreate the missing frames. Also, if your key frame interval is too great, you may not have a large enough data rate to compress and transmit the data bits. Therefore, a high-motion video clip with a large key frame interval results in the perception of poorer quality.

With FLV video, key frames are particularly important if your presentation approach provides a seek or scrub feature, which allows a user to advance the stream during playback.

Note: To allow accurate seeking and scrubbing in a video, you must stream the video with Flash Media Server or Flash Video Streaming Service. To allow seeking to specific locations within a progressive video, you must embed navigation cue points for those locations (timecodes) during encoding. Embedding navigation cue points forces the encoder to place a whole keyframe at the specified timecode, which is the necessary ingredient for accurate seeking.

Where to go from here

For more on encoding, see Understanding the video encoding ecosystem for Flash. For information about support for MPEG-4 files using the H.264 video codec, see Supported technologies: H.264.

To capture and publish live video, use Adobe Flash Media Server. For more information, see the Flash Media Server Developer Center. For higher-quality live video, you can also use Flash Media Live Encoder.

Also be sure to check out other sections in the Video Learning Guide for Flash.