Home / Articles / Adobe Flash / Video with Adobe Flash CS4 Professional: Compression and Encoding Primer

Video with Adobe Flash CS4 Professional: Compression and Encoding Primer

  • Book Excerpt is provided courtesy of Adobe Press.
  • Date: Sep 15, 2009.

Article Description

Learn how to make the right decisions when it comes time to compress digital video and audio into Flash-compatible video files.
Determining Your Video Compression Profiles

Determining Your Video Compression Profiles

Now that you have a thorough understanding of your files, bit rates, and codecs, you’re ready to create one or more compression profiles for your Flash-compatible video content. A compression profile specifies, at minimum, the bit rate (or data rate), frame size, frame rate, and keyframe interval for the compressed video output, in addition to the bit rate of the audio track. Some video encoders also let you specify constant bit rate (CBR) or variable bit rate (VBR) encoding. You should plan your compression profile before you encode your video.

Total bit rate

The first number you need to determine for a compression profile is how much bandwidth your video clip requires for delivery. You can then divide the total bit rate between the video and audio tracks.

The bandwidth you should require from a viewer isn’t necessarily equal to the bit rate you use for a clip. Why is this the case? Simply put, a viewer’s Internet connection speed can fluctuate immensely during playback of video—the longer the clip, the more likely the viewer will experience a disruption with connection speed. Many video producers prefer to specify a total bit rate between 70 and 80 percent of the target bit rate. For example, if you’re targeting cable-modem viewers with a tested 768 Kbps download rate, you use a total bit rate of 614 Kbps. Some video producers require twice as much available bandwidth as the video clip requires.

Audio bit rate

Of course, most video content isn’t complete without the audio track. After you’ve determined the total bit rate, determine the bit rate necessary to reasonably reproduce the audio content of your original source. Unless you’re targeting dial-up modem connection speeds, you should use at least 24 Kbps with the MP3 or AAC codec for a mono (single-channel) audio track. Higher-fidelity audio tracks, such as music sound tracks, benefit from higher audio bit rates, such as 48 Kbps (AAC) or 96 Kbps (MP3). Whatever audio bit rate you use, subtract the value from your total bit rate value to determine how much bit rate is left for the video bit rate.

Video bit rate

As you learned earlier, the video track has its own specific bit rate, or data rate. The bit rate you choose for a piece of content should support the frame size and frame rate you want to use. If you specify too little bit rate, the visual quality of your video content suffers. The bit rate for a video file should be based on the bandwidth demands you’re willing to require from your target audience.

Frame size

The width and height of video destined for computer playback should be kept to a square pixel aspect ratio. Any nonsquare pixel aspect video, such as DV or HDV, should be adjusted for computer playback. For example, a DV source file with a 720 by 480 frame size can be resized during the encoding process to 640 by 480, 480 by 360, 320 by 240, 160 by 120, and so on. Similarly, HDV content with a 1440 by 1080 native nonsquare pixel frame size should be resized to 1920 by 1080, 1024 by 576, 768 by 432, 512 by 288, 256 by 144, and so on. You should determine the frame size of your video content in conjunction with the frame rate of the video, as you learned earlier with compression formulas.

Frame rate

The frame rate of the video content should be in ratios of the source frame rate. For example, if the original video frame rate was 30 fps (or 29.97 fps), you should use 30 fps, 15 fps, or 10 fps. The frame rate should reasonably convey the sense of movement in the original content. If your content contains fast-moving subjects, use a higher frame rate. However, as you increase the frame rate, you may need to reduce the frame size of the video to retain reasonable visual quality for a specific bit rate.

Keyframe interval

Video keyframes are a lot like keyframes in Flash tweens; a keyframe specifies a significant point of action in a range of frames in the video clip. A keyframe, also called an i-frame (short for intraframe), is used as a starter frame, drawing the initial visual layer of the video. The following frames, also called p-frames (short for predictive frames), store only the changes in the video frame from the previous keyframe. When you compress video to the FLV or H.264 format, your encoder enables you to specify the frequency of keyframes in your clip, also known as the keyframe interval. Keyframes are best inserted in multiples (or fractions) of your compressed file’s frame rate. For example, if you’re using a frame rate of 15 fps, you might use a forced keyframe interval of 150 frames (one keyframe will be generated every 150 frames). Some encoders allow you to select automatic or natural keyframes, which essentially tell your encoder to make a keyframe whenever enough of the video frame has changed.

The keyframe interval can greatly affect the quality of the overall video clip. If the encoder creates too many keyframes for an allocated video bit rate, the visual quality degrades. If you create too few keyframes, you may not be able to seek or scrub the video very smoothly or accurately. As a rule for higher-quality Web-deployed video, having too few keyframes is better than having too many. The expression bit budget refers to how the bits of a video bit rate are spent, and keyframes use more bits than other frames in your Web video. Figure 3.5 attempts to visualize a bit budget for a theoretical bit rate, representing high-quality keyframes with $10 bills and low-quality keyframes with $5 bills. If the 17 frames of the video use a keyframe interval of 8, then only 3 keyframes are created in the sequence. On the other hand, if the keyframe interval was decreased to four, then five keyframes are created in the sequence. The additional keyframes require more of the bit budget, and, as a result, the quality of the keyframe is reduced—not as many bits are available for the additional keyframes. Remember, the video bit rate is a relative constant in this hypothetical example.

Figure 3.5 A representation of bit budget and keyframe intervals.

In the real world, you can quickly see the result of creating too many keyframes. Figure 3.6 shows a frame pulled from a 30 fps 1265 Kbps video clip that uses a keyframe interval of 1, meaning every frame is a keyframe. With so many keyframe “mouths” to feed, the video quality suffers horribly. Figure 3.7 shows a frame pulled from the same source video clip with an identical video bit rate using a keyframe interval of 60, or one keyframe every two seconds. The image quality improves immensely. Finally, Figure 3.8 shows the source video clip compressed with a keyframe interval of 300. The finer details of the subject and background become sharper.

Figure 3.6 A video frame from a compressed clip using a keyframe interval of 1.

Figure 3.7 A video frame from a compressed clip using a keyframe interval of 60.

Figure 3.8 A video frame from a compressed clip using a keyframe interval of 300.

One important consideration for keyframe intervals used with Flash-based video is the ability to seek to more points of the video clip. With ActionScript, you can seek only to keyframes within the video clip—if you try to seek to a time in the clip that doesn’t contain a keyframe, Flash Player jumps to the closest keyframe. You may notice this phenomenon when you scrub a video clip; the frequency of updates while scrubbing indicates the number of keyframes. However, if you use enhanced seek with video content served by Flash Media Server, the server can generate keyframes on the fly—enabling a viewer to scrub the video more smoothly.

H.264 content using the Main or High profile can utilize another special video frame type called a b-frame, or a bi-predictive frame. B-frames are one of the primary reasons that the Main and High profiles can have a substantially better image than a video using the Base profile. B-frames can refer to past or future frames. How can this be so? How can a frame borrow details from a frame that has not yet played? The encoder can arrange frames out of sequence as they’re written to the compressed video file. On playback, the decoder knows to display the sequence in the correct order—a process known as frame reordering. For example, if you had a sequence of frames such as this:

0 1 2 3 4 5 6

and the encoder wanted to make frame 3 a b-frame that referred to data in frames 2 and 4, the frames would be stored in the following sequence:

0 1 2 4 3 5 6

Upon playback, the decoder reorders the frames to the original sequence. B-frames, though, are more processor-intensive as a result of the frame reordering operation. The b-frame count refers to the number of b-frames per keyframe interval, or GOP. The general rule of thumb is to use a b-frame count of three or lower.

CBR and VBR encoding

Most video encoders support two types of video data rates: constant bit rate (CBR) and variable bit rate (VBR). If you intend to stream video files from a Flash Media Server or streaming video service provider, you should use CBR encoding. CBR encoding ensures a stable predictable bit rate, which means you can avoid potential pitfalls with rebuffering. If you intend to serve video content from a Web server (over HTTP) or a local source such as a CD or DVD, use VBR encoding. VBR encoding enables the encoder to spike the data rate for more complex areas of the video clip and reduce the data rate for visually simpler parts. Figure 3.9 demonstrates the potential effect of a VBR versus CBR with a video clip encoded with an average video bit rate of 500 Kbps. The VBR version is allowed to exceed the average bit rate at a difficult section, while the CBR version stays within tight limits of the average bit rate.

Figure 3.9 The bit rate of a VBR clip plotted against a CBR clip.

Some video encoders let you choose one- or two-pass encoding procedures with CBR or VBR encoding. You’ll usually see better visual results with any two-pass encoding setting. Using two-pass encoding requires twice as much time to encode the source video as one-pass encoding. A two-pass encoding procedure involves one pass where the encoder analyzes the video content to see where bit rate peaks can be optimally applied and a second pass where the information gathered during the analysis pass is applied to video output. A bit rate peak is a point or span of time in the content where there is more data than the average bit rate value allows. With VBR encoding, a section of video that requires less bit rate to encode can offer more bit rate to a more difficult section of video. Consider a video clip showcasing a segment with a talking head video and another segment with fast-paced action scenes. The talking head footage may not need as much bit rate as the action content. Therefore, the bit rate savings in the talking head footage can be applied to the action content, allowing the action content to have a data rate in excess of the average bit rate of the entire video clip.

Adobe Press Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from Adobe Press and its family of brands. I can unsubscribe at any time.


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about Adobe Press products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information

To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.


Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites; develop new products and services; conduct educational research; and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.


If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email ask@peachpit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information

Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.


This site is not directed to children under the age of 13.


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information

If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.


Users can always make an informed choice as to whether they should proceed with certain services offered by Adobe Press. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.adobepress.com/u.aspx.

Sale of Personal Information

Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents

California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure

Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact

Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice

We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020