Intermediate · 25 min
Build a Video Search Engine in Python
A video search engine finds a moment inside a clip, not only a filename. You sample frames or keyframes, embed them with a model such as CLIP, index those vectors, rank by similarity, and serve the query over HTTP.
The Challenge
A typical video search stack splits ownership: object storage for the files, a database for titles, a job to dump frames, an embedding service, a vector database, and a FastAPI app that tries to keep those copies aligned. Changing the sample rate or the model means touching every joint.
The Solution
Pixeltable is the unified multimodal backend for that job. One Python file declares the video table, the frame view, the CLIP index, and the HTTP route (TableModel + FastAPIRouter + the pxt CLI). Insert a clip; frames and embeddings follow that row. The same file deploys to Pixeltable Cloud. It is not an LLM wrapper and not a standalone vector database.
Implementation Guide
Step-by-step walkthrough with code examples
Declare the video table
Store each clip as a typed Video column plus the metadata you will filter on. Apply the file with pxt schema update; do not call create_table at import.
1import pixeltable as pxt23TableModel = pxt.model_base()45class Videos(TableModel, name='videos'):6 title: pxt.String7 video: pxt.Video
Glue stack vs one Python file
| Job | Typical glue stack | One Python file |
|---|---|---|
| Store the clip | Object storage plus a metadata database | A Video column on the table you own |
| Sample frames | A scheduled ffmpeg job between stores | A frame_iterator view on that clip |
| Embed stills | An embedding service you poll and copy out | CLIP as the index function on the frame column |
| Rank similar moments | A separate vector database you keep aligned | EmbeddingIndex on the same frame view |
| Serve search | A FastAPI app that joins those copies | FastAPIRouter declared beside the tables |
| Deploy | Rewrite the joints against hosted services | The same file on Pixeltable Cloud |
Key Benefits
Real Applications
Prerequisites
How-to guides
Learn More
Shared vector spaces for images, text, and other media
Frames, embeddings, and a timestamped hit
fps, num_frames, and keyframes_only on frame_iterator
Declare similarity search on the table that holds the pieces
The same TableModel + FastAPIRouter shape as a product
Install pxt, write one app.py, apply schema and service
Lakes, dataframes, parsers, and one-file backends, by job
Pinecone, Weaviate, Qdrant, Chroma, LanceDB, pgvector, or an index on the table
Owned table vs hosted Marengo/Pegasus; often and, not or
Twelve Labs, Marqo, Weaviate, Qdrant, FiftyOne, and an owned table
Related Guides
- Video Intelligence Pipeline: Extract, Enrich, and Search Video at Scale
Modality: Video
Computed column: frame_iterator view, then model columns on each frame
Docs - Production RAG: From Documents to Answers in One System
Modality: Document
Computed column: Chunk view plus an embedding index
Docs - Computer Vision Pipeline: Object Detection, Classification, and Search
Modality: Image
Computed column: Detection computed column on an Image or frame column
Docs
Frequently asked questions
What is a keyframe, and where is the frame timestamp?
Do I still need a separate vector database?
Is this an LLM wrapper or a hosted video API?
Can I search with an image as well as a sentence?
Ready to get started?
Install Pixeltable and start building in minutes. One Python file for tables, indexes, and HTTP.