Gemini can now natively embed video, so I built sub-second video search

Gemini Embedding 2 can project raw video directly into a 768-dimensional vector space alongside text. No transcription, no frame captioning, no intermediate text.

Gemini can now natively embed video, so I built sub-second video search
Gemini can now natively embed video, so I built sub-second video search Photo: Hacker News

Semantic search over dashcam footage.

Type what you're looking for, get a trimmed clip back.

This prompts for your Gemini API key, writes it to .env , and validates it with a test embedding.

ffmpeg is required for video chunking and trimming.

If you don't have it system-wide, the bundled imageio-ffmpeg is used automatically.

Manual setup: If you prefer not to use sentrysearch init , you can copy .env.example to .env and add your key from aistudio.google.com/apikey manually.

If a key is already configured, you'll be asked whether to overwrite it.

Options: --results N , --output-dir DIR , --no-trim to skip auto-trimming.

Add --verbose to either command for debug info (embedding dimensions, API response times, similarity scores).

Gemini Embedding 2 can natively embed video — raw video pixels are projected into the same 768-dimensional vector space as text queries.

There's no transcription, no frame captioning, no text middleman.

A text query like "red truck at a stop sign" is directly comparable to a 30-second video clip at the vector level.

This is what makes sub-second semantic search over hours of footage practical.

Indexing 1 hour of footage costs ~$2.50 with Gemini's embedding API (default settings: 30s chunks, 5s overlap).

The API bills by video duration, so this cost is driven by the number of chunks, not file size.

Two built-in optimizations help reduce costs in different ways:
Search queries are negligible (text embedding only).

This works with any footage in mp4 format, not just Tesla Sentry Mode.

The directory scanner recursively finds all .mp4 files regardless of folder structure.

Source: This article was originally published by Hacker News

Read Full Original Article →

Share this article

Comments (0)

No comments yet. Be the first to comment!

Leave a Comment

Maximum 2000 characters