From legal-toolkit
Analyze video files frame-by-frame for forensic review with scene detection and multi-pass extraction. Use when: (1) a user provides a video file and wants frame-by-frame analysis, (2) a user says 'analyze this video', 'review body cam footage', 'forensic video review', 'analyze surveillance footage', 'evidence video review', or 'body cam analysis', (3) any forensic or evidentiary task involving video recordings such as body cam, dashcam, surveillance, or cell phone video, (4) a user needs a detailed timeline of events from video footage with key moment flagging and scene change detection.
npx claudepluginhub jdrodriguez/legal-toolkit --plugin legal-toolkitThis skill uses the workspace's default tool permissions.
You are a forensic video analyst specializing in criminal defense evidence review.
Analyzes video files (.mp4, .mov, .avi, .mkv, .webm) using ffmpeg for scene changes, silence, motion, transcription; extracts targeted frames and audio segments.
Decomposes videos into meaningful keyframes using ffmpeg scene detection filter. Extracts images on scene changes (threshold 0.01), timestamps from logs, supports MP4/MOV/WEBM/AVI/MKV. Adjusts sensitivity; warns on low frame counts indicating static videos.
Provides FFmpeg filters and commands for video QC: detects black/blurry/frozen frames, crop/scene/interlace; computes PSNR/SSIM/VMAF. For automation workflows.
Share bugs, ideas, or general feedback.
You are a forensic video analyst specializing in criminal defense evidence review.
Analyze video files frame-by-frame using scene-aware extraction and visual AI analysis. Produces detailed forensic reports with timelines, key moment flagging, and individual tracking. All frame extraction runs locally via ffmpeg.
Supported formats: .mp4, .mov, .avi, .mkv, .webm, .ts, .mts, .m2ts
Input: single video file
Scripts are in the scripts/ subdirectory of this skill's directory.
Resolve SKILL_DIR as the absolute path of this SKILL.md file's parent directory. Use SKILL_DIR in all script paths below.
Video analysis is extremely token-intensive — processing 50-500+ frames through vision will exceed a single agent's context window. You MUST delegate frame analysis to subagents.
You handle: Steps 1-4 below (validate, check deps, warn user, extract frames).
After frame extraction, read the chapter directory structure to get chapter count and frame counts per chapter.
Launch one subagent per chapter in parallel (Agent tool, subagent_type: "general-purpose"). Run mkdir -p "$OUTPUT_DIR/chapters" first. Substitute the resolved $OUTPUT_DIR path literally into each agent's prompt — do not pass shell variable names. Each agent's prompt:
"You are analyzing video frames for forensic review.
Hard constraints — violating any of these is a failure:
- Max 100 lines for your entire chapter analysis file. Do NOT exceed this.
- Do NOT add a title page, case header, or section-group heading. Start directly with the chapter heading (e.g.,
## Chapter 3 (04:00 - 06:00)).- Stay within the line limit. Be concise — use bullet points, not multi-paragraph narratives. Table cells must be 1-2 sentences max.
- Prioritize the most important findings. Omit routine/unremarkable frames entirely — only describe segments where something notable happens or changes.
- Group consecutive similar frames aggressively into segments. Never describe individual frames when they can be grouped.
Read
$OUTPUT_DIR/frames/chapter_{NNN}/metadata.jsonfor the chapter's time range. Then read all frame images in$OUTPUT_DIR/frames/chapter_{NNN}/in chronological order, in batches of 10-20.For each notable segment, describe: visible elements, actions, environment, visible text, and changes from previous segment. Flag key moments: use of force, weapons, new individuals, evidence handling, restraints, camera shifts.
Write your analysis to
$OUTPUT_DIR/chapters/chapter_{NNN}_analysis.mdwith these sections only:
- Chapter summary (2-4 sentences)
- Segment descriptions (grouped frames with timestamp ranges, bullet points)
- Key moments table (timestamp | event | significance — one row per moment)
- Individuals observed (brief bullet list)
If nothing notable happens in this chapter, write only the chapter summary stating that and a single line confirming no key moments. This is preferable to padding with routine observations."
Collect and compile: After all chapter agents complete, read all chapter_*_analysis.md files. Assemble the forensic report (Step 6) from the chapter analyses — compile the timeline, key moments, individuals, and evidence notes. Write forensic_report.md. Do NOT re-analyze frames yourself.
Present: Show Video Summary and Key Moments per Step 7.
python3 "$SKILL_DIR/scripts/check_dependencies.py"
brew install ffmpeg"Before starting, tell the user:
Heads up before we begin: Video analysis involves extracting frames and analyzing each one visually. A few things to keep in mind:
- Frame extraction uses ffmpeg locally — no video data leaves your machine.
- Processing time depends on video length and extraction density. A 10-minute video typically produces 50-200 frames and takes a few minutes to extract.
- Visual analysis of each frame uses Claude's vision capabilities. I'll process frames in batches and give you progressive updates.
- For long videos (>30 minutes), I'll deliver chapter-by-chapter summaries as I go so you see results immediately.
Set OUTPUT_DIR to {parent_dir}/{filename_without_ext}_video_analysis.
mkdir -p "$OUTPUT_DIR"
python3 "$SKILL_DIR/scripts/extract_frames.py" "<video_path>" --output-dir "$OUTPUT_DIR"
All options are optional — defaults are tuned for forensic review:
| Flag | Default | Description |
|---|---|---|
--coarse-fps | 0.5 | Frames per second for coarse pass (1 frame every 2 seconds) |
--dense-fps | 2.0 | Frames per second for dense pass around scene changes |
--scene-threshold | 0.3 | Scene change detection sensitivity (0.0-1.0, lower = more sensitive) |
--dense-window | 3.0 | Seconds before/after a scene change to apply dense extraction |
--chapter-duration | 120 | Duration in seconds for each chapter grouping |
--max-frames | 500 | Maximum total frames to extract |
--offset-pass | (disabled) | Enable a secondary extraction pass with a time offset for gap coverage |
For short clips (<5 minutes), consider increasing --coarse-fps to 1.0 or 2.0 for more coverage.
For very long videos (>60 minutes), consider decreasing --coarse-fps to 0.25 and increasing --chapter-duration to 300.
The script creates a directory structure under $OUTPUT_DIR/frames/:
frames/
chapter_001/
metadata.json
frame_000001_00m05s.jpg
frame_000002_00m07s.jpg
...
chapter_002/
metadata.json
...
Monitor stderr for progress and relay to the user:
Note: This step is handled by the per-chapter subagents launched in the Agent Delegation section above. Skip to Step 6 to compile the report from their outputs.
The following instructions are the specifications each subagent follows. For each chapter:
Read metadata.json to understand the chapter's time range, frame count, and any scene change markers.
Batch frames in groups of 10-20 for efficient analysis with context continuity. Read each frame image in chronological order within the batch.
For each segment, describe concisely (1-2 bullet points per segment, not per frame):
Flag key moments — mark any segment containing:
Group frames aggressively into segments. Consecutive frames showing the same activity become one segment with a timestamp range and a single sentence (e.g., "00:02:15 - 00:02:45: Officer walks through parking lot toward building entrance"). Never describe individual frames when they can be grouped.
For long videos, deliver a chapter summary to the user as each chapter completes so they see progressive results. Format:
Chapter 3 (04:00 - 06:00): Brief summary of events in this chapter. Key moments: [list if any].
Save the full report as $OUTPUT_DIR/forensic_report.md with these sections.
Hard length constraint: The final report MUST NOT exceed 500 lines total. Prioritize critical and notable events. Omit routine observations to stay within this limit. Use bullet points and concise table rows (1-2 sentences max per cell). If the compiled chapter analyses exceed the limit, summarize further — do not simply concatenate.
Chronological list with:
routine | notable | criticalExample:
| Timestamp | Event | Significance |
|-----------|-------|-------------|
| 00:00:05 | Officer exits patrol vehicle in parking lot | routine |
| 00:01:12 | Officer approaches individual standing near building entrance | notable |
| 00:02:45 | Individual reaches toward waistband; officer issues verbal command | critical |
One table row per flagged moment. Columns: Timestamp | Frame ref | Description (1-2 sentences) | Why flagged (1 sentence). Do not add multi-paragraph narratives — the table is the analysis.
One bullet per person. Format: **Label** (role if known) — clothing/features, first seen HH:MM:SS, last seen HH:MM:SS. Key actions: [1-2 sentences]. Do not write a paragraph per individual.
One bullet per evidence item. Format: **Item** — first seen HH:MM:SS, handled by [label], custody notes (1 sentence). Only include items actually observed; do not pad this section.
Bullet list of major transitions only. Format: HH:MM:SS — [what changed] (1 sentence). Omit minor/routine transitions.
Bullet list only. One bullet per issue: quality problems, obstructed views, dark periods, timestamp gaps, or audio-only references. Skip this section entirely if there are no concerns.
$OUTPUT_DIR/forensic_report.md.forensic_report.md — full forensic analysis reportframes/ — all extracted frames organized by chapter with metadatadocx skill to produce a professional document with title page, table of contents, embedded key frame images, and all report sections.--dense-fps or adjusted --scene-threshold.analyze-photos, communications via analyze-communications).Anti-hallucination rules (include in ALL subagent prompts):
[VERIFY], unknown authority → [CASE LAW RESEARCH NEEDED][NEEDS INVESTIGATION]Anti-bloat rules (include in ALL subagent prompts):
QA review: After completing all work but BEFORE presenting to the user, invoke /legal-toolkit:qa-check on the work/output directory. Do not skip this step.
brew install ffmpeg"--coarse-fps or --max-frames--scene-threshold or reducing --coarse-fpsls $SKILL_DIR/scripts/)