video-understand
Understand video content locally using ffmpeg for frame extraction and Whisper for transcription. Fully offline, no API keys required.
Prerequisites
ffmpeg + ffprobe (required): brew install ffmpeg
openai-whisper (optional, for transcription): pip install openai-whisper
Commands
# Scene detection + transcribe (default)
python3 skills/video-understand/scripts/understand_video.py video.mp4
# Keyframe extraction
python3 skills/video-understand/scripts/understand_video.py video.mp4 -m keyframe
# Regular interval extraction
python3 skills/video-understand/scripts/understand_video.py video.mp4 -m interval
# Limit frames extracted
python3 skills/video-understand/scripts/understand_video.py video.mp4 --max-frames 10
# Use a larger Whisper model
python3 skills/video-understand/scripts/understand_video.py video.mp4 --whisper-model small
# Frames only, skip transcription
python3 skills/video-understand/scripts/understand_video.py video.mp4 --no-transcribe
# Quiet mode (JSON only, no progress)
python3 skills/video-understand/scripts/understand_video.py video.mp4 -q
# Output to file
python3 skills/video-understand/scripts/understand_video.py video.mp4 -o result.json
CLI Options
| Flag |
Description |
video |
Input video file (positional, required) |
-m, --mode |
Extraction mode: scene (default), keyframe, interval |
--max-frames |
Maximum frames to keep (default: 20) |
--whisper-model |
Whisper model size: tiny, base, small, medium, large (default: base) |
--no-transcribe |
Skip audio transcription, extract frames only |
-o, --output |
Write result JSON to file instead of stdout |
-q, --quiet |
Suppress progress messages, output only JSON |
Extraction Modes
| Mode |
How it works |
Best for |
scene |
Detects scene changes via ffmpeg select='gt(scene,0.3)' |
Most videos, varied content |
keyframe |
Extracts I-frames (codec keyframes) |
Encoded video with natural keyframe placement |
interval |
Evenly spaced frames based on duration and max-frames |
Fixed sampling, predictable output |
If scene mode detects no scene changes, it automatically falls back to interval mode.
Output
The script outputs JSON to stdout (or file with -o). See references/output-format.md for the full schema.
{
"video": "video.mp4",
"duration": 18.076,
"resolution": {"width": 1224, "height": 1080},
"mode": "scene",
"frames": [
{"path": "/abs/path/frame_0001.jpg", "timestamp": 0.0, "timestamp_formatted": "00:00"}
],
"frame_count": 12,
"transcript": [
{"start": 0.0, "end": 2.5, "text": "Hello and welcome..."}
],
"text": "Full transcript...",
"note": "Use the Read tool to view frame images for visual understanding."
}
Use the Read tool on frame image paths to visually inspect extracted frames.
References
references/output-format.md -- Full JSON output schema documentation
1---2name: video-understand3description: Understand video content locally using ffmpeg frame extraction and Whisper transcription. No API keys needed. Use when: (1) Understanding what a video contains, (2) Transcribing video audio locally, (3) Extracting key frames for visual analysis, (4) Getting video content without API keys.4---5
6# video-understand
7
8Understand video content locally using ffmpeg for frame extraction and Whisper for transcription. Fully offline, no API keys required.
9
10## Prerequisites
11
12- `ffmpeg` + `ffprobe` (required): `brew install ffmpeg`
13- `openai-whisper` (optional, for transcription): `pip install openai-whisper`
14
15## Commands
16
17```bash
18# Scene detection + transcribe (default)
19python3 skills/video-understand/scripts/understand_video.py video.mp4
20
21# Keyframe extraction
22python3 skills/video-understand/scripts/understand_video.py video.mp4 -m keyframe
23
24# Regular interval extraction
25python3 skills/video-understand/scripts/understand_video.py video.mp4 -m interval
26
27# Limit frames extracted
28python3 skills/video-understand/scripts/understand_video.py video.mp4 --max-frames 10
29
30# Use a larger Whisper model
31python3 skills/video-understand/scripts/understand_video.py video.mp4 --whisper-model small
32
33# Frames only, skip transcription
34python3 skills/video-understand/scripts/understand_video.py video.mp4 --no-transcribe
35
36# Quiet mode (JSON only, no progress)
37python3 skills/video-understand/scripts/understand_video.py video.mp4 -q
38
39# Output to file
40python3 skills/video-understand/scripts/understand_video.py video.mp4 -o result.json
41```
42
43## CLI Options
44
45| Flag | Description |
46|------|-------------|
47| `video` | Input video file (positional, required) |
48| `-m, --mode` | Extraction mode: `scene` (default), `keyframe`, `interval` |
49| `--max-frames` | Maximum frames to keep (default: 20) |
50| `--whisper-model` | Whisper model size: tiny, base, small, medium, large (default: base) |
51| `--no-transcribe` | Skip audio transcription, extract frames only |
52| `-o, --output` | Write result JSON to file instead of stdout |
53| `-q, --quiet` | Suppress progress messages, output only JSON |
54
55## Extraction Modes
56
57| Mode | How it works | Best for |
58|------|-------------|----------|
59| `scene` | Detects scene changes via ffmpeg `select='gt(scene,0.3)'` | Most videos, varied content |
60| `keyframe` | Extracts I-frames (codec keyframes) | Encoded video with natural keyframe placement |
61| `interval` | Evenly spaced frames based on duration and max-frames | Fixed sampling, predictable output |
62
63If `scene` mode detects no scene changes, it automatically falls back to `interval` mode.
64
65## Output
66
67The script outputs JSON to stdout (or file with `-o`). See `references/output-format.md` for the full schema.
68
69```json
70{
71 "video": "video.mp4",
72 "duration": 18.076,
73 "resolution": {"width": 1224, "height": 1080},
74 "mode": "scene",
75 "frames": [
76 {"path": "/abs/path/frame_0001.jpg", "timestamp": 0.0, "timestamp_formatted": "00:00"}
77 ],
78 "frame_count": 12,
79 "transcript": [
80 {"start": 0.0, "end": 2.5, "text": "Hello and welcome..."}
81 ],
82 "text": "Full transcript...",
83 "note": "Use the Read tool to view frame images for visual understanding."
84}
85```
86
87Use the Read tool on frame image paths to visually inspect extracted frames.
88
89## References
90
91- `references/output-format.md` -- Full JSON output schema documentation