Glossary

Keyframe extraction

Keyframe extraction selects a small set of frames that represent the content of a video, so it can be previewed, indexed or described without processing every frame.

Keyframe extraction is the process of choosing a small number of frames that together represent what a video shows. A 30-minute video at 30 frames per second contains 54,000 frames, most of them nearly identical to their neighbours, so search systems, thumbnails and vision models work from a selection instead. A good set of keyframes covers every distinct shot or moment, avoids near-duplicates, and favours frames that are sharp, well exposed and informative. The selection can be as simple as taking one frame every few seconds or as involved as clustering frame embeddings and scoring each candidate for quality. The term is also used for the encoder keyframes inside a compressed video file, which are a different thing, so it helps to be clear which meaning a tool or document has in mind.

Two meanings of keyframe

In video compression, a keyframe (also called an I-frame or intra frame) is a frame stored in full, so a decoder can start playing from it without the frames before. The frames in between store only what changed. How often encoders insert these keyframes depends on the video codec settings and the bitrate, commonly every one to ten seconds, plus at most scene changes. Pulling out these frames is fast, because they can be decoded without the rest of the stream, and some pipelines use them as a cheap first pass.

In video analysis, keyframes are representative frames chosen for their content. Encoder keyframes are placed for compression and seeking, so they can fall in the middle of a camera move or a blurred transition and can miss short shots entirely. Content keyframes are chosen to summarise what the video shows. This page is mostly about the second meaning, although many extractors start from the first.

Encoder keyframes (I-frames)

Content keyframes

Chosen by

The video encoder

An analysis step

Purpose

Compression and seeking

Representing what the video shows

Spacing

Roughly regular, set by encoder settings

Uneven, follows the content

Cost to extract

Very low

Low to moderate, depending on method

Typical use

Fast previews, a cheap first pass

Thumbnails, indexing, vision model input

How keyframes are selected

Uniform sampling

The simplest approach takes one frame at a fixed interval, such as one per second or one every five seconds. It is predictable and easy to reason about, and for many search and description jobs it works surprisingly well. Its weaknesses are redundancy and gaps: a two-minute static interview produces dozens of identical frames, while a half-second insert shot between samples is never seen.

Shot-based selection

Most content-aware methods first split the video with shot boundary detection, then pick one or more frames per shot, often the middle frame or the frame that looks most like the shot’s average. This guarantees that every shot is represented once. Long shots with a lot of movement may get several keyframes, chosen where the content changes most within the shot. Grouping shots into scenes with video scene detection then gives a second, coarser level of keyframes for navigation.

Clustering and diversity

Another family of methods describes each sampled frame with features, such as colour histograms or image embeddings from a model like CLIP, then clusters the frames and keeps the one nearest each cluster centre. Clustering handles repetition well: a video that cuts back and forth between two speakers ends up with one keyframe per speaker rather than one per cut. Perceptual hashing is a cheaper way to drop frames that look almost the same, and is the same technique used for near duplicate detection across files.

Quality filtering

Whatever the selection method, the chosen frame should be usable. Simple checks remove frames that are blurred (often measured with the variance of the Laplacian), too dark or too bright, mid-transition, or covered by a black slate. Thumbnail systems add rules of their own, such as preferring frames with faces, open eyes and the subject near the centre. Frames with large on-screen text, such as slides, are often kept deliberately because OCR can read them.

Why keyframes matter for AI pipelines

Keyframes are how most systems make video affordable to analyse. A vision language model charges for each image it reads, typically a few hundred tokens or more depending on resolution, so sending every frame of an hour of footage is not practical. Sending a few hundred well-chosen keyframes keeps the token count manageable while still covering what happens. The same logic applies to embedding models: indexing one embedding per keyframe rather than per frame keeps a video search index small enough to query quickly.

The cost of getting it wrong is silent. If the selection misses a short shot, nothing downstream knows it existed: the description will not mention it, the index will not contain it, and a search for it will return nothing. That is why shot-based selection with a minimum of one keyframe per shot is a common baseline, and why some pipelines sample more densely around moments where the transcript or audio suggests something important is happening.

Choosing a method

The right method depends on the footage and on what the keyframes are for. Uniform sampling at one frame every one or two seconds is a reasonable default when you need a quick result and the content changes steadily, such as dashcam or surveillance footage. Shot-based selection suits edited material such as broadcasts, adverts, films and training videos, where cuts mark real changes in content. Clustering with multimodal embeddings pays off on long, repetitive recordings such as meetings and lectures, where the same few views recur for an hour. Many production pipelines combine them: sample uniformly, split by shot, cluster within long shots, and then filter for quality.

Common mistakes

Three problems come up often. The first is relying only on encoder I-frames, which miss short shots and often land on blurred frames, so a search index built from them has gaps that nobody notices. The second is choosing thumbnails purely by position, such as the first frame of a video, which is frequently a black slate, a logo or a fade from black. The third is throwing away the timing: every keyframe should keep the timestamp and the shot range it came from, otherwise a search hit on a keyframe cannot send the viewer to the right moment, which defeats the point of video search. Archives add a fourth: footage digitised from tape often has interlacing artefacts and timecode overlays that confuse similarity measures, so it is worth cleaning frames before comparing them, a point covered in the post on how newsrooms can search decades of footage.

A worked example

A company has 2,000 recorded training videos, averaging 25 minutes, and wants employees to search them by what is on screen as well as what is said. At 30 frames per second each video holds about 45,000 frames. Sampling one frame per second reduces that to 1,500 per video, which is still three million frames for the library and far more than needed, because most of each video is a presenter in front of slides.

The team switches to shot-based selection. Shot detection finds around 140 shots per video, a perceptual hash removes repeated shots of the presenter, and a sharpness filter drops frames caught mid-transition. Slide changes, which are not camera edits, are caught by a separate check that compares frames for large changes in on-screen text. The result is about 110 keyframes per video. Each keyframe is captioned, its text is read by OCR, and both are indexed alongside the transcript, so a search for the slide showing the expense approval flow lands on the right moment. These figures are illustrative, but the order of magnitude of reduction, from tens of thousands of frames to around a hundred, is typical.

How keyframes relate to neighbouring tasks

Keyframe extraction sits between segmentation and description. Shot and scene detection decide where the units are. Keyframe extraction picks what represents each unit. Image captioning, object detection, OCR and color extraction then describe each keyframe, and video captioning and video summarization assemble those descriptions into an account of the whole video. Storyboards and thumbnail strips in media asset management tools are keyframes shown directly to people.

For search, keyframes are what make text to video search work at scale: the system embeds keyframes and their descriptions, matches a text query against them, and returns the time range of the shot the keyframe came from. Combined with the transcript, this is the core of video indexing and of broader video understanding.

Keyframe extraction and Exabase

Exabase Extract handles this selection internally as part of video processing. Submit a video to POST /v2/extract and the result includes the transcript with timestamps, the detected scenes, a visual analysis of what each scene shows, video chunks with start and end timestamps, capture attributes such as camera type and ISO, and a CDN-hosted thumbnail. Extract does not document a list of keyframe images per scene in its output, so if your product needs its own storyboard or frame-level thumbnails, extract those frames separately and store them alongside the video. The retrieving results guide covers what comes back, and the video to JSON tool runs on the same endpoint.

Videos stored as Resources get thumbnails in several sizes and captions and keywords in their metadata, and Deep Search matches text queries against both the transcript and the visual content of each scene, returning the chunk with its timestamp range. That is the basis of the asset search solution and the media asset management use case. The post on why video is the next frontier for agent context covers why this matters for agents, and the best video understanding API roundup and Exabase vs Google Video Intelligence comparison cover other options.

FAQs

What is keyframe extraction?

Keyframe extraction selects a small set of frames that represent what a video shows. The frames are used for thumbnails, search indexing and as input to vision models, so the whole video does not need to be processed frame by frame.

What is the difference between a keyframe and an I-frame?

An I-frame is a frame the video encoder stores in full for compression and seeking. A content keyframe is a frame chosen because it represents part of the video well. Encoder keyframes are cheap to extract but are not chosen for their content.

How many keyframes should I extract per video?

A common starting point is at least one keyframe per shot, plus extra frames for long shots with a lot of change. For talking-head or slide-based content this often comes to around one keyframe for every 10 to 20 seconds; fast-cut footage needs more.

How do I extract keyframes with FFmpeg?

FFmpeg can export only the encoder I-frames, sample at a fixed rate, or keep frames where its scene-change score passes a threshold. These options are quick to set up, though they do not filter for blur or remove near-duplicates.

Why not send every frame to a vision model?

Each image costs tokens and time, and consecutive frames are nearly identical. A few hundred keyframes cover what happens in an hour of footage at a small fraction of the cost of every frame.

Does Exabase extract keyframes?

Exabase Extract processes video into scenes, describes the visual content of each scene and returns timestamped chunks plus a thumbnail. It does not document a per-scene list of keyframe images, so extract frames separately if you need your own storyboard.

Related pages: Shot boundary detection, Video scene detection, Video summarization, Video captioning, Image embeddings, Perceptual hashing, Video search, Exabase vs Azure Video Indexer, What is inside a video file, video codec

Cut your token spend and give your agent precise context.

Get started in minutes.

Cut your token spend and give your agent precise context.

Get started in minutes.