What is a keyframe (I-frame) in video?
verified onenvironmentlocal · windows 10.0.26200 arm64 · GNU bash 5.3.15 (Git Bash) · ffmpeg version 9.0.2-full_build-www.gyan.devupdated 2026-10-20
- tool
- FFmpeg
- versions
- any
- os
- any
A keyframe (I-frame, intra frame) is a complete picture encoded without reference to any other frame. The frames between keyframes (P- and B-frames) store only differences from their neighbours, which is where most of the compression comes from. A decoder can start playing only at a keyframe, so they determine where seeking lands and where -c copy cuts can begin.
See where the keyframes are
-g 10 asks the encoder for a keyframe at least every 10 frames:
ffmpeg -hide_banner -loglevel error -f lavfi -i testsrc=size=320x240:rate=10:duration=3 -c:v libx264 -g 10 -bf 0 -pix_fmt yuv420p -y gop.mp4
ffprobe -v error -select_streams v -show_entries frame=pict_type -of csv=p=0 gop.mp4 | paste -sd' 'Output
I, P P P P P P P P P I P P P P P P P P P I P P P P P P P P P
I marks keyframes; with -g 10 at 10 frames per second there is one per second.
Related terms
| Term | Meaning |
|---|---|
| I-frame | intra-coded, self-contained (a keyframe) |
| P-frame | predicted from earlier frames |
| B-frame | predicted from earlier and later frames |
| GOP | group of pictures: a keyframe and the frames up to the next one |
| -g N | maximum GOP length in frames |
| -force_key_frames | keyframes at given times, for example every 2 s for HLS segments |
Short GOPs make seeking and stream copy cuts more precise but cost bitrate; streaming services commonly use a keyframe every 2 seconds.
Sources
Related pages
compare · ffmpegffmpeg -c copy vs re-encoding: speed, quality and limits-c copy remuxes streams without decoding: fast and lossless, but cuts snap to keyframes and filters are impossible. Re-encoding is slower, lossy, flexible.flags · ffmpegffmpeg -crf: constant rate factor for x264, x265 and AV1-crf sets constant quality: lower means better and bigger. libx264 defaults to 23 on a 0 to 51 scale, libx265 to 28. Use it with -preset; sizes measured.cheat sheets · ffmpegFFmpeg cheat sheet: convert, cut, scale, extract and inspectFFmpeg cheat sheet: inspect files with ffprobe, change containers, encode H.264, cut without re-encoding, scale, extract audio, make GIFs and thumbnails.