Flash video encoding best practices
Overview of encoding settings
- Compression method - constant bit rate (CBR) vs. variable bit rate (VBR): CBR uses the same bit rate throughout the video, regardless of video motion or data complexity. VBR changes based on the content. VBR is preferred for progressive video encoding, as it results in optimal compression based on source video content. CBR is usually used for streaming video.
- Encoding passes - 1-pass vs. 2-pass encoding: 1-pass encoding analyzes the video once and then encodes. 2-pass analyzes the video twice, producing higher quality compression and better bit rates. However, 2-pass encoding takes longer. For higher quality results, 2-pass is the ideal method.
- Keyframe rate: Keyframes are fully rendered frames inserted at intervals or at a significant scene change in the video. Higher motion requires more keyframes. When you use more keyframes and higher video quality, you need a larger encoded file size and a higher data rate to render the video. When using a video scrubber, keep in mind that scrubbers can only seek to keyframes in the video. So you usually need more keyframes to get a scrubber to function smoothly. Also, frame rate, keyframe rate, and video length should match up to allow for a keyframe on the final video frame, which lets scrubbers function correctly. See When using a scrubber, below, for more details.
- Frame rate: The video frame rate is the number of frames displayed per second during playback. The higher the frame rate, the smoother the animation, but that also results in larger file size and greater demand on the viewer's processor during playback.
Here are some common frame rates measured in frames per second (fps):If you reduce the frame rate, reduce it to a number that divides evenly into the source video frame rate. If you don't use an exact factor of the source frame rate, the encoded video could have audio synching issues, particularly in longer video files. For example, if the source video frame rate is 29.97 fps, you could encode at half rate (14.985 fps), third rate (9.99 fps), or quarter rate (7.493 fps).
- NTSC - US TV Standard (29.97)
- PAL - European TV Standard (25)
- Film (24).
- Data rate or bit rate: This is the number of kilobits per second (kbps) that must transfer to view the video. The higher the data rate, the better the quality, but that also results in larger file size and greater bandwidth demand.
Here are some approximate average data rates:These are average guidelines. The best data rate depends on the source video and target bandwidth. The formula for calculating data rate is:
- high quality (700 kbps)
- medium quality (400 kbps)
- low quality (100 kbps).
Divide by 1000 to get the result in kbps, then divide further by the codec compression ratio (Sorenson's compression ratio is 2.5:1, so divide by 2.5) for the target data rate.
frame height x frame width x frame rate (fps) = total bits/sec.
Example: 320 x 240 x 30 = 230400 bits per second. Divide by 1000 to get 2304 kilobits per second. Divide by 2.5 and round off to get a target data rate of 922 kbps. You can use a lower data rate, but this results in lower-quality playback.
- Audio compression: If the video has background music, encode the audio at a minimum of 64 kbps in stereo for average quality playback. You can only encode videos with speech in mono, with an even lower data rate. Experiment to determine the best way that works with a given source video.