- Distinguishing Source Files and Their Differences
- Understanding Video File Bit Rates
- Learning About Player Versions and Codec Options
- Determining Your Video Compression Profiles
Learning About Player Versions and Codec Options
Now that you know what can affect the bit rate of a video clip, you need to learn the codec options for Web video before you start the compression process. Video playback was first introduced with Flash Player 6, supporting the Sorenson Spark codec. The Spark codec is a derivative of the H.263 codec. At that time, Sorenson was well known for its high-quality, low-bit-rate Sorenson Video 3 codec, which Apple licensed for QuickTime. Over the span of five major releases of Flash Player, five video codecs have been added. Table 3.4 lists the codecs supported in each version of Flash Player. Each video codec and audio codec has a unique identifier that is stored in the metadata of a video file, as shown in Tables 3.5 and 3.6. In this section, you’ll learn the strengths and weaknesses of each codec.
Table 3.4 Flash Player Video Codec Support
Flash Player Version |
Sorenson Spark |
On2 VP6-E |
On2 VP6-S |
AVC/H.264* |
Screen Video |
Screen Video V2 |
5 or earlier |
O |
O |
O |
O |
O |
O |
6 and 7 |
• |
O |
O |
O |
• |
O |
8 to 9.0.49 |
• |
• |
O |
O |
• |
• |
9.0.115 and newer |
• |
• |
• |
• |
• |
• |
Flash Lite 1.0./1.1/2.0 |
O |
O |
O |
O |
O |
O |
Flash Lite 3.1 |
• |
• |
• |
• |
O |
O |
AIR 1.0/1.5 |
• |
• |
• |
• |
• |
• |
*Includes the Base, Main, High, and High 10-bit profiles
Table 3.5 Video Codec Identifiers
Codec |
Codec ID |
Sorenson Spark (H.263) |
2 |
On2 VP6-E or -S (no alpha) |
4 |
On2 VP6-E or -S (with alpha) |
5 |
AVC/H.264 |
avc1 |
Screen Video |
3 |
Screen Video V2 |
6 |
Table 3.6 Audio Codec Identifiers
Codec |
Codec ID |
Uncompressed |
0 |
ADPCM |
1 |
MP3 |
2 |
Nellymoser 8 kHz |
5 |
Nellymoser (non-8 kHz) |
6 |
AAC |
10 or mp4a |
Speex |
11 |
Sorenson Spark codec (H.263)
In 2002, when video first made its debut in Flash Player 6, Sorenson Spark was the video codec that made it all happen. If you need the widest range of compatibility for your Web video files, use the Sorenson Spark codec. Files encoded with the Spark codec use the .flv file extension.
Strengths
The primary benefits of using Sorenson Spark as your Flash-compatible video codec revolve around processing power:
- Reduced processing: The Spark codec requires less computer processing and memory (RAM) than the newer On2 VP6 codec. The rule of thumb is that Spark requires about half as much processing power and memory as On2 VP6-E. If you need to deploy video to a wide range of computers, including machines with processors slower than Pentium IIIs or Power Mac G4s, you should strongly consider using the Spark codec.
- Widest acceptance: As I mentioned earlier, Spark is available in Flash Player 6 and newer versions.
- Encoding products availability: Many inexpensive (and open source) video-encoding solutions offer only the Spark codec.
- Speed of compression: The Spark codec compresses video faster than the On2 VP6 codec. As a result, you can encode more content in less time.
- Encoder and decoder solution: The Sorenson Spark codec is the only codec whose compression encoder exists in the regular Flash Player. You can broadcast live video from a Web cam using the Sorenson Spark codec. The live video can be broadcast only to a Real Time Messaging Protocol (RTMP)–enabled server, such as an Adobe Flash Media Server application.
Weaknesses
Despite the codec’s wide availability and reduced demands on the processor, Spark has a few drawbacks:
- Lower-quality video: Sorenson Spark’s image quality is inferior to the other video codecs available in Flash Player. If you want the best quality Web video for online distribution over low bit rates, you shouldn’t use the Spark codec.
- Inefficient compression: You can achieve visual quality with Sorenson Spark on par with other Web video codecs—at the cost of higher bit rates. For example, you need about 20 percent more bit rate for Spark to produce the same quality with VP6-E. If you’re distributing on fixed media such as CD/DVD-ROM and want the video to play on slower machines, storage and bit rate issues may be less important.
When to use it
In summary, the Sorenson Spark codec is ideal for projects requiring the following:
- Wide range of playback platforms: From smart phones to mobile devices supporting the Flash platform, Sorenson Spark is one of the only codecs that performs well with slow processors.
- Live video: To broadcast live events from Flash applications, use Spark. You can purchase live hardware-encoding solutions for other video codecs, but they’re not cheap.
- License-free delivery: You do not have to pay any additional licensing fees to deploy video encoded with the Sorenson Spark codec. Software and hardware vendors that use the codec pay the licensing fees.
On2 VP6-E codec
Sorenson Spark opened the possibility of video playback within a Flash movie, but the On2 VP6-E codec included with Flash Player 8 and newer inaugurated a new era of Web video. The superior image quality of the VP6-E codec, combined with its efficient compression for low bit rates, has significantly increased the adoption of Flash-based video. Files encoded with the On2 VP6-E codec use the .flv file extension for playback in Flash Player.
Strengths
VP6-E is a modern video codec, designed for fast processors and low bit rates. The following are its strengths over other codecs:
- Superior image quality: Given equivalent bit rates, video using the VP6-E codec is visually more stunning than video using Sorenson Spark.
- Efficient compression: On2 VP6-E can more efficiently compress video data, resulting in smaller file sizes for equivalent bit rates.
- Alpha channel support: The VP6-E codec implemented by Flash Player 8 and newer can utilize a transparency layer, also called an alpha channel. The alpha channel supports 256 levels of transparency, enabling you to add anti-aliased edges around subject matter in your video frame. An alpha channel makes regions of your video transparent, allowing Flash elements behind the video to show through.
Weaknesses
Although VP6-E may seem like a natural one-size-fits-all video codec to use with your Flash projects, consider the following drawbacks:
- Higher processing and memory requirements: Video encoded with the On2 VP6-E codec can require up to twice as much CPU power and memory (RAM) than equivalent Sorenson Spark video. Generally, your target platform for video encoded with VP6 should be a processor speed of 1.5 GHz or greater. For large frame sizes (greater than 640 by 480) or video bit rates greater than 500 Kbps, you may want to avoid use the On2 VP6-E codec because the demand on the processor is so high.
- Longer encoding times: Because its encoding algorithm is complex, the On2 VP6-E codec requires more time to compress video footage than Sorenson Spark.
- Player requirements: Video encoded with the VP6 codec can play only on Flash Player 8 or newer. If you’re targeting devices with older players, the video track won’t display (although the audio information will play).
When to use it
You should use the On2 VP6-E codec with any Flash-based video project that has the following criteria:
- Better image quality: In most cases, your video material will look better with the VP6-E codec.
- Flash Player 8 deployment: If you’re targeting Flash Player 8 to Flash Player 9.0.48, consider using the On2 VP6-E codec over the Sorenson Spark codec.
- Video compositing: If you want to overlay video seamlessly with other media elements in a Flash movie, you need the alpha-channel support that’s available with the VP6-E codec.
- Desktop deployment: If you’re targeting modern-day desktop computers for Web video delivery, the On2 VP6-E can decode video efficiently.
- License-free delivery: You do not have to pay any additional licensing fees to deploy video encoded with the On2 VP6-E codec. Software and hardware vendors that use the codec pay the licensing fees.
On2 VP6-S codec
Flash Player 9.0.115 added support for a secondary profile to the On2 VP6 codec. The S—or simple—profile improves the performance of video playback on slower processors by removing some advanced features from the VP6-E codec, such as adaptive subpixel filtering.
Strengths
VP6-S can enable you to use the video on a wider range of computers and devices than the VP6-E codec.
- Lower processor demand: On average, the VP6-S codec utilizes 10 to 25 percent less of the processor than the same footage encoded with the VP6-E codec.
- HD playback: The VP6-S codec can play bit rates greater than 500 Kbps and large frame sizes such as 1280 by 720 (720p) more reliably on a broader swatch of computers than the VP6-E codec.
Weaknesses
Although VP6-E may seem like a natural one-size-fits-all video codec to use with your Flash projects, consider the following drawbacks:
- Lower quality: The VP6-S codec cannot achieve the same visual quality for a given bit rate and video clip as the VP6-E codec. The VP6-S codec does not have the “Heightened Sharpness Profile” of the VP6-E codec. This profile improves the quality of the video image.
- Player requirements: Video encoded with the VP6-S codec can play only on Flash Player 9.0.115 or newer. If you want to target older players, you should use the On2 VP6-E or Sorenson Spark codec.
When to use it
You should use the On2 VP6-6 codec with any Flash-based video project that has the following criteria:
- HD playback across wide target audience: If you need to deploy high-quality, high-bit-rate content to a large audience, the VP6-S codec plays more consistently with fewer dropped frames than the VP6-E codec.
- License-free delivery: You do not have to pay any additional licensing fees to deploy video encoded with the On2 VP6-S codec. Software and hardware vendors that use the codec pay the licensing fees.
AVC/H.264 codec
Flash Player 9.0.115 also added support for the industry-standard AVC/H.264 (or simply, H.264) codec. In most instances, this codec can produce the highest-quality video out of all Flash Player–compatible video codecs. H.264 belongs to the MPEG-4 family of video specifications and is also called MPEG-4 Part 10 or MPEG-4 AVC. Officially, Adobe supports the Base, Main, and High profiles of H.264, but Flash Player can play High 10-bit profile as well. The H.264 is used across the video industry, from digital video cameras to Blu-ray HD discs. Every major video plug-in or player, from the Apple QuickTime Player to Microsoft Windows Media Player (and Silverlight) to Real Systems RealOne Player to Adobe Flash Player, can play H.264 video files. Because of this broad range of support, you can reuse your H.264 content just about anywhere.
Video encoded with the H.264 codec usually has an .mp4 or .m4v extension, but you can use a QuickTime file with the .mov extension to contain H.264 material. Adobe CS4 components encode H.264 file destined for Flash Player playback with the .f4v extension. I prefer to use the .mp4 extension, and it’s just a simple matter of changing the filename. The .f4v file extension is not recognized as a valid MPEG-4 file by other video players, such as QuickTime Player, and I prefer to use QuickTime Player to preview compressed video files.
Strengths
Because of its multiple profiles, the H.264 codec is an exceptional codec capable of creating the best-looking video on the Web. Here are a few reasons why I like to use H.264:
- Wide processor support: Each profile (Base, Main, and High) is designed to target a specific range of processing power. The Base profile is ideal for low-end computers or mobile devices, while the Main and High profiles can utilize more processor-intensive routines to compress the video data while retaining high quality.
- Broad player support: Once you’ve encoded your video in the H.264 format, you can deploy the content to multiple platforms, from Apple iPods to the Web browser to set-top boxes for your television.
- Broad encoding support: Nearly every video-encoding application can output H.264 files. You can use simple tools such as Apple QuickTime Player Pro to output H.264 files, or you can use expensive industrial-strength tools such as Adobe Flash Media Encoding Server or Rhozet Carbon Coder.
- Best video quality: The High profile of the H.264 codec produces amazing results and, given equivalent bit rates compared to other Flash-compatible codecs, creates the best video quality.
Weaknesses
Although VP6-E may seem like a natural one-size-fits-all video codec to use with your Flash projects, consider the following drawbacks:
- Variable results: As mentioned earlier in this section, each encoding tool licenses a specific H.264 encoder to produce H.264 output. And, not every tool exposes the critical compression settings for the Main and High profiles.
- Licensing fees: If you plan to use the H.264 codec for commercial purposes (and don’t ask me to define “commercial”—I’m not a lawyer), you should be aware that there are potential licensing fees associated with any distribution of H.264 content over the Internet. From what I’ve researched (and again, I’m not a lawyer), you don’t have to worry about licensing fees in the current term, which expires at the end of 2010, if you’re not charging a subscription fee to your users or if you’re not selling the video clip. If you are doing either of those activities, however, you should review the terms of the AVC/H.264 licensing on the MPEG Licensing Authority (MPEG-LA) site, http://www.mpegla.com. You can review a summary of licensing terms in a downloadable PDF at http://www.mpegla.com/avc/AVC_TermsSummary.pdf.
- Player requirements: Video encoded with the H.264 codec can play only on Flash Player 9.0.115 or newer. If you want to target older players, you should use the On2 VP6-E or Sorenson Spark codec.
When to use it
You should use the H.264 codec with any Flash-based video project that meets the following criteria:
- New video projects: If you’re building a new Web site or a Flash-based application that requires video, you should explore the possibility of using H.264 video content. Remember, there may be licensing costs associated with the use of H.264.
- Deployment to multiple platforms: If you need to encode video content for a range of playback devices, you can use the H.264 codec in a specific profile for each delivery platform. For example, you can encode a 500 Kbps file using the Base profile for deployment to an iPhone or iPod and then encode an 800 Kbps file using the Main or High profile for deployment to desktop computers.
Screen recording codecs
Back when Macromedia Flash MX and Flash MX 2004 were released, the QuickTime exporter plug-in for the FLV format included the option to compress video files with the Screen Recording codec. Adobe removed this codec from its encoding products, and you won’t usually find the codec as an option in Adobe encoding products.
The screen recording codecs, Screen Video and Screen Video V2, are included with Flash Player for playback of Adobe Acrobat Connect Professional (formerly known as Macromedia Breeze Meeting) screen-capture streams during desktop-sharing sessions. If you have access to the older Flash MX 2004 or Flash MX video compression plug-in for QuickTime-enabled applications, you can convert screen-capture files to the FLV file format with this codec. You can use Spark or VP6 for screen captures as well, but the screen recording codecs are optimized for desktop application screens. The text in application windows appears sharper with the Screen Recording codecs than the other Flash-compatible video codecs. Because of the large frame sizes of desktop screen captures, the frame rate of an FLV file for screen capture is usually low, from 1 to 6 fps.
Audio codecs
Flash Player’s audio codec offerings have recently expanded to include new audio codecs. The following describes each codec, in order of preference:
- AAC: The Advanced Audio Coding codec is supported in Flash Player 9.0.115 or newer. Considered the next evolution of the MP3 audio codec, the AAC codec can achieve the same audio quality as MP3 compression with less bit rate. The general rule of thumb is that the perceived quality of 128 Kbps MP3 audio requires only 96 Kbps with AAC audio. The AAC codec is the companion audio codec to H.264 video content. If you’re compressing H.264 video, you can use only AAC audio. There are several profiles for AAC, including Low Complexity (LC), Main, and SBR (or HE-AAC). If you have the option to encode audio in HE-AAC v2, you’ll notice higher quality at lower bit rates compared to the other profiles—at the expense of slightly higher processor utilization. As a content distributor, you don’t need to pay any additional licensing fees for AAC audio.
- MP3: By far the most popular audio codec is MP3. Based on the same MPEG Audio Layer III used with early video CD discs, this popular audio codec has made its way into just about every digital device on the market. You should always use the MP3 codec for any FLV file output. Note that you may need to pay additional licensing fees for MP3 audio. For more information, visit http://www.mp3licensing.com.
- Speex: This open source audio codec is now available in Flash Player 10 and can be used for real-time voice audio encoding directly from Flash Player to an RTMP application, such as Adobe Flash Media Server. You should not use this codec for prerecorded video encoding. Always use the MP3 codec for FLV files or the AAC codec for H.264 files.
- Nellymoser Speech codec: Introduced in Flash Player 6, the Speech codec is designed for encoding voice audio in real time with little processing overhead. The compression ratio of the Speech codec isn’t as good as the MP3 codec, however. You should use the Speech codec only for live video broadcasts to a Flash Media Server application. Most video encoders don’t offer the Nellymoser Speech codec in the audio-compression options.
- Uncompressed audio: Some third-party video encoders offer the option to output an uncompressed audio track that doesn’t use a codec or compression. The resulting video file is large and not fit for distribution over the Internet. You should use the uncompressed audio option only if you plan to embed video directly into a Flash movie—the Flash authoring environment recompresses audio in video when you publish the Flash movie (SWF) file.