Charan Mulagala

Semantic Video RAG

Ask questions about a video on an ordinary laptop, and get answers drawn only from what the video shows.

Year
2025
Built with
Python, CLIP, k-means, BLIP, FAISS, LangChain, Flan-T5, Streamlit
Try it
Live demo
Code
github.com/M-SaiCharan/Semantic-Video-RAG

The problem

84%

Of a clip’s frames dropped before anything is captioned: 10 kept out of 62, with the story intact.

Video question answering usually needs large GPUs and end-to-end training. Most frames of a clip repeat each other, like the 1878 gallop above, so SV-RAG works out which frames are different and spends its effort only on those. It runs on Apple Metal or a plain CPU, with no NVIDIA GPU and no training.

How it works

  1. SampleThe video is read at one frame per second.
  2. ClusterEach frame is embedded with CLIP (ViT-B/32) and k-means picks the frames nearest each cluster centre: the distinct scenes.
  3. CaptionBLIP-Large describes each kept frame, with a confidence score.
  4. IndexCaptions are embedded with MiniLM and stored in FAISS, with their timestamps.
  5. AnswerA question retrieves the right moments, and Flan-T5-Large answers under a strict prompt that allows only visual evidence.
  6. ConnectA spatio-temporal graph shows how objects and ideas link across the video.

Scrub the gallop

Drag through the 31 frames of the 1878 clip, and set how many to keep, the way SV-RAG’s slider does. Every skipped frame has a kept one that already shows its pose.

Frame 1 of 31.

Grouped here by k-means on the frames’ pixels, a stand-in for the CLIP embeddings SV-RAG uses. The kept frame is the one nearest the centre of its group.

Eadweard Muybridge’s 1878 plate of twelve photographs of a horse galloping, in three rows
Muybridge’s gallop, 1878: twelve frames, most of them near-repeats. Marked by hand, the kind of frames clustering keeps.
Muybridge’s nine-frame sequence of an athlete leaping a hurdle
The same idea on a hurdle jump: one frame for each distinct pose.

Results

Uniform sampling at one frame per second against SV-RAG’s cluster-based sampling, on the same clip.
MeasureEvery secondSV-RAGChange
Frames processed621083.8% fewer
Processing timeabout 45 sabout 8 sabout 5× faster
What is keptmany near-duplicatesone frame per distinct scene

In the app, a slider sets the number of clusters, so you choose how much detail to keep before asking questions such as “What colour is the car?” or “Describe the sequence of events.”

autoportalNext case study