What You Should Know About Video
What You Should Know About Video
If you are a Flash developer but new to video, here are a few tips and pitfalls to avoid:
Frame size: Standard-definition NTSC video—the format most commonly used in the United States—is usually digitized to 720 x 480 pixels. Ignore these dimensions. Before encoding the video, resize it to a 4 x 3 ratio—for example, 640 x 480, 320 x 240, and so on (see the next section). Or else crop and resize it to a 16 x 9 ratio—for example, 640 x 360, 320 x 180, and so on. In case you ever work with various wide-screen formats—such as 2.35:1—crop the letterboxing, assume a 640-pixel width, and get out the calculator.
Although these ratios are standard, and should be used to avoid distorting the video, the size of the encoded video is not set in stone. The original web video sizes used heights and widths that were evenly divisible by 16. This was mandatory for many early codecs. Although this is not necessary for modern codecs, you should stick to even heights and widths.
Interlacing: When video is intended for television, it is interlaced. Each frame is made up of two fields of interlaced lines. On a computer monitor this is seen as a comb effect because one field is 1/60 of a second ahead of the other. Interlaced video should be deinterlaced before encoding.
If the original source was film, the interlacing may occur in a three-progressive-frames, two-interlaced-frames pattern. This common method of telecining converts the original 24 frames per second (fps) film frames to 29.97 fps video frames. It is possible to use inverse telecine to return the video to its original 24 frames.
- Frame rate: Your video projects will usually be at 30 fps or will have been inverse-telecined to 24 fps. If you want to lower the frame rate, you should use equal divisions of the source frame rate. For 30 fps, use 15 fps, 10 fps, 7.5 fps, and so on. For 24 fps, use 12 fps, 8 fps, 6 fps, and so on.
Converting Frame Sizes
Frame size (mentioned in the previous section) brings up a number of confusing issues. Most confusing is the concept of square and non-square pixels.
Television presents video as horizontal lines. Computers present video as a grid of pixels. Both use a 4 x 3 ratio for standard video playback. The digitized version is referred to as a “square pixel” resolution.
Video is often digitized at what’s called a D1 resolution, which means 720 x 480 for NTSC and 720 x 576 for PAL. Within the world of the 4 x 3 standard, these are referred to as “non-square pixel” resolutions—NTSC pixels are wider at a ratio of 1.1:1 or 11/10, while PAL pixels are slightly taller at a ratio of about 0.915:1 or 54/59.
So why convert your video to square pixels and take the 720 x 480 frame to 320 x 240 or other legacy format? On one hand, that’s the way it’s always been done. But there’s also no reason to use the non-square pixel dimensions if the encoded file will be played on a computer screen.
Since the early days of video, D1 has been the “legal” resolution. However, these are not the resolutions at which the vast majority of people watch video. As I mentioned earlier, television presents video at a 4 x 3 ratio screen size. When computers came along, screen resolutions did the same. Early computer monitor resolutions were 480 x 360 and 640 x 480 pixels; my current favorite is 1280 x 960.
Practically speaking, you should use the D1 resolution for videotape and DVD; use a 4 x 3 ratio for computer playback. A standard conversion from D1 to 4 x 3 would begin as follows:
- Capture at 720 x 480 pixels.
- Deinterlace or inverse-telecine the video (see the previous section).
- Crop eight pixels from the left and right sides (so it’s 704 x 480).
- Resize the video to 640 x 480 pixels.
From here you may crop out further edge noise, crop out letterboxing, do further resizing, and so on. Everything from Step 4 onward is based on a 4 x 3 ratio.
There are times when I want to capture and de-interlace on the fly. In that case, the process would be as follows:
- Capture at 360 x 240 pixels.
- Crop four pixels from the left and right sides (so it’s 352 x 240).
- Resize to the video to 320 x 240 pixels.
Once again, the target is a 4 x 3 resolution and the 360 x 240 resolution is only an intermediary step.
When you compare 720 x 480 and 640 x 480 video side by side on a computer screen, you’ll see the most practical answer of all as to why you want to make the conversion: “That one looks stretched out!”