Published At: August 21, 2024
In video compression, a Group of Pictures (GOP) is a fundamental unit that organizes and arranges video frames for efficient encoding. Rather than encoding each video frame sequentially, multiple frames are grouped into a GOP, allowing for more effective compression and decompression. Understanding GOP structure is crucial for video editing, streaming, and optimizing video compression in codecs such as H.264/AVC, HEVC, and AV1.
A GOP consists of three types of frames: I frames, P frames, and B frames, each serving a unique purpose in the video compression process.
An I frame is a complete image that can be encoded and decoded independently. It serves as a reference for the surrounding frames and is essential for the accurate display of the video. Each I frame is divided into 8x8 pixel blocks, grouped into 16x16 pixel macroblocks, and then compressed using various techniques. I frames are generated as needed, especially when there is a significant change in the image content, typically about twice per second in a standard video stream.
P frames contain data describing the differences (motion vectors) between themselves and the previous frame, often an I frame. These frames significantly reduce file size by capitalizing on temporal redundancy, where consecutive frames share similar content. P frames cannot stand alone as they rely on previous frames for decoding. If there is a substantial change in the image, new pixel blocks are created for the changed portion, using the same encoding method as I frames.
B frames achieve the highest compression ratio by utilizing information from both preceding and following frames within the GOP. They contain motion vectors and pixel blocks, similar to P frames, but can reference frames both before and after them. This bidirectional prediction allows for greater compression but also means that B frames are highly dependent on surrounding frames for accurate decoding.
Mux Video is an API-first platform, powered by data and designed by video experts to make beautiful video possible for every development team.
Check out Mux videoNo credit card required to start using Mux.