Compression

Digital video wouldn’t be possible without methods for compressing the vast amounts of data necessary to describe sound and frame images. Video files can be compressed in a number of different ways. This section looks at a variety of compression schemes and introduces the methods they use for achieving compression rates.

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 of lossy 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 decompressed 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 (or intraframe) compression takes place on each individual frame of the video, compressing the pixel information as though it were a still image.

Temporal (also called interframe) compression happens 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 of key frames placed throughout the frames sequence. The key frames are used as masters against which the following frames ...

Get Web Design in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.