URI VisitorsProspective Students Just For Students Faculty & Staff
News & InformationOffices & ServicesAcademicsResearch & OutreachLibraries & Technology

Multimedia Publishing Help


Compression 101
Search
Campuses
Directories
Fast Links
 

Helpful links

 
 

Theory

 

Digital compression is the process of reducing the number of bits and bytes needed to represent a given set of data. Compression takes advantage of redundancies or similarities in the data file. By reducing the number of bits and bytes used to store a set of data, we not only reduce the space required to store it, we also reduce the bandwidth needed to transmit it.

The simplest example: if we have a media file of nothing, the file would be composed of binary zeros. Obviously we do not need to store the whole file, instead we could  store a representation of  the number of zero bits. This example can be expanded to a more complex, and realistic file.  Let's say we have a video file with lots of blue sky and little variation.  The areas of blue sky can be represented in a reduced number of bytes because that data does not change between frames or within the same frame. 

So why is compression so important for audio and video files? Because digital audio and video are data intensive. Audio files can be large, up to 10 MB for ten minutes of plain speech.  Music files are larger. Digital video files can be enormous.  An uncompressed video file with lots of motion and changes in camera angles can be 1 Gigabyte for 5 minutes of video.   Even videos with less motion ( five minutes 300 MB) are well beyond the computational and storage capabilities of most computers. Therefore, compression is required simply to make computer handling of video economically feasible.

 

 

Reality

All digital compression is a gamble. You are betting on redundancies and similarities in the data that can be "compressed out." Fortunately, video usually has a significant amount of such similarities. However, it is sometimes possible for a video clip, realistic or not, to overwhelm the compression software so that it cannot maintain a quality image. Although this is infrequent, and most often caused by inexperience with the variables,  these failures cause many to give up compression (and video) prematurely.

Because compression is not much use without a way to decompress and recover the original data, we normally speak of compressor-decompressor pairs, or codecs.

Which codec you choose depends on several variables:  

Quality File Size Color
Frames per second File Type CPU speed and connection speed of the client 

The number of frames per second (fps) and quality are inter-related. More frames per second generates a higher quality video if there is high motion content but only if a corresponding key frame rate is chosen.  Quality will not  degrade as quickly with fewer frames if there is low motion. You should always reduce the final file size by tailoring the key frame and frame rate not limiting the data rate. Limiting the data rate creates an upper limit which the compression settings cannot exceed and the compression will fail to produce a quality image. 

The connection speed of the client matters because it dictates the acceptable final file size.  You can think of client connections as a spectrum from the lowest to the highest speeds:

Low end 56 Kbps...... T1/LAN or Cable DSL ..... Gigabit Ethernet  

(Wireless connections can span anywhere from 56Kbps to 11 Mbps depending on the number of users.)

In a college setting, many non-traditional students may have slower connections speeds but students in the dorms may be on the campus ethernet.   This is further complicated by the processing speed of the client's machine.  Sorenson 3 codecs will bring better video quality to the low end but obviously processes better on faster machines.  

 

 

Theory Meets Reality

There are two kinds of Codecs: Lossy and Lossless

Some codecs use lossless compression, which ensures that all of the information in the original clip is preserved after compression. This maintains the full quality of the original, which makes lossless compression useful for final-cut editing or moving clips between systems. However, preserving the original level of quality limits the degree to which you can lower the data rate and file size, and the resulting data rate may be too high for smooth playback on many systems. Unfortunately, lossless compressors cannot achieve the level of compression we need for video. Lossless compressors are hard pressed to deliver even a 2:1 compression ratio. This is because lossless compression is intraframe--every frame is a key frame. The data is compared to itself within the frame. For example, one whole section of the frame may be orange.  This information is represented by fewer bits/bytes than if the color varied. DV (digital video) and MPG 2 compressions are intraframe and lossless.

Other compression methods discard some of the original data during compression. This is called lossy compression. For example, if the pixels making up an leaf actually contain 90 shades of green, a lossy codec set for less-than-best quality may record only 30 shades of green. Lossy codecs also compare information between frames (interframe). If data does not change between frames, the information is not encoded.  For example, a video clip of a tree in a field with a plane flying in the distance would require only the data for the plane's movement to be encoded in every frame.  

Lossy compression allows you to trade off picture quality and file size to lower the data rate for your audience. Lossy compression allows much lower data rates and file sizes than lossless compression, so lossy codecs are commonly used for final production of video delivered using CD-ROM or the Internet. 

Some codecs are always lossy, such as JPEG, or always lossless, such as Planar RGB. Other codecs may or may not be lossy, usually depending on the settings you specify for the Quality and Data Rate options–lowering the value for these options saves more space by discarding more data. Many lossy codecs can achieve 10:1 compression or more without visible degradation of the image.

Lossy: MPG 2 (16:1 compression), Sorenson 3 (50:1)

Lossless: AVI,  DV

CODEC Primer

Still Images:

PICT- Apple photo jpeg file, can be used with PowerPoint
JPEG- three qualty settings, including enhanced still from movie
BMP - not truly cross-platform for the web
QTIF - QuickTime Image Format

 

Audio Files:

Aiff- used for audio CDs
Wav- Not truly cross-platform for the web
Qualcomm Pure Voice - the most flexible of the voice compressors, has variable settings. Best choice for normal speech.
MP3 - for high qualty music files. Best choice for slurred or guttural voices or highly intonated speech.
QuickTime audio- uses othe codecs but does not produce the quality/size ratio available with Qualcomm Pure Voice.

Video Files:

Animation- Provides high saturation color, no anti-aliasing (smooth lines and curves).  Use for Flash files.
Apple Compression Video- Digital Video (DV) with no compression (27 Mbps QuickTime File)
AVI - creates large but good quality files, useful for CD-ROMs or very short files
Cinepak - Older compression, creates large files. Can be used for CD-ROM files.  Does have variable data rate for playback. Picture quality drops noticeable at data rates below 30 MBps.
DV - (NTSC or PAL) Digital video formats used by PAL (European and Asian video standard) and NTSC (North American video standard) hardware.Lossless. Produces AVI or QuickTime files. 
QTIF - QuickTime Image Format

Within each video CODEC, the compression can be fine-tuned by adjusting the number of key frames and the number of frames per second.  This process is trial and error.  Reducing the number of frames per second produces jerkier motion but much much smaller files.  If your video has only a small amount of motion this may be the best bet.  If you reduce the number of key frames you will also have a smaller file but sometimes the video looks like the  audio is no longer synchronized.  (The number of key frames is set by picking a key frame every  # of frames, so reducing the number of key frames is performed by increasing the number.  For example, a key frame every 20 frames has fewer key frames than a key frame every 10 frames.)

Page last updated:04/25/2003

http://www.uri.edu/artsci/langlab/documentation/compress101.html

University of Rhode Island


Copyright © 2002 University of Rhode Island. All rights reserved. Disclaimer.
Contact Language Lab Supervisor for more information about the page.
Page last revised on Friday, April 25, 2003.