Back to basics: Mechanisms used behind the scenes in Video Compression

Back to basics: Mechanisms used behind the scenes in Video Compression

What is Video compression? What does compressing a video do? Which of the following formats can be used for video compression? 

Video Encoding

What is video encoding? In this article, we are going to explain the basics of video encoding or video encoder procedure in simple words. The primary objective of compression is to decrease the amount of data that is needed to store, capture, and transmit video. Encoder video leads to a decline in required delivery bandwidth, data transmission time, and storage hardware. There are numerous algorithms exist to compress video like H.264/AVC, MPEG-2, AV1, H.265/HEVC, VP9, etc. 

JPEG Compression or Joint Photographic Experts Group

How to compress a jpeg? Let’s start with the generally used algorithm to compress digital pictures: JPEG compression or compress jpeg which is the abbreviation of Joint Photographic Experts Group. It works on an individual frame/image. You may be aware of the JPG or JPEG file format while emailing a picture, adding a picture to a presentation, or Resizing images. 

Suppose we took a picture of a scene with a man on a bicycle, with a tree in the background.

It compresses the picture by eliminating elements that are less noticed by the human eye. It eliminates some color information because we are not as sensitive to it and as well as some details in the more difficult part of the image. 

All the data that we eliminate could impact the quality of the resulting image depending on the desired compression rate. This is the reason JPEG is pointed out as a lossy compression method. It means some initial original picture information is lost and can’t be brought back, perhaps impacting the image quality.

Motion JPEG

What is a motion jpeg? Now suppose we record a video clip of this same scene with the cyclist moving:

Motion JPEG

The camera basically records a sequence of still images:

motion jpeg

And the JPEG technique can be applied to every frame to compress them:

JPEG technique

This is called Motion JPEG and it was the first broadly used video compression technique. It actually compress video by keeping out spatial redundancy. 

The common data, the tree, or background, is called temporal redundancy and can be removed from the video to get better compression rates.

Frame-Types in Video Compression

There are three major kinds of frames, which are collected jointly in Groups of Pictures (GOP):

I-frames

What are i frames? I-frames are known as independent frames just like JPEG images. They don’t require extra frames to be decoded. I-frames are also the largest in size and appear the smallest frequently in videos as compared to the other frame types. The graph below shows the encoding process:

I-frames

P-frames

P-frames are actually Predictive frames. They are relative to the preceding I-frame and preceding P-frame. When the Motion Compensation is involved in P frames, the best macroblock is used to encode the mark macroblock. The given graph will show this procedure:

P-frames

The performance schematics of P-frames require Motion Compensation to find the construct between the earlier frames, as shown below:

P-frames (b)

B-frame

B-frames are also known as Bidirectional frames. These kinds of frames are relative to both proceedings and succeeding I or P frames:

B-frame

Just like JPEG coding, bidirectional frames divide a frame into smaller blocks or parts. The performance schematics of bidirectional frames require motion compensation to find the best-suited macroblock. 

B-frame (b)

All predictions are computed using the same way as P-Frames. The performance schematics of bidirectional frames look like:

B-frame (c)

Well-organized video compressions use a mix of Independent, Predictive, and bidirectional frames. This mixing process is shown within bitstream here:

Conclusion:

We hope that now you have a superior understanding of how common compression algorithms work. It works with key concepts like groups of pictures and different frame types.  We hope this article will be informative for you and that you better understand the whole concept of the video compression process.

You May Also like:

5 Best Video Compressors for Windows & Mac Compress Without Losing Quality

How to optimize HTML5 videos for your website