350 Chapter 20 – Video on the Web
Compression
Web Design in a Nutshell, eMatter Edition
Lossless versus Lossy Compression
Compression can be “lossless,” which means no information is lost and the final
file is identical to the original.
Most codecs use forms oflossy compression. Lossy compression sacrifices some
data from the file to achieve much higher compression rates. Lossy compression
schemes, such as MPEG, use complicated algorithms that toss out data for sound
and image detail that is not discernible to the human ear or eye. The decom-
pressed file is extremely similar in character to the original, yet is not identical.
This is similar to the way JPEG handles still images.
Spatial versus Temporal Compression
Spatial(orintraframe)compressiontakes place on each individual frame of the
video, compressing the pixel information as though it were a still image.
Temporal(also calledinterframe)compressionhappens over a series of frames
and takes advantage of areas of the image that remain unchanged from frame to
frame, throwing out data for repeated pixels.
Temporal compression relies on the placement ofkey framesplaced throughout
the frames sequence. The key frames are used as masters against which the
following frames (called delta frames) are compared. It is recommended that a key
frame be placed once every second; therefore, if you have a frame rate of 15 fps,
set your key frame rate once every 15 frames.
Videos without a lot of motion, such as talking head clips, take the best advan-
tage of temporal compression. Videos with pans and other motion are compressed
less efficiently.
Video Codecs
There are a number ofcodecs(compression/decompression algorithms) that can
be used to compress video files for the Web. Many of these codecs can be applied
to several different file formats (discussed in the next section of this chapter).
Video-editing software packages often offer a long list of codecs in their
compressor list options. Here we focus on just those that are relevant to video
intended for web delivery.
Radius Cinepak
Cinepak is the most highly recommended codec for the Web. It provides one
of the highest possible compression/decompression rates and it is compatible
with both QuickTime or AVI formats. It employs both spatial and temporal
compression and a lossy compression scheme at lower quality levels. Low to
medium quality settings will produce acceptable quality video.
Intel Indeo
The Indeo codec provides compression rates similar to Cinepak by the use of
spatial and temporal compression, with lossy compression at low quality
levels. Its drawbacks are that it does not maintain quality at data rates as low
as Cinepak and it requires high-end machines to perform at its best. Unfortu-
nately, new incompatibilities with QuickTime 3.0 have made it impossible to