---
agent:
  instructions: "Use this search API to find relevant content across this site with keywords or natural-language queries, instead of crawling individual pages. Results are returned in Markdown."
  endpoint: "https://mixpeek.com/.well-known/search?q={query}"
  method: GET
  documentation: "https://mixpeek.com/llms.txt"
---

1.  [](/)
2.  [Code examples](/recipes)
3.  Video Keyframe Extraction Pipeline

Back to code examples

Training

# Video Keyframe Extraction Pipeline

Extract representative keyframes from videos with scene detection. Generate thumbnails, visual summaries, and frame-level embeddings.

video

image

Single Tier

[Run in Builder](/build?recipe=video-keyframe-extraction)

Python

cURL

from mixpeek import Mixpeek

client \= Mixpeek(api\_key\="YOUR\_API\_KEY", namespace\="keyframes")

\# 1. A bucket for the videos, and a collection that cuts at scene changes and

\#    writes a thumbnail and a multimodal embedding for every scene

bucket \= client.buckets.create(

    bucket\_name\="product-videos",

    bucket\_schema\={"properties": {"video": {"type": "video"}}},

)

collection \= client.collections.create(

    collection\_name\="product-videos",

    source\={"type": "bucket", "bucket\_ids": \[bucket\["bucket\_id"\]\]},

    feature\_extractor\={

        "feature\_extractor\_name": "multimodal\_extractor",

        "version": "v1",

        "parameters": {

            "split\_method": "scene",

            "scene\_detection\_threshold": 0.5,

            "enable\_thumbnails": True,

        },

    },

)

\# 2. Upload and process

client.buckets.upload(

    bucket\["bucket\_id"\],

    blobs\=\[{"property": "video", "type": "video", "data": "s3://your-bucket/product-videos/unboxing.mp4"}\],

)

client.collections.trigger(collection\["collection\_id"\])

\# 3. Search the scenes visually

retriever \= client.retrievers.create(

    retriever\_name\="keyframe-search",

    collection\_identifiers\=\["product-videos"\],

    input\_schema\={"query": {"type": "text", "required": True}},

    stages\=\[

        {

            "stage\_name": "search",

            "stage\_id": "feature\_search",

            "parameters": {

                "searches": \[

                    {

                        "feature\_uri": "mixpeek://multimodal\_extractor@v1/vertex\_multimodal\_embedding",

                        "query": {"input\_mode": "text", "value": "{{INPUT.query}}"},

                        "top\_k": 20,

                    },

                \],

                "final\_top\_k": 20,

            },

        },

    \],

)

results \= client.retrievers.execute(retriever\["retriever\_id"\], inputs\={"query": "product being unboxed"})

for doc in results\["documents"\]:

    print(doc\["thumbnail\_url"\], doc\["start\_time"\], doc\["score"\])

### Feature Extractors

Multimodal Extractor

Unified embeddings for video, audio, image, and text: scene/silence chunking, Whisper transcription, thumbnails, and Gemini vision.

### Retriever Stages

feature search

Search and filter documents by vector similarity using feature embeddings

filter

## Frequently asked questions

### How are keyframes selected?

The scene detection model identifies visual transitions and selects the most representative frame from each scene.

### Can I control the number of keyframes per video?

Yes. You can set a maximum keyframe count or minimum scene duration threshold in the extractor configuration.

### Are keyframes stored as separate documents?

Yes. Each keyframe becomes a document with its own embedding, timestamp, and parent video reference in the lineage chain.

## Related code examples and resources

Pages on the same stages, extractors and patterns.

[

Extractor

### Multimodal Extractor

Unified embeddings for video, audio, image, and text: scene/silence chunking, Whisper transcription, thumbnails, and Gemini vision.

Learn more





](/extractors/multimodal)[

Recipe

### Processing a Large Media Library

Run extraction over tens of thousands of files without paying for the same object twice. Price the job before you submit it, keep new uploads flowing in on their own, and move cold collections out of the vector store while they stay searchable.

Learn more





](/recipes/scalable-multimodal-processing)[

Extractor

### Scrolling Text Extractor

Read scrolling/marquee video text via phase-correlation band detection, panoramic stitching, and VLM OCR.

Learn more





](/extractors/scrolling-text)[

Extractor

### Video Transcoding (H.264/H.265)

Convert RED R3D, ARRI RAW and mixed-codec video to a web-playable MP4 on your object storage, with codec probing so a misleading file extension does not pick the wrong decoder.

Learn more





](/extractors/transcoding)[

Recipe

### Dataset Versioning

Treat versioned object storage as your dataset's source of truth. Capture complete snapshots-raw assets, embeddings, and cluster assignments-for deterministic reconstruction at any point in time.

Learn more





](/recipes/dataset-versioning)[

Recipe

### Hierarchical Classification

Assign content to multi-level category hierarchies using embedding-based classification. Define your taxonomy once, then classify new content automatically with confidence scores.

Learn more





](/recipes/hierarchical-classification)