How adi4771/ai-video-editor-semantic-clip-search works
AI Video Editor is a Streamlit application for finding and exporting video moments from natural-language queries. Users upload a video, which is inspected, sampled into frames, and indexed with CLIP embeddings and detected objects. A query may be simplified by Claude; the app searches indexed frames, groups matches into ranked segments, previews them, then cuts individual clips and optionally merges a highlight reel for download. The graph follows documented and excerpted calls; storage is session-local files and an NPZ cache, not a database.
Main entry points: app.py Streamlit workflow · embeddings.py Frame embeddings · search.py Frame search · clip_generator.py Clip cutting
Components 18
User interaction
- Streamlit workflow
app.py - Segment previews
app.py - Clip downloads
app.py
Video indexing
- Video metadata
utils/video_utils.py - Frame extraction
pipeline/extract_frames.py - Frame embeddings
pipeline/embeddings.py - Object detection
pipeline/object_detection.py - CLIP model loader
models/clip_model_loader.py - Embedding cache
pipeline/embeddings.py
Semantic retrieval
- Query optimizer
utils/query_simplifier.py - Frame search
pipeline/search.py - Cosine scoring
utils/similarity.py - Segment grouping
pipeline/search.py
Clip export
- Clip cutting
pipeline/clip_generator.py - Highlight reel merge
pipeline/clip_generator.py
Other components
- Video editor user
- Claude API
- ffmpeg
Connections 21
- Video editor user → Streamlit workflow: uploads and searches
app.py - Streamlit workflow → Video metadata: reads metadata
app.py - Streamlit workflow → Frame extraction: extracts frames
app.py - Streamlit workflow → Frame embeddings: indexes frames
app.py - Frame embeddings → CLIP model loader: encodes images
pipeline/embeddings.py - Frame embeddings → Object detection: detects objects
pipeline/embeddings.py - Frame embeddings → Embedding cache: reads and writes
pipeline/embeddings.py - Streamlit workflow → Query optimizer: optimizes query
app.py - Query optimizer → Claude API: requests simplification
utils/query_simplifier.py - Streamlit workflow → Frame search: searches frames
app.py - Frame search → CLIP model loader: encodes text
pipeline/search.py - Frame search → Cosine scoring: scores frames
pipeline/search.py - Frame search → Segment grouping: groups matches
app.py - Streamlit workflow → Segment previews: renders segments
app.py - Streamlit workflow → Clip cutting: cuts segments
app.py - Clip cutting → Video metadata: gets duration
pipeline/clip_generator.py - Clip cutting → ffmpeg: cuts video
pipeline/clip_generator.py - Streamlit workflow → Highlight reel merge: requests merge
app.py - Highlight reel merge → ffmpeg: merges clips
pipeline/clip_generator.py - Streamlit workflow → Clip downloads: offers downloads
app.py - Clip downloads → Video editor user: returns clips
app.py