Home / Articles / Adobe Creative Suite / 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.
Understanding Video File Bit Rates

Understanding Video File Bit Rates

The bit rate of any video is the amount of data transmitted in a given unit of time, usually expressed in kilobits per second (Kbps) or kilobytes per second (KBps). The term data rate is synonymous with bit rate. Every video file on your computer has a specific bit rate. DV clips, for example, have a data rate of 30 megabits per second (Mbps), whereas a broadband-quality Web video clip can have a data rate of 500 to 1000 Kbps. The total bit rate of a video clip is divided between the video track and the audio track. The bit rate of the video track is referred to as the video bit rate, whereas the bit rate of the audio track is referred to as the audio bit rate.

The video bit rate of a given clip largely determines the visual quality of the video image. No matter how you slice it, a clip encoded with a lower bit rate shows less detail compared to the same source clip encoded with a higher bit rate. However, each video codec can utilize the same bit rate differently. One codec may be able to store more information per kilobit than another codec.

Variations within clip properties

Video bit rate is a unit of measure used to quantify how much information is stored within one second of video. You can use that quantity any way you want. Think of data rate like a specific length of material—you can have 3 feet of high-quality rope or 3 feet of low-quality binder’s twine. How well you use the bit rate of a video clip can determine the quality of the video a viewer experiences. Three primary factors determine how the video bit rate is utilized:

  • Frame rate: The frequency of video frames in your clip determines its frame rate, expressed as frames per second (fps). Higher frame rates have a lower bit rate per frame of video, whereas lower frame rates allow more data to be allocated per frame. Higher frame rates have smoother motion, and lower frame rates can exhibit jerky and unnatural-looking motion. Your content largely determines how much you can reduce the frame rate without destroying the flow of the clip.
  • Frame size: The width and height of your video clip determine the number of pixels in each video frame. You can think of video pixels like an allotment of grass seeds for a yard. For any given bit rate, you have only so many seeds. If you spread those seeds over a large area, your yard will be splotchy with large gaps between the blades of grass. If you concentrate the seeds, the yard will be smaller, but the grassy area will be rich.
  • Codec compression: Each video codec has its own method of compressing data. For Web video formats especially, two types of compression are usually applied: spatial (intraframe) and temporal (interframe). Spatial compression is similar to JPEG image compression: Redundant color information is thrown away to reduce storage requirements. Temporal compression stores only the changed information from frame to frame. More efficient codecs require less storage and deliver higher quality but usually require more processing power and computer memory (RAM) for video playback.

Every codec has an ideal bit rate after you’ve determined which frame size and frame rate you want to use. The following formula can help you determine whether your bit rate is acceptable as a starting point for encoding tests. For a list of each Flash Player–supported video codec’s divisor, refer to Table 3.1.

(Width x Height x Frame rate)  Compression = Bit rate (Kbps)

Table 3.1 Video Codec Compression Divisor

Codec

Compression divisor

Sorenson Spark (H.263)

6000

On2 VP6-E

7500

On2 VP6-S

7000

AVC/H.264 Base profile

6500

AVC/H.264 Main profile

8000

AVC/H.264 High profile

8250

If you want to compress a video file at 320 by 240 at 29.97 fps, the following formula is a good starting pointing as the average video bit rate for the Sorenson Spark codec (based on the H.263 codec), where 6000 indicates the compression divisor for Spark:

(320 x 240 x 29.97)  6000 ? 384 Kbps

Because the On2 VP6-E codec, or the VP6 codec using the E profile, requires less data rate for the equivalent quality, you can use a compression divisor of 7500:

(320 x 240 x 29.97)  7500 ? 300 Kbps

Flash Player 9 Update 3, or 9.0.115, added more video and audio codecs, including On2 VP6-S. The On2 VP6-S codec, or the VP6 codec using the S profile, requires a little more bit rate than VP6-E for the equivalent quality:

(320 x 240 x 29.97)  7000 ? 330 Kbps

The powerful AVC/H.264 codec was also added to Flash Player 9.0.115. Three profiles—Base, Main, and High—are now supported in Flash Player. The Base profile on average can achieve better compression than the Sorenson Spark codec but less than the VP6 family of codecs:

(320 x 240 x 29.97)  6500 ? 350 Kbps

On average, the Main profile of the AVC/H.264 codec can achieve better compression than all of the aforementioned codecs. The Main profile requires more processor power, though, than the Base profile:

(320 x 240 x 29.97)  8000 ? 290 Kbps

The High profile of the AVC/H.264 codec can achieve the best compression of all Flash Player–supported video codecs, at the expense of higher processor utilization, than the aforementioned codecs. The Main profile requires more processor power, though, than the Base profile:

(320 x 240 x 29.97)  8250 ? 280 Kbps

Each video encoding solution has its own set of compression profiles that try to match the best video width, height, and frame rate for these video codecs.

Variations within subject matter

The amount of video bit rate you need for a clip depends on its content. I prefer to place video content into one of three categories:

  • Average movement: If at least 25 percent of the pixels on any given frame of video remain the same, your video content isn’t updating frequently. Much of the content visible on prior frame(s) can be reused on subsequent frames. The bit rate formula in the previous section assumes your video exhibits average movement. Most video encoders and their presets assume your content has average movement in the frame. For example, a shot of a person walking across the room to pick up a glass might contain average movement.
  • Slow movement: If fewer than 15 percent of the pixels on any given frame change from frame to frame, your content is relatively stationary. For example, if your shot shows a person talking while sitting in a chair, the video frame is mainly updating around the person’s face. If your content exhibits slow movement, you can adjust the bit rate formula by dividing the result in half.
  • Fast movement: If more than 25 percent of the pixels on any given frame are changing, your content may be rapidly updating and may require more data to store the new information. A close-up shot of rushing water in a mountain stream exhibits fast movement. Fast movement clips can require up to twice as much bit rate. In the bit rate formula, be prepared to double the result.

You should also consider the complexity of the scene composition along with the motion in the scene. For example, you could have a clip featuring a moving subject on a relatively simple background, such as a dog running along a path shot from a fixed, nonmoving camera position. Even though the subject is moving, the background is static. Or, you could have a clip with a stationary subject on very complex background, such as a musician sitting on a chair and playing a guitar against a backdrop of a varied and detailed garden. In both of these instances, the complexity of the scene composition and the amount of motion should be averaged and applied to the bit rate formula.

Let’s compare some samples of content containing different styles of movement. The following series of figures demonstrates a slow, average, and fast movement bit rate formula. Each sample uses the same frame width, frame height, and frame rate with the same quality of source material (HDV).

Figure 3.1 shows a slow movement profile applied to a clip containing little or no motion. In this example, a park trail is shown with slight movement in the trees. The bit rate used for this clip is 280 Kbps with the Main profile of the AVC/H.264 codec.

Figure 3.1 The bit rate is 280 Kbps, with the Main profile of the AVC/H.264 codec.

Figure 3.2 shows an average movement profile applied to a clip containing some movement. This clip of a waterfall spilling into a large pool uses twice the bit rate for the same clip characteristics: 550 Kbps with the Main profile of the AVC/H.264 codec.

Figure 3.2 The bit rate is 550 Kbps, with the Main profile of the AVC/H.264 codec.

Figure 3.3 illustrates a fast movement profile applied to a clip with several changing areas. This clip of rushing water uses a bit rate of 1100 Kbps (or 1.1 Mbps) with the Main profile of the AVC/H.264 codec, twice that of the previous example.

Figure 3.3 The bit rate is 1100 Kbps, with the Main profile of the AVC/H.264 codec.

But what happens if you use a lower bit rate with the rushing-water clip, leaving the frame width, frame height, and frame rate identical? The resulting video image suffers horribly (Figure 3.4).

Figure 3.4 The bit rate is 280 Kbps, with the Main profile of the AVC/H.264 codec.

The formulas described in this section are by no means absolute—every piece of video is different. Use the bit rate formulas to help you establish reasonable start points in your compression tests.

Variations in audio quality

Thankfully, the relationship between audio quality and audio bit rate with a given video file is much simpler to predict and determine. Four primary factors determine audio quality with a given audio bit rate:

  • Sampling rate: This property determines how many audio samples are recorded per second, expressed in kilohertz (kHz). The higher the value, the more faithfully the original sound is reproduced. The common sampling rates for Web video are 11.025 kHz (or 11 kHz), 22.050 kHz (or 22 kHz), and 44.100 kHz (or 44.1 kHz). Audio CD recordings use a 44.1 kHz sampling rate, and some digital video formats record at 48 kHz. The sound quality you hear from FM radio broadcasts is roughly 22 kHZ, whereas 11 kHz is equivalent to telephone sound quality. Flash Player resamples all sound sources to 44.1 kHz during playback. For high-quality audio, I recommend always using 44.1 kHz. Use 22 kHz or 11 kHz sampling rates only if you need to encode low bit rate audio for slow connection speeds.
  • Channels: The audio track can be divided into one or more channels. A channel contains independent and discrete sound information. Most video files have only one (mono) or two (stereo) channels. Channels are usually aligned to a specific speaker for playback, such as a left channel and a right channel in stereo audio. Although some video specifications such as AVC/H.264 and its sister audio codec, AAC, support more than two channels of sound, Flash Player down-mixes additional sound tracks to stereo audio. Unless you want to retain stereo sound effects, I recommend using a single (mono) track of audio for Web video.
  • Bit depth: The range of values that can be recorded with the audio sampling rate depends on the bit depth of the audio track. For Web video, you should always use 16-bit audio, which enables an audio track to use a range of 65,536 values. Some audio recordings can be made at 8-bit, which is only 256 levels of audio and greatly reduces the overall sound quality.
  • Audio codec: The audio codec controls the compression applied to the audio track, just as the video codec does for the video track. Flash Player 8 and older support the MPEG-1 Audio Layer III (MP3) codec for the FLV file format, and Flash Player 9.0.115 and newer support the higher-quality AAC codec for AVC/H.264 video. Just as AVC/H.264 codec supports multiple profiles, the AAC codec has different profiles. Flash Player 9.0.115 supports AAC Main, AAC Low Complexity (LC), and High Efficiency AAC v2 (HE-AAC v2).

The formula to determine the appropriate bit rate for high-quality audio contains the following variables:

To convert the value to kilobits per second, divide the result by 1,000.

The divisors for Flash Player–supported audio codecs employed by video files are listed in Table 3.2. The MP3 codec has a compression ratio of 11:1, which means it reduces the uncompressed sound data by a factor of 11. So if you wanted to compress the audio track with the MP3 audio codec at 44.1 kHz with a mono channel at 16 bit, you should use an audio bit rate of 64 Kbps:

Table 3.2 Audio Codec Divisors

Codec

Divisor

MP3

11

AAC LC

15

AAC Main

16

HE-AAC v2

17

Unlike the video bit rate, the audio bit rate should conform to fixed values according to the specifications of the audio codec. For both MP3 and AAC codecs, refer to Table 3.3 Audio Bit Rates for MP3 and AAC Codecs

Table 3.3 for these fixed bit rates. Always round up the result of the audio formula to the nearest bit rate listed in the specification. Every encoding application I use enforces these bit rate values, and you usually choose an audio bit rate from a drop-down menu.

Table 3.3 Audio Bit Rates for MP3 and AAC Codecs

Bit rate (in Kbps)

8

40

112

16

48

128

18

56

160

20

64

192

24

80

256

32

96

320

When you intend to deliver video over the Web, you should carefully consider how you want visitors to experience the video playback. Connection speeds on the Internet vary greatly; some people have fast cable or fiber-optic modems, whereas others are still using slow 56 Kbps dial-up modems. Two general methods are used to deliver video on the Web, and each method greatly affects how to compress your video:

  • One bit rate: Only one bit rate is offered per piece of video content on the site. This is akin to a “one size fits all” approach, where you pick the quality of the video you want everyone to experience. If you choose a low bit rate, everyone sees a low-quality video, but the video content downloads quickly regardless of connection speed. If you pick a high bit rate, everyone can see a better-quality video, but visitors with slower connection speeds have to wait for the video to download. As a video compressionist, you need to encode and upload only one video file per piece of content.
  • Multiple bit rates: My preferred approach with most video content is to offer tiers of data rates. Visitors with fast Internet connections get high-quality, higher-bit rate video content, and visitors with slower Internet speeds get lesser-quality, low-bit rate video content. The video selection can be automated or user-initiated. For this approach, you must encode a separate video file for each targeted data rate.

If you decide to pick one bit rate for your video content, be aware of bandwidth problems that result. A high-bit rate video served over a slow Internet connection will result in long load times and possibly constant rebuffering during playback. When a video is sent from a server to a Flash movie, the video packets are temporarily stored in a memory buffer. If you play a video file and the buffer is empty or runs out, the video pauses until more video packets have downloaded.

To resolve this problem, make sure the video file’s bit rate is less than the network connection speed. The video can then download to the user as it’s played without as much risk that rebuffering will occur.

3. Learning About Player Versions and Codec Options | Next Section Previous Section

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.

Overview

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.

Surveys

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.

Newsletters

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.

Security

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

Children

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

Marketing

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.

Choice/Opt-out

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.

Links

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