Skip to content

Repository files navigation

av — Agentic Video Intelligence

Index. Search. Detect. Video intelligence toolkit for AI agents by Pixel ML.

pip install pixelml-av

What av Does

Video Memory — Ingest videos, search by natural language, ask questions with RAG citations.

Surveillance Intelligence — Detect falls, long queues, crowd gathering, and wheelchair compliance in CCTV footage using temporal reasoning.

Quick Start

Video Search

# 1. Set up your provider
av config setup
# 2. Ingest a video
av ingest video.mp4
# 3. Search
av search "person with red bag"# 4. Ask questions
av ask "what happened at 2:30?"

Surveillance Detection

# Cloud (quick start — Gemini free tier)export AV_API_KEY=your-gemini-key
av sentinel video.mp4
# Local (free, private — runs on your Mac/GPU)
ollama pull mistral-small3.2
av sentinel video.mp4 --provider ollama
# Specific alerts
av sentinel video.mp4 --alerts FALL,LONG_QUEUE
# Batch a directory
av sentinel videos/ --camera cam_lobby

All Commands

# Video memory
av ingest video.mp4 # Index video content
av search "what was discussed"# Semantic search
av ask "key decisions?"# RAG Q&A with citations
av list # List indexed videos
av transcript <id> --format vtt # Get transcript
av export --format jsonl # Export all data
av export --format jsonl
# Surveillance intelligence
av sentinel video.mp4 # Detect events (all 4 alert types)
av sentinel video.mp4 --alerts FALL # Fall detection only
av sentinel video.mp4 -p ollama # Self-hosted (free)
av sentinel videos/ -c cam_lobby # Batch with camera tracking

Sentinel — Surveillance Event Detection

Detects 4 event types using temporal reasoning over VLM observations:

AlertDetectionHow It Works
FALLPosition trackingstanding→lying transition across frames (F1=0.944)
LONG_QUEUETemporal persistenceQueue detected in 3+ consecutive chunks (90s)
CROWD_GATHERINGDensity + growthSustained crowd or rapid person count increase
WHEELCHAIR_COMPLIANCEService timingWheelchair user unattended > threshold

Providers for Sentinel

ProviderSetupCostSpeed
Gemini (cloud)export AV_API_KEY=keyFree tier available~5s/chunk
OpenRouterexport OPENROUTER_API_KEY=key$0.04-0.14/1M tokens~10s/chunk
Ollama (local)ollama pull mistral-small3.2Free~25s/chunk
OpenAIexport AV_API_KEY=key$$$~5s/chunk

Auto-detection: if no provider specified, av tries Gemini → OpenRouter → ollama → OpenAI.

How It Works

Video → 30s chunks (5s overlap)
→ 8 frames per chunk
→ VLM perception (positions, queue, crowd, wheelchair)
→ Temporal agent (state across chunks)
→ Alert rules (transition detection, persistence, growth)
→ JSON output

Built on 107 experiments across 21 vision models. Key insight: structural extraction + temporal rules beats generic "detect anomalies" prompts.

Configuration

Interactive Setup (Recommended)

av config setup

Choose from four providers:

#ProviderAuthTranscriptionEmbeddings
1OpenAI (Codex OAuth)Auto-detectedWhispertext-embedding-3-small
2OpenAI (API key)sk-... keyWhispertext-embedding-3-small
3Anthropic (Claude)API keyNot supportedNot supported
4Google (Gemini)API keyNot supportedtext-embedding-004

Config is saved to ~/.config/av/config.json and persists across sessions.

Note: Anthropic and Gemini don't support Whisper transcription. With these providers, use av ingest --captions for frame-based captioning, or set AV_OPENAI_API_KEY for transcription fallback.

Environment Variables

Env vars always override config.json:

export AV_API_KEY="sk-..."export AV_API_BASE_URL="https://api.openai.com/v1"# or any OpenAI-compatible endpointexport AV_TRANSCRIBE_MODEL="whisper"export AV_VISION_MODEL="gpt-4-1"export AV_EMBED_MODEL="text-embedding-3-small"export AV_CHAT_MODEL="gpt-4-1"

Requirements

  • Python 3.11+
  • FFmpeg (brew install ffmpeg)
  • An API key from OpenAI, Anthropic, or Google — or Codex CLI OAuth

Commands

CommandDescription
av config setupInteractive provider setup wizard
av config showShow current configuration
av ingest <path>Ingest video file(s) into the index
av search <query>Full-text + semantic search
av ask <question>RAG Q&A with citations
av listList all indexed videos
av info <video_id>Detailed video metadata
av transcript <id>Output transcript (VTT/SRT/text)
av exportExport as JSONL/VTT/SRT
av open <id> --at <sec>Open video at timestamp
av versionPrint version JSON

License

Apache License 2.0 — see LICENSE for details.

About

Video Memory CLI: index once, search/ask forever (dense captions + transcripts + timestamps). Built for agents.

Topics

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages