Video compression

As you saw uncompressed videos take an incredible amount of space. To reduce the size of the video file you need some way to reduce the data. You need to use some type of compression. This text will give you a basic idea about how compression works without going into details and without going into the math.

Lossy and loss-less compression

There are two basic types of compressions, lossy or loss-less compression. Loss-less compression will create the exact same data as you started with when the compressed video is decompressed. A lossy compression algorithm on the other hand will lose data during compression. You will not end up with the same data you started with when you decompress the data. Modern lossy compression applied to a video will reduce the video file much more than any type of loss-less compression

When we talk about compression of video we almost always talk about lossy compressions. When we work with lossy compression it is important to make all changes when authoring the video on the uncompressed data as each cycle of compression will reduce the quality of the video.

How compression works

There are a few basic properties of videos that are used in combinations by almost all compression algorithms, Image coherence and video to frame coherence.

Image coherence is the fact that an image is not just noise. It typically shows shapes, it shows gradients. In other words it has some type of data pattern and that can be utilized.

By using these features of the video the algorithms try to code the image in another format that does not use one byte for each pixel in the frame.

An example of loss-less compression

For a simple example imagine that we have a video frame with just black pixels. One way to encode this is to save one value for the colour followed by another number telling how many pixels follow with the same color. For a black TV frame you would get two values one for the colour and one for 307200 pixels following using the same colour. This method of compression is lossless and called runtime length encoding.

…And a few words about lossy compression…

We could also try to remove details in the picture not visible to the human eye as done for example by the jpeg compression; this would be a lossy compression.

Compression algorithms utilizing Frame to frame coherence takes note of the fact that not everything in a movie change from frame to frame. By only storing the pixels that change between frames we can save a lot of information.

Take the same example with 5 frames in sequence with nothing changing, with this idea we store the image once and then information for each frame of what is changed i.e. nothing, we have though reduced the file with a factor of 500%. If the image change we can set a small error value for each pixel when it need saving. We for example only save a new pixel when its value has changed more than 1%. This simple algorithm will produce a lossy compression as we don’t record changes for all the frames where the changes on the pixels were less than 1%, when we decompress the video frames we will not get back the same data as we started with.

Different algorithms are good at different things. For example some compression algorithms will be best depending on what footage you are trying to compress. If there is text you want to read, if there is people not moving much, if there is a lot of camera movement and so on. All will get best result with different types of compression algorithms.

Video knowledgebase Download FastVideoIndexer Order FastVideoIndexer

©Copyright 2007,2008 - Fredrik Lönn, all rigths reserved