agentic-video-intelligence
Health Warn
- License — License: MIT
- Description — Repository has a description
- Active repo — Last push 0 days ago
- Low visibility — Only 5 GitHub stars
Code Warn
- network request — Outbound network request in postprocess/ui/src/App.tsx
Permissions Pass
- Permissions — No dangerous permissions requested
No AI report is available for this listing yet.
An AI-powered video understanding and retrieval system that combines timestamped transcripts and visual analysis to support semantic search and evidence-grounded answers about video content.

Agentic Video Intelligence
An AI platform for long-video understanding and timestamped question answering. It analyzes a video once into structured scene evidence and answers natural-language questions through read-only MCP tools—without embeddings or a vector database.

Features
- Local preprocessing — scene cut detection (
PySceneDetect), speech transcription (faster-whisperINT8 + Silero VAD), and anonymous face clustering (InsightFace). - One-time visual analysis — sends one frame per scene to
gpt-6-lunafor structured JSON notes (Standard, Flex50% off, or Batch). - Grounded MCP agent — answers questions using 5 read-only Model Context Protocol tools (
list_videos,search_video_segments,search_dialogue,get_video_scenes,get_segment_context). Citations not returned by a tool call are rejected automatically. - Interactive web player — live Dynamic Context Island, stage-aware processing bar, inline scene citation pills, and a timeline that filters to cited moments.

Benchmarks
Evaluated on a 136-minute film (The Matrix, 2,427 scenes) across 100 pre-written questions: 62% strict accuracy (70.5% counting partial answers as half), $0.00125 per query, 5.54 s median latency, and €0.023 total billed for one-time visual analysis.

How It Works
Instead of feeding hours of raw video frames into a multimodal model on every question, the system splits work into two decoupled phases: a one-time Ingestion pipeline that builds a local JSON evidence store, and an interactive Agentic Retrieval loop that searches only those structured notes through read-only MCP tools.
flowchart LR
V[Video File] --> S[Scene Cuts & Frames<br/>PySceneDetect]
V --> A[Audio & Speech<br/>faster-whisper INT8 + VAD]
S --> F[Anonymous Face Bank<br/>InsightFace SCRFD + ArcFace]
S --> M[One-Time Visual Notes<br/>gpt-6-luna · 768px JPEG]
A --> M
F --> M
M --> J[(Local JSON Store<br/>data/<sha256>/)]
J --> MCP[5 Read-Only MCP Tools<br/>Snowball + IDF · Privacy Projection]
MCP <--> AG[Bounded Agent Loop<br/>≤ 8 rounds · Grounding Check]
AG --> UI[Timestamped Answer<br/>+ Filtered Timeline]
Phase 1 — Ingestion (Analyze Once)
Every video is hashed (SHA-256) into an isolated folder (data/<sha256>/) with per-stage checkpoints, so interrupted runs resume cleanly without redoing completed work:
- Scene detection & representative frames —
PySceneDetectsplits the video at editorial cuts (threshold=27.0,min_scene_len=0.6s) and extracts one midpoint frame per scene. - Local speech transcription — audio is extracted to 16 kHz mono WAV and transcribed locally with
faster-whisper(small, INT8, beam 5) using Silero VAD (0.35) to filter out music and sound effects. Spoken lines are aligned to the scene holding the majority of their words. - Local anonymous face clustering —
InsightFace(buffalo_m: SCRFD + ArcFace) detects faces on scene frames and groups embeddings into anonymous IDs (character_1,character_2, …) with no external identity lookup. - One-time structured visual analysis — the only paid API step. One resized frame (
768pxJPEG, quality 80) with labeled character boxes and nearby dialogue is sent once togpt-6-luna(via Standard, Flex50% off, or Batch), returning strict JSON notes (visual_summary,setting,subjects,objects,visible_actions,dialogue_summary).
Phase 2 — Interactive Retrieval (Bounded MCP Agent)
When you ask a question, the agent never sees video frames again. It operates strictly over the saved JSON notes through a local read-only Model Context Protocol (MCP) bridge (JSON-RPC 2.0), also exposed to external MCP clients at POST /api/videos/<id>/mcp.
| MCP Tool | What it does |
|---|---|
list_videos |
Returns project metadata, duration, and analysis coverage |
search_video_segments |
Lexical OR search with English Snowball stemming, IDF weighting, and optional time_min/max_seconds window |
search_dialogue |
Searches spoken transcript lines directly for quotes and dialogue clues |
get_video_scenes |
Browses chronological paginated scene summaries |
get_segment_context |
Inspects a candidate scene alongside up to neighbors=6 surrounding scenes on each side |
Why no vector database or embeddings?
An in-memory Snowball + IDF index over 3,000 scenes builds in < 0.1 s with zero extra infrastructure. Because lexical search misses synonyms on its own, the agent compensates dynamically: on round 1 (tool_choice=required) it fires up to 3 parallel queries with synonym/visual rewrites, then expands promising anchors using get_segment_context and time windows.
Two server-enforced guarantees:
- Citation grounding — the agent must return a strict JSON schema (
kind,text,scene_ids,found). The server rejects anyscene_idthat was not actually returned by a tool call in the same session (giving the model one automatic retry), andfound=falselets it explicitly reject trap questions when no evidence exists. Hard caps (≤ 8rounds,≤ 24tool calls, tools disabled on rounds 7–8) keep latency predictable and guarantee termination. - Privacy by projection — before evidence reaches the agent, a projection layer strips character identities, appearance notes, inferred emotions, and raw on-screen text, forwarding only objective scene descriptions, actions, objects, setting, and dialogue.
How It Works
The system splits long-video understanding into two decoupled phases so expensive visual analysis runs once and every question searches lightweight local JSON notes instead of raw video:
flowchart TD
V["Video File"] --> S["Scene Cuts & Frames · PySceneDetect"]
V --> A["Audio & Speech · faster-whisper INT8 + VAD"]
S --> F["Anonymous Face Bank · InsightFace"]
S --> M["One-Time Visual Notes · gpt-6-luna 768px"]
A --> M
F --> M
M --> J[("Local JSON Store · data/sha256")]
J --> MCP["5 Read-Only MCP Tools · Snowball + IDF"]
MCP <--> AG["Bounded Agent · max 8 rounds + Grounding"]
AG --> UI["Timestamped Answer + Filtered Timeline"]
- Phase 1 — Ingestion (Analyze Once): Each video is hashed into
data/<sha256>/with resumable checkpoints. Scene cuts (PySceneDetect), speech (faster-whisperINT8 + Silero VAD), and anonymous character clusters (InsightFace) all run locally. Only one resized frame (768pxJPEG) per scene is sent once togpt-6-luna(Standard, Flex50% off, or Batch) to generate structured JSON scene notes. - Phase 2 — Interactive Retrieval (MCP Agent): On each query, the agent never touches video frames again. It queries 5 read-only MCP tools (
list_videos,search_video_segments,search_dialogue,get_video_scenes,get_segment_contextwithneighbors=0..6) over an in-memory Snowball + IDF lexical index—no embeddings or vector database—also exposed atPOST /api/videos/<id>/mcp. - Grounding & Privacy: Every response follows a strict JSON schema (
kind,text,scene_ids,found). The server rejects any scene citation not returned by a tool call in that session (with 1 retry), caps execution at 8 rounds, and strips character identities, emotions, and on-screen text before evidence reaches the agent.
Quick Start
Requires Python 3.11/3.12 and Node.js 22+.
# 1. Python environment
python -m venv .venv
.\.venv\Scripts\pip install -r requirements.txt
# 2. Build the frontend
npm --prefix postprocess/ui ci
npm --prefix postprocess/ui run build
# 3. Run the local server
.\.venv\Scripts\python.exe -m postprocess.serve
Open http://127.0.0.1:8000. Set OPENAI_API_KEY in .env for scene analysis and agentic search (browsing saved results works offline without a key).
Tests
.\.venv\Scripts\python.exe -m pytest tests
Project Layout
preprocessing/— scene detection, frame/audio extraction, transcription, and face clusteringprocess/— multimodal scene analysis via OpenAI Responses / Flex / Batchpostprocess/— local HTTP server, MCP bridge, grounded agent loop, and React UI (postprocess/README.md)tests/— Python test suiteassets/— README demos and benchmark chartAgentic Intelligence Video.pdf— diploma thesis paper
License
This project's source code is licensed under the MIT License. Third-party dependencies and downloaded model weights (such as InsightFace buffalo_m and faster-whisper) remain subject to their respective licenses.
Reviews (0)
Sign in to leave a review.
Leave a reviewNo results found