encoding.info
You are hereSourcePredictionTransformEntropy codingFiltersFramesDecisionsRate controlPerceptionQualityBitstreamSettingsEncoder map
Page 2 of 4 in Frame structure

Groups of pictures, open and closed

Frame structure · concept · added 2026-11-15

In Brief:
Keyframes are the points where a decoder can enter a video. A closed group of pictures keeps its frames' references inside the group. An open one lets frames predict across its boundary, so a decoder that starts there may have to skip frames whose references it does not have.

Rebuilding one intra frame is not the same as being able to carry on from it. A keyframe is a frame the encoder offers as a place to begin decoding, and the frames from one keyframe up to the next form a group of pictures (GOP). The keyframe interval sets how often such entry points come. Whether a GOP is open or closed sets whether prediction may cross them. Both can affect coding efficiency, through different mechanisms.

What a keyframe has to promise

An intra frame needs no other frame for its own reconstruction, but that is not enough: a frame after it could still be predicted from a frame before it. An instantaneous decoding refresh (IDR) frame is an intra frame that also ends that possibility. When x264 codes one it empties its list of reference frames, so nothing after the IDR frame in decoding order can use anything before it. A GOP that starts this way is closed.

The open GOP on this page is x264's. A keyframe after the first is an I frame that is not an IDR frame, and x264 marks it with a recovery point. The B frames shown just before it may use it and the last P frame of the previous GOP. They are coded after the I frame, so a decoder that starts there receives them without the older reference and cannot rebuild them correctly; they come before the starting point in display order. H.264 can also signal a gradual recovery with no whole intra frame, which this page does not cover.

Build a sequence and follow a frame's needs

Sixteen frames are laid out twice: in display order, and in the order they are coded. Choose the keyframe interval, the most B frames in a row and the kind of GOP, then move Frame along. The chosen frame has a dark outline, and every frame it depends on, directly or through its references, stays solid while the rest fade. The numbers under the boxes are display positions. The dashed outline marks the last keyframe coded at or before the chosen frame, and the last readout says whether the chosen frame needs anything coded before it; if so, a decoder starting at that keyframe cannot rebuild the frame. Start with Frame at 8 and switch GOP between Open and Closed, then try frame 9.

2
← 0: noneup to 3 in a row →
8
← first shownlast shown →
Display order
Coded order
coral: keyframes (IDR or I) gray: P frames teal: B frames dashed: the last keyframe coded at or before the chosen frame
I, P, B frames
This frame
Predicted from
Needs data before 9
Simplified demo: the pattern is invented and fixed (B frames up to the limit, then a P frame); a real encoder varies it with the content. Each P frame uses the nearest I or P frame before it, and each B frame the nearest one on each side; real frames can use more references. Two rules are x264's: in a closed GOP the frame before an IDR frame is a P frame, and in an open GOP the keyframes after the first are I frames. "Predicted from" lists the chosen frame's own references, and the line "It needs" adds the frames those depend on. "Needs data before" names the keyframe with the dashed outline and says whether the chosen frame needs any frame coded before it. It does not find where decoding would have to start.

With an interval of 8 and up to 2 B frames:

The settings

Trade-offs

Sources

Read 2026-11-15, at the commits linked.