Accessibility

Dialog Box

Encoding Flash Video


Table of Contents

Use custom settings

Having completed your preflight, you should have a good idea of your bandwidth strategy, the dimensions of the video, and its frame rate. With that information in hand, you can now concentrate on creating an FLV file.

If there is a complaint we regularly encounter, it is this: “I use default values all the time and still get lousy results. What's with that?” The answer is that using the default settings are like throwing grenades. The default values in the Flash 8 Video Encoder settings are, at best, rough approximations aimed at general usage.

In the Encoding Settings pane, you should:

  • Ignore the suggested encoding profiles.
  • Name the file. The file saves to the location of the video you're encoding.
  • Click the Video tab.
advanced settings

Figure 3: Ignore the defaults, name the file, and click the Video tab.

Click the Video tab to open the Flash Video Encoding Settings panel, where you need to make several extremely important decisions—starting with which codec to use. The two codecs in the video codec pop-up menu are Sorenson Spark and On2 VP6. As pointed out earlier, the codec you choose is directly tied to Flash Player version you have targeted. Choose On2 VP6 only for projects targeted for playback through Flash Player 8 and Flash Player 9. If your project contains an alpha channel, target Flash Player 8 or Flash Player 9. For Flash Player 7 or earlier, your only choice is Sorenson Spark.

Now you need to select the frame rate for the FLV file. If you click the Frame Rate pop-up menu, you will be presented with a number of choices ranging from the same frame rate as the video to be encoded to a frame rate of 30 fps. Check the notes you created when you previewed the video in either QuickTime or the Windows Media Player. The frame rate should either be 12 or 15 fps for most applications.

Note: Like all rules, this one can be broken. One of us prepared several video tutorials using screen capture software. These captures are usually done at a physical size of 640 × 480 and, in order to ensure smooth browser playback, the frame rate for the video tutorials is 5 fps. You can change the frame rate by selecting the value in the Frame Rate field and entering the value using the keyboard.

Keyframes and file size

The next decision you will make is keyframe placement. Your choices in this pop-up menu are Automatic and Custom.

In many respects, a video is like a series of images on a timeline. Each image needs to be drawn, which explains why digital video files can be rather hefty in size. To reduce the size of the video file and the hit on the processor, digital video employs two types of frames: keyframes and difference (or delta) frames.

A keyframe in a video contains the entire image. A difference frame (if you could see it) contains only the differences between the frames. If you were to film somebody walking in front of a wall, the keyframe would look like a Photoshop image and would contain the person and all of the details in the wall. A difference frame, on the other hand, would not contain the wall because it hasn't changed. The information in the difference frames is not lost; it is simply stored and added back into the frame when the video plays back.

This is a critical concept to understand, because it has a major impact upon the final file size of the FLV file. Let's assume a video is composed of nothing but keyframes and is encoded at 15 fps. If each frame of the video is 15KB, one second of video would be 225KB. Now let's apply one keyframe per second. This means at frames 1 and 15, the full image is in place, but the 13 frames between are difference frames that, for illustration purposes, each have a file size of 5KB because the stuff that doesn't change has been removed. The file size of that one-second clip plummets to 95KB.

Both the On2 VP6 and Spark codecs spread the keyframes out even further. It is not uncommon, for example, to see them place a keyframe every 300 frames. If you do the math, you will clearly understand why FLV files are typically around 10% of the file size of the original video.

In three hundred frames of a video played back at 15 fps, there is one keyframe for every 20 seconds of video. Using our previous example, the size of the video with one keyframe every second weighs in at 1.9MB. An FLV file with keyframes spaced every 300 frames results in a 20 second video that has a file size of 1.5MB.

The other factor that plays into FLV quality and keyframes is the movement in the video. If the video contains Formula 1 racers zipping by or lots of pans and zooms, the keyframes need to be close together. If the video contains nothing more than a tree in a farmer's field, the keyframes can be spread apart with no quality loss. This is why we suggested you watch the video before encoding.

The great thing about digital media is that there are certain rules we live by when using software. The first rule is: Let the software do the work. That is, unless you are a seasoned digital video producer, it is best that you select the Automatic option in the Flash CS3 Video Encoder settings. When you select Automatic, the codec scoots through the video looking for areas with lots of changes (racing cars zipping by), or few changes (a tree in a field) and determines the keyframe placement for you. The major difference between the Spark and On2 VP6 codecs, apart from Flash Player version specificity, is the On2 VP6 codec typically does a better job using fewer keyframes than its Spark counterpart.

first step

Figure 4: Choosing the codec, frame rate, and keyframe placement is the first step in the process.

If your FLV files still need to go on a size diet, you may want to override the Automatic keyframe setting by specifying a custom keyframe interval. For general usage, an interval of 5 seconds is a good place to start—simply multiply your target frame rate (using the example above, 15 fps) by 5 (seconds), and enter the result (in our example, 75 frames) in the Keyframe Interval field. If your video quality is poor, reduce the interval by a second (15 frames) and try again. Unfortunately, the best way to preview different keyframe settings is to render versions at different interval values, and compare them visually. But that's why we all love the batch processing available in the Flash 8 Video Encoder, right? Just set up your renders and let them process overnight so you can let your computer do the heavy lifting.