A keyframe in video codecs is a frame that is compressed entirely on its own, without reference to any other frame, so a decoder can reconstruct it from its own data alone. In codecs such as H.264, H.265, VP9 and AV1, keyframes are usually intra-coded frames (I-frames), and they mark the points where decoding, seeking and stream switching can begin.
Keyframes are the anchors of inter-frame compression. The frames between them store only the differences from earlier or later pictures, which saves enormous amounts of data, so the keyframe interval becomes one of the most important encoder settings for quality, file size, latency and editability.
How keyframes anchor inter-frame compression
Modern codecs exploit the fact that consecutive frames are highly similar. Instead of storing every frame completely, the encoder stores one full picture and then describes later pictures through motion vectors and residual differences relative to that reference.
This chain of dependencies is organized into a group of pictures (GOP). Each GOP begins with a keyframe, followed by predicted frames that refer back to it directly or indirectly, so a decoder that starts in the middle of a GOP cannot reconstruct the predicted frames until it reaches the next keyframe.
The table below compares the three classic frame types used in long-GOP compression.
| Frame type | References used | Relative size | Role |
|---|---|---|---|
| I-frame (keyframe) | None, intra-coded only | Largest | Random access and refresh point |
| P-frame | Earlier frames | Medium | Forward prediction |
| B-frame | Earlier and later frames | Smallest | Bidirectional prediction |
An I-frame typically needs several times more bits than a P-frame or B-frame of similar quality. The exact ratio depends on the content: static scenes compress predicted frames very efficiently, while fast motion and camera shake reduce the advantage.
IDR frames, open GOPs and closed GOPs
Not every I-frame is a full random access point. In H.264 and H.265, an IDR frame (instantaneous decoder refresh) clears the decoder’s reference buffer, guaranteeing that no later frame refers to anything before it.
A regular I-frame in an open GOP may still be followed by B-frames that refer to the previous GOP. Open GOPs compress slightly better, while closed GOPs start cleanly and are preferred for streaming segments, broadcast splicing and editing.
| Variant | Codec context | Random access | Typical use |
|---|---|---|---|
| IDR frame | H.264, H.265 | Clean, buffer is reset | Streaming segments, chapter points |
| CRA frame | H.265 | Possible, with skipped leading frames | Open-GOP efficiency with seeking |
| Non-IDR I-frame | H.264, H.265 | Limited in open GOPs | Mid-GOP quality refresh |
| Key frame | VP9, AV1 | Clean decoding start | Web streaming and seeking |
| Intra-only frame | AV1, VP9 | Partial, keeps some state | Error recovery |
For practical purposes, players and editors treat IDR frames and equivalent key frames as true keyframes. When a platform requests a keyframe every two seconds, it means a clean random access point, not merely any intra-coded picture.
Choosing the keyframe interval
The keyframe interval, often called GOP length, sets the maximum distance between keyframes, expressed in frames or seconds. A short interval improves seeking, error recovery and stream switching, while a long interval improves compression efficiency because fewer large frames are stored.
Most encoders also insert keyframes automatically at scene changes, because predicting a completely new picture from the previous scene wastes bits. This scene-cut detection means the actual distance between keyframes is often shorter than the configured maximum.
| Application | Typical interval | Reason |
|---|---|---|
| Adaptive streaming (HLS, DASH) | About 2 seconds, fixed | Aligns segments across bitrate renditions |
| Live streaming to platforms | About 2 seconds | Fast joining and stable ingest |
| Video on demand files | About 2 to 10 seconds | Balance of seeking and efficiency |
| Broadcast transmission | About 0.5 to 1 second | Quick channel changes |
| Video conferencing | Long, with on-demand refresh | Low bitrate, recovery after loss |
| Editing intermediates | Every frame | Frame-accurate cutting |
Keyframes in editing and playback
Keyframes explain why long-GOP footage feels sluggish in editing software. To display a frame in the middle of a GOP, the editor must decode the keyframe and every dependent frame up to the requested position, which costs processing time on every scrub and cut.
This is the main reason editors use intra-frame codecs such as ProRes or DNxHR, in which every frame is effectively a keyframe. Files grow many times larger, but each frame decodes independently, so timelines play back smoothly and cuts land on exact frames.
Keyframes also limit lossless trimming. Tools that cut a file without re-encoding can only start a clip at a keyframe, so a cut placed between keyframes is either moved to the nearest one or requires re-encoding of the affected GOP, sometimes called smart rendering.
In playback, a keyframe is where a player can resume after a seek or recover after a transmission error. Corrupted predicted frames spread visible artifacts until the next keyframe arrives, which is why lossy networks favor regular refresh points.
Keyframe-related problems and remedies
Poorly configured keyframes cause recognizable artifacts and workflow failures. The following table links common symptoms to their likely causes and practical fixes.
| Symptom | Likely cause | Fix |
|---|---|---|
| Periodic quality pulsing | Keyframes much sharper than predicted frames | Tune rate control, use longer lookahead |
| Slow seeking | Very long keyframe interval | Shorten the maximum GOP length |
| Adaptive streaming errors | Keyframes not aligned across renditions | Fix interval, disable scene-cut insertion |
| Smearing after packet loss | No refresh point for long periods | Enable periodic intra refresh |
| Inaccurate cuts without re-encoding | Cut points between keyframes | Re-encode or cut at keyframes |
Note that keyframe in video codecs differs from keyframing in animation. In motion graphics, a keyframe stores a parameter value at a point in time for interpolation, which is an entirely separate concept that shares only the name.
The short version
Video files save space by storing most frames as changes from earlier frames rather than as full pictures. A keyframe is a complete picture that does not depend on anything else.
Think of a flip book in which only a few pages are fully drawn and the rest show only what moved. You can start reading only at a fully drawn page. That is why keyframes decide how quickly you can jump to a point in a video and how large the file becomes.
Where it makes a difference
A streaming engineer prepares a live sports channel in five bitrate renditions for adaptive streaming at 50 frames per second. She sets a fixed keyframe interval of 100 frames, exactly two seconds, uses closed GOPs and disables extra scene-cut keyframes so that every rendition starts its segments on the same frame.
Viewers’ players can now switch between renditions at each two-second segment boundary without glitches. New viewers join within seconds, and the slight efficiency loss compared with a longer interval is a deliberate trade-off for reliability during the live event.