Accessibility

Flash Article

 

Flash video learning guide


Table of Contents

Comments

Capturing and encoding video

Before you can add on demand (pre-recorded) 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 provides information on how to encode on-demand video, including background information about how web video is encoded and about how to get best results when capturing video.

This section assumes 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 Capturing good video.

Web video bitrate calculator

Robert Reinhardt

Determine the optimal bitrate at which to encode your video files using this online calculator developed by Robert Reinhardt.


For information on how to convert (encode) your existing video to FLV format, see the Encoding and creating Flash video (FLV) files section below.

For more 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 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 and creating Flash video files

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

Flash Video Import wizard

The Flash 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 CS3 Professional includes the Flash CS3 Video Encoder and the QuickTime Exporter.

Flash CS3 Video Encoder

The Flash CS3 Video 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, the Flash CS3 Video 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 included with the Flash CS3 Video Encoder application.

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

FLV QuickTime Export plug-in

If you have Adobe Flash CS3 Professional and Apple QuickTime 6.1.1 installed on your computer, you can use the FLV QuickTime Export plug-in to export FLV files from supported video editing applications. You can then import these FLV files directly into Flash to use in your Flash documents.

The following video editing applications are supported by the FLV Export plug-in:

  • Adobe After Effects (Windows and Macintosh)
  • Adobe Premiere Pro (Windows and Macintosh)
  • Apple Final Cut Pro (Macintosh)
  • Apple QuickTime Pro (Windows and Macintosh)
  • Avid Xpress DV (Windows and Macintosh)

Using the FLV QuickTime Export plug-in to export FLV files from either Flash CS3 Video Encoder or video-editing applications significantly streamlines the process of working with FLV files in your Flash documents. With the FLV Export plug-in, you can select encoding options for video and audio content as you export, including frame rate, bit rate, quality, and other options. You can import FLV files directly into Flash without needing to re-encode the video after import.

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

A codec is a compression/decompression algorithm that controls how video files are compressed during encoding, and decompressed during playback. The On2 VP6 video codec is the preferred video codec to use when creating Flash content that uses video; it provides the best combination of video quality while maintaining a small file size. H.264 is recommended for high-definition (HD) video. By default, the Flash CS3 Video Encoder exports encoded video using the On2 VP6 video codec for use with Flash Player 8 or later, and the Sorenson Spark codec for use with Flash Player 7. 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 Flash 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 Flash 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 6, 7, 8, 9
7 7, 8, 9

On2 VP6

6 8, 9
7 8, 9
8 8, 9
9 9
H.264 9 9

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. High-end digital cameras, Digital Betacam camcorders, and 35mm film cameras produce a clean image if the scene is well lit and they are stabilized by a tripod. Such a scenario produces the best compression ratio and lets you reduce the data rate while maintaining excellent quality. However, you may not have access to professional equipment, a tripod, and excellent lighting conditions. Just remember: 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 Flash 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 Flash video 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 hand-holding 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.

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 keyframes, 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 Flash video. A few of these settings are discussed in general terms in this section; for technical details on some of the other settings, see Overview of video standards

For detailed information about specific values to use for various settings, see Kevin Towes' article, Encoding best practices for prerecorded Flash video. This article provides a table of recommended settings.

The following are some general guidelines to follow when compressing video to Flash video for delivery over the Internet:

  • A higher target bandwidth (also known as 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 the target bandwidth decreases, reduce the keyframe rate. A lower keyframe rate (such as one keyframe every six seconds) will result in a softer or blurrier image but reduces the bandwidth demand.
  • As motion increases, you must increase the keyframe rate, the frame rate, and the data rate. High-motion clips require more information to flow to the player. They are not good for low-bandwidth delivery because they require additional uncompressed keyframes to be encoded in the file.
  • Reduce frame size when bandwidth is limited and frame rate and quality are important.
  • If the video source you are encoding comes directly from a video camera, always enable de-interlacing and set the Flash Video Encoder to the upper field. If your video is interlaced, selecting this option increases the performance of the video encoding and playback.

About bit rate

Bit rate is the amount of data transferred per second. When you encode Flash 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 keyframes

Flash video is encoded as a sequence of keyframes (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 keyframe to produce the delta frames between that keyframe and the next. During playback, the decoder recreates the delta frames based on the keyframes.

The keyframe interval is the number of delta frames between keyframes. The greater the interval between keyframes, the harder it is for the decoder to recreate the missing frames. Also, if your keyframe 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 keyframe interval results in the perception of poorer quality.

With Flash video, keyframes 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.