Lurker News
Gemini Embedding 2 can project raw video directly into a 768-dimensional vector space alongside text. No transcription, no frame captioning, no intermediate text. A query like "green car cutting me off" is directly comparable to a 30-second video clip at the vector level.

I used this to build a CLI that indexes hours of footage into ChromaDB, then searches it with natural language and auto-trims the matching clip. Demo video on the GitHub README. Indexing costs ~$2.50/hr of footage. Still-frame detection skips idle chunks, so security camera / sentry mode footage is much cheaper.

Comments (108) 40 threads

Earlier comments
nullbyte2 replies#
What a brilliant idea! is this all done locally? That's incredible.
apwheele1 reply#
While the vector store is local, it is sending the data to Gemini's API for embedding. (Which if using a paid API key is probably fine for most use cases, no long term retention/training etc.)
febed1 reply#
This seems like something that would be very expensive to run. Do you have some representative figures at a particular resolution and frame rate?
addandsubtract#
The README on the GitHub has a section on this[0]:

>Indexing 1 hour of footage costs ~$2.84 with Gemini's embedding API (default settings: 30s chunks, 5s overlap):
>1 hour = 3,600 seconds of video = 3,600 frames processed by the model. 3,600 frames × $0.00079 = ~$2.84/hr
>The Gemini API natively extracts and tokenizes exactly 1 frame per second from uploaded video, regardless of the file's actual frame rate. The preprocessing step (which downscales chunks to 480p at 5fps via ffmpeg) is a local/bandwidth optimization — it keeps payload sizes small so API requests are fast and don't timeout — but does not change the number of frames the API processes.
[0] https://github.com/ssrajadh/sentrysearch#cost

ygouzerh1 reply#
That's quite interesting, well done! I haven't thought of this use case for embeddings. It open the door to quite many potential applications!
stavros#
Man, the surveillance applications for this are staggering.
dev_tools_lab1 reply#
Nice use of native video embedding. How do you handle cases where Gemini's response confidence is low? Do you have a fallback or threshold?
sohamrj1 reply#
as of now, no threshold but that is planned in the future.

for example, for now if i search "cybertruck" in my indexed dashcam footage, i don't have any cybertrucks in my footage, so it'll return a clip of the next best match which is a big truck, but not a cybertruck

dev_tools_lab#
Makes sense for now. Thresholding becomes critical at scale though — good luck with the next iteration!

Load more comments