A GOP, short for group of pictures, is the sequence of compressed frames between two independently decodable I-frames in interframe video codecs such as MPEG-2, H.264, H.265 and AV1. It defines which frames are stored whole and which are stored only as differences from other frames, and therefore controls the balance between compression efficiency, seeking speed and error resilience.
A GOP is usually described by two numbers: its length N, the distance between I-frames, and M, the spacing of reference frames, which reveals how many B-frames sit between them. A structure written as IBBPBBP with N = 12 and M = 3 was typical of broadcast MPEG-2.
How a GOP is built from frame types
A GOP is built from three frame types that differ in what they reference. Interframe compression exploits the fact that consecutive frames are similar, so most frames are encoded as motion vectors and residual differences relative to a reference rather than as complete images.
| Frame type | References | Relative size | Role |
|---|---|---|---|
| I-frame | None, intra-coded | Largest | Entry point for decoding and seeking |
| P-frame | Earlier frames | Medium | Predicts forward from past frames |
| B-frame | Earlier and later frames | Smallest | Bidirectional prediction, best compression |
| IDR frame | None, and clears reference buffers | Large | Hard reset point in H.264 and H.265 |
Because B-frames reference future frames, the encoder must reorder frames so that references arrive first. The decode order differs from display order, which adds latency and memory use. Real-time conferencing encoders often disable B-frames for that reason.
The hierarchy of B-frames adds a further layer in modern codecs. H.264, H.265 and AV1 allow some B-frames to serve as references for others, forming a pyramid structure in which frames closer to the base receive more bits and frames at the top receive fewer. This arrangement improves efficiency noticeably on slow, stable footage, but it increases encoder delay and the number of frames held in memory.
Open and closed GOP structures
A closed GOP can be decoded completely without any frame from the previous GOP, while an open GOP allows its first B-frames to reference the last frames of the preceding group. Open GOPs compress slightly better, but they complicate cutting and splicing.
| Property | Closed GOP | Open GOP |
|---|---|---|
| Cross-GOP references | Not allowed | Allowed for leading B-frames |
| Compression efficiency | Slightly lower | Slightly higher |
| Splicing and editing | Clean cut at every I-frame | Leading frames may be undecodable after a cut |
| Adaptive streaming | Required for segment boundaries | Generally avoided |
| Typical use | Streaming, broadcast splicing | Archival or single-file delivery |
Adaptive bitrate streaming formats segment video into chunks of a few seconds, and each segment must start with a closed GOP aligned across all renditions. Otherwise the player cannot switch quality cleanly at segment boundaries.
Choosing GOP length
GOP length is a trade-off between efficiency and accessibility. Longer GOPs spend fewer bits on large I-frames, so quality at a given bitrate improves, but random access becomes slower and an error persists longer before the next I-frame clears it. Typical lengths are expressed either in frames or in seconds.
| Application | Typical GOP length | Reason |
|---|---|---|
| Broadcast MPEG-2 | 12 to 15 frames, about half a second | Fast channel changes |
| Live streaming | 2 seconds, fixed | Aligns with short segments, low latency |
| On-demand streaming | 2 to 6 seconds, matched to segment | Efficiency with clean switching |
| Camera long-GOP recording | About half a second to one second | Compact files with acceptable editing |
| File archive or download | Up to 10 seconds or more | Maximum efficiency |
| Video conferencing | Very long, with I-frames on request | Low bitrate, refresh only after loss |
Most modern encoders also use scene-cut detection, inserting an I-frame when the picture changes completely, because predicting a new scene from the old one wastes bits. With a fixed GOP required for streaming, scene-cut insertion is often restricted to keep segment alignment intact.
In practice, GOP length should be set in seconds and converted to frames for each frame rate. A two-second GOP is 48 frames at 24p, 50 frames at 25p and 120 frames at 60p, so copying a frame count from one project to another can silently change the keyframe interval.
Long-GOP versus intra-frame codecs
Codecs fall into two families according to GOP structure. Long-GOP codecs use I-, P- and B-frames for delivery and efficient recording, while intra-frame codecs such as ProRes and DNxHR encode every frame as an I-frame, which is equivalent to a GOP length of one.
| Aspect | Long-GOP | Intra-frame |
|---|---|---|
| Bitrate for similar quality | Much lower | Several times higher |
| Editing responsiveness | Slower scrubbing, more decoding work | Fast, every frame independent |
| Error resilience | Error spreads until next I-frame | Error confined to one frame |
| Typical examples | H.264, H.265, AV1, VP9 | ProRes, DNxHR, intra-only H.264 |
| Main role | Delivery and compact recording | Editing, grading, mastering |
This is why editors often create proxy or mezzanine files in an intra-frame codec. Seeking to any frame in a long-GOP file requires decoding from the previous I-frame, which strains playback on timelines with many layers.
Common GOP problems and mistakes
Many visible artifacts in streamed and recorded video can be traced to a poorly chosen GOP structure. Diagnosing them begins with checking the I-frame interval and whether keyframes align with segments.
- I-frame pulsing: a visible quality jump every few seconds when I-frames are coded at a different quality than surrounding frames.
- Slow stream start: viewers wait for the next I-frame when the GOP is too long for live delivery.
- Misaligned keyframes: renditions with different GOP boundaries cause stalls or glitches when the player switches quality.
- Corrupted cuts: trimming an open-GOP file without re-encoding can leave undecodable frames at the edit point.
- Confusing keyframe with GOP: the keyframe interval sets GOP length, but the GOP also includes the arrangement of P- and B-frames.
The simple explanation
Video files save space by not storing every picture in full. Every so often they store one complete picture. For the pictures that follow, they store only what has changed, such as a moving arm.
A GOP is one such run: a complete picture followed by a series of change notes. Longer runs save more space. The catch is recovery. If a note is damaged, or you jump into the middle of the video, the player must go back to the last complete picture first.
How it is used in practice
A sports streaming service delivers a live match at 50 frames per second in six quality levels, from mobile to 4K. Its engineers configure the encoder with a fixed GOP of 100 frames, exactly two seconds, with closed GOPs and B-frames enabled, and they align I-frames across all six renditions.
Each two-second segment therefore begins with an I-frame, so players can switch quality at every boundary when a viewer’s connection changes. Scene-cut insertion is limited so it cannot break alignment. The result is smooth quality switching and a delay of only a few seconds behind the live action, while bitrates stay far lower than an intra-frame stream would need.