Combine with Dual-Keyframe & QA workflows
Pair extracted keyframes with Workflow 10: Locked First-and-Last Frame Match-Cut Sequence and use contact sheets inside Skill 25: Thumbnail and First-3s Hook Auditor Subagent.
SKILL.md Install into .claude/skills/, .cursor/skills/, or .agents/skills/ below whenever you want your agent to slice footage on cuts, grab lossless keyframes, or build visual contact sheets for QA.
Installable SKILL.md teaching Claude Code, Cursor, and Codex how to detect shot cuts with FFmpeg, extract lossless PNG first/last keyframes for Image-to-Video continuity, and generate compact tiled contact sheets so vision agents can inspect entire video sequences in one image.
Pick Claude Code, Cursor, or Codex below and download the pure raw SKILL.md file.
Prompt e.g. 'Build a 3×2 contact sheet from ./renders/take1.mp4 and extract the exact opening and final frames as PNGs.'
Review every beat at a glance or pass lossless extracted frames directly into Gemini Omni Flash or Luma Ray 3.2 start/end-frame bridges.
Pick the app you use below for the exact verified command or config—zero manual guessing.
.claude/skills/ffmpeg-contact-sheet/SKILL.md. mkdir -p .claude/skills/ffmpeg-contact-sheet
curl -fsSL https://framesfield.com/raw/skills/ffmpeg-scene-cut-and-contact-sheet-skill -o .claude/skills/ffmpeg-contact-sheet/SKILL.md .cursor/skills/ folder. mkdir -p .cursor/skills/ffmpeg-contact-sheet
curl -fsSL https://framesfield.com/raw/skills/ffmpeg-scene-cut-and-contact-sheet-skill -o .cursor/skills/ffmpeg-contact-sheet/SKILL.md .agents/skills/ for cross-agent teams. mkdir -p .agents/skills/ffmpeg-contact-sheet
curl -fsSL https://framesfield.com/raw/skills/ffmpeg-scene-cut-and-contact-sheet-skill -o .agents/skills/ffmpeg-contact-sheet/SKILL.md
This is the exact raw file served at /raw/skills/ffmpeg-scene-cut-and-contact-sheet-skill.
---
name: ffmpeg-contact-sheet
description: Detect scene cuts, extract lossless PNG opening and closing keyframes, and render tiled visual contact sheets from AI video clips using local ffmpeg and ffprobe for visual QA and I2V continuity.
---
# FFmpeg Scene Detection, Keyframe Extraction & Contact Sheet Protocol
Use these verified local FFmpeg patterns whenever inspecting generated video takes, extracting exact transition frames, or auditing multi-shot edits:
## 1. Build a Visual Inspection Contact Sheet (Single Image QA)
Sample frames evenly across a 5–10s clip into one crisp tiled PNG so a human or vision-capable agent can spot morphing, warped hands, or drift in one glance:
```bash
# Example: 2 fps across a 3s clip -> 6 tiles (3x2 grid) at 320px wide each
ffmpeg -y -i clip.mp4 \
-vf "fps=2,scale=320:-2:flags=lanczos,tile=3x2:padding=4:margin=4:color=black" \
-frames:v 1 contact_sheet.png
```
For longer 8–10s clips, use `fps=1,scale=360:-2:flags=lanczos,tile=4x3:padding=4:margin=4:color=black`.
## 2. Extract Exact Lossless Opening & Closing Frames (PNG)
Never JPEG-compress keyframes intended for Image-to-Video or First/Last Frame transitions:
```bash
# First frame (frame 0)
ffmpeg -y -i clip.mp4 -vf "select=eq(n\,0)" -vframes 1 first_frame.png
# Final frame (fast reverse-seek from EOF)
ffmpeg -y -sseof -0.15 -i clip.mp4 -update 1 -frames:v 1 last_frame.png
```
## 3. Detect Hard Scene Cuts Programmatically
Log timestamps where scene score crosses `0.35` (raise to `0.45` for fast action, lower to `0.25` for subtle studio cuts):
```bash
ffmpeg -i edit.mp4 -vf "select='gt(scene,0.35)',showinfo" -f null - 2>&1 \
| grep "pts_time:"
```
## 4. Continuity Rule Warning
If extracting `last_frame.png` from an MP4 to extend a sequence, warn the user that chaining compressed MP4 frames more than 2 hops compounds VAE softening—prefer branching from pristine Level-0 PNG stills whenever character identity matters. "Generate a 3x2 contact sheet for ./renders/shot02_kling.mp4 so I can check for label warping, and extract the exact final frame as ./keyframes/shot02_end.png."
- Runs verified `tile=3x2` lanczos filter -> outputs crisp `contact_sheet.png` for instant visual QA. - Extracts lossless `shot02_end.png` via `-sseof -0.15 -update 1 -frames:v 1`. - Reports frame dimensions and reminds about Level-0 Star-Branching if chaining further character shots.
fps= sampling can miss a 1-frame glitch between samples; increase fps or inspect cut boundaries explicitly for flagship spots0.35) does not trigger on slow cross-dissolves—only hard cutsPair extracted keyframes with Workflow 10: Locked First-and-Last Frame Match-Cut Sequence and use contact sheets inside Skill 25: Thumbnail and First-3s Hook Auditor Subagent.
-sseof -0.15 to grab the last frame? -update 1 overwrites cleanly with the final valid decoded frame.