shots
Skill1 starsChanged 3 months agoMITView on GitHub
Detect hard cuts (shot boundaries) in video via ffmpeg scene detection and extract midpoint stills per shot. Use when the unit of analysis is a shot — cataloging cuts, QC, or feeding shot-level frames to vision/OCR — not TV program structure or commercial breaks.
1 other project uses a version of this.
Adopted by
Most recently taken up by
- alfredoperez/speckit-companiontheir own version, first seen Nov 1, 2026
Other versions1 project uses a version of this.
Word for word · 0
None found.
Edited · 0
None found.
Wrote their own version · 1
- alfredoperez/speckit-companion★ 104same name
How matches are found. Word for word: the exact same text. Edited: shares passages with this file (“99% same” means 99% of its five-word phrases also appear here; 10% or more counts). Their own version: similar meaning, or, weakest, the same name. We can’t tell which project had it first. Projects are counted among the 200 most-starred candidates, and mentions are links to the repository we found, up to 50 per site, so both counts are a floor.
In this repository16 other files it gives its agents.
- AGENTS.mdAGENTS.md
- site/AGENTS.mdAGENTS.md
- site/CLAUDE.mdCLAUDE.md
- audioSkill
- captions-complianceSkill
- downloadSkill
- forced-narrative-exactSkill
- imageSkill
- inspectSkill
- install-media-toolsSkill
- program-masterSkill
- speech-captionsSkill
- subtitlesSkill
- timecodeSkill
- video-transformationSkill
- vision-analysisSkill
The file
We split this skill into the rules it gives an agent
9 rules. About 0 are common, 2 are distinctive, and 7 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈2
Distinctive · estimate
This author's own choices. Worth a look.
7
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 32
Prefer shot detection over fixed-interval frame sampling when the unit of analysis is a shot, not a time grid.
- Very specific: line 57
If your tools showed a filesystem path when loading this SKILL.md, strip SKILL.md and use that folder.
- Very specific: line 58
If you already ran another mediaskills script (for example .../audio/scripts/extract.py), this skill is a sibling of that folder: same …
- Very specific: line 81
Prefer absolute paths for --input / --output when cwd is uncertain.
- Distinctive: line 86
Before running any script, treat these two failures differently:
- Very specific: line 89
Only escalate sandbox permissions if the error is explicitly a permission denial (e.g.
- Very specific: line 99
Read shot_count and shots from the JSON result.
- Very specific: line 118
Default --threshold is 0.35 (ffmpeg scene score 0–1).
- Very specific: line 127
Always use the manifest_path / shots_path from the JSON result for downstream steps — do not invent filenames.
≈ “Common” is an estimate: at least 1 in 5 of the 350,495 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.
Files
Shots
Detect hard cuts (shot boundaries) in video and extract a representative still from the middle of each shot.
Shots vs program-master
| Question | Use shots | Use program-master |
| What are you finding? | Hard cuts inside content (camera angle changes, edits) | Structural gaps between programs/parts (black + silent breaks) |
| Typical source | Any edited video | TV master with black+silent separators |
| Output unit | Shot list with timecodes | Content segments with labels (episode, commercial, slate text) |
| Detection method | ffmpeg select=gt(scene,N) | ffmpeg blackdetect + silencedetect overlap |
Use shots when you need every edit point or shot-level stills for vision analysis. Use program-master when the user asks to label segments, find commercial breaks, or name episodes/parts in a broadcast master. Do not use shot detection for TV structure — a single "shot" may span an entire scene, and program breaks are often fades, not hard cuts.
When to use
- Cataloging a program into shots for review or QC
- Feeding shot-level stills into vision analysis or OCR
- Building on-screen text reports at shot granularity
Prefer shot detection over fixed-interval frame sampling when the unit of analysis is a shot, not a time grid. For uniform time sampling (e.g. every 1s for forced-narrative sweeps), extract frames at fixed intervals instead.
Output paths
Shot manifests and extracted stills write to the workspace root .mediaskills/generated/ (not inside this skill folder). Override with $MEDIASKILLS_DATA_DIR/generated/ when set.
Scripts
| Script | Purpose |
detect.py | Scene-cut detection via ffmpeg select=gt(scene,N) |
extract-frames.py | Extract midpoint stills for every shot |
Running scripts
This skill's scripts live in scripts/ alongside this file. Before running any script, resolve its absolute path from this skill's own directory — do not assume the shell cwd is the skill folder, the repo root, or the workspace. Stay in the workspace (so media paths resolve) and pass the absolute script path to uv run:
uv run <skill_directory>/scripts/detect.py --input "<path-to-media>"<skill_directory> is a placeholder. Never pass those angle brackets to the shell — the command will fail. Replace it with a real absolute directory before invoking uv run.
How to get that directory (do this yourself; do not ask the user first; do not skip the skill):
- If your tools showed a filesystem path when loading this
SKILL.md, stripSKILL.mdand use that folder. - If you already ran another mediaskills script (for example
.../audio/scripts/extract.py), this skill is a sibling of that folder: same parent, directory nameshots. - Otherwise search standard install locations and confirm the script exists:
NAME=shots
for d in \
"$HOME/.agents/skills/$NAME" \
"$HOME/.cursor/skills/$NAME" \
"$HOME/.codex/skills/$NAME" \
"$HOME/.claude/skills/$NAME" \
"$PWD/.agents/skills/$NAME" \
"$PWD/.cursor/skills/$NAME" \
"$PWD/skills/$NAME"
do
if [ -f "$d/SKILL.md" ] && [ -e "$d/scripts/detect.py" ]; then
SKILL_DIR=$(cd "$d" && pwd)
break
fi
done
[ -n "$SKILL_DIR" ] || { echo "mediaskills: $NAME not found" >&2; exit 1; }
uv run "$SKILL_DIR/scripts/detect.py" --input "<path-to-media>"Prefer absolute paths for --input / --output when cwd is uncertain.
Missing binaries vs permissions
Before running any script, treat these two failures differently:
- If a required binary (
uv,ffmpeg,ffprobe) reportsNo such file or directoryorcommand not found: this is a missing or unreachable binary, not a permissions issue. Escalating sandbox permissions will not fix it. Runcommand -v uv,command -v ffmpeg, andcommand -v ffprobeto see whether they resolve at all. If not, install or re-link them (install-media-toolsdoctor/install) rather than retrying with wider permissions. - Only escalate sandbox permissions if the error is explicitly a permission denial (e.g.
Operation not permitted,Permission denied).
Recipes
Shot catalog (cuts only)
uv run <skill_directory>/scripts/detect.py --input /path/to/clip.mp4Read shot_count and shots from the JSON result. The manifest path is in manifest_path (auto-generated *_shots.json under .mediaskills/generated/).
Shot stills for vision analysis
uv run <skill_directory>/scripts/detect.py --input clip.mp4
uv run <skill_directory>/scripts/extract-frames.py --shots-path .mediaskills/generated/clip_shots_*.jsonOr detect inline:
uv run <skill_directory>/scripts/extract-frames.py --input clip.mp4The updated manifest lists every frame_path with per-frame technical metadata (width/height). JPGs land in .mediaskills/generated/<stem>_shot_frames/.
Threshold tuning
- Default
--thresholdis0.35(ffmpeg scene score 0–1). Lower (e.g.0.25) finds more cuts; higher (e.g.0.5) is stricter. --min-shot-seconds(default0.5) merges shots shorter than that into neighbors — reduces flicker from flash frames.- Hard cuts are reliable; slow dissolves/fades may be missed (ffmpeg scene filter limitation).
Outputs
detect.py→ JSON manifest (*_shots.json) withshots[]array: index, start/end seconds, timecodes, scene_scoreextract-frames.py→ updates the manifest withframes[]and writes JPG stills toframes_dir
Always use the manifest_path / shots_path from the JSON result for downstream steps — do not invent filenames.
Acceptance checks (agent must pass before delivery)
- Contract: exit 0,
ok: true, manifest and any frames_dir exist. - Spot-check:
shot_countis plausible for the content; open 2–3 midpoint JPGs and confirm they fall inside distinct shots when cuts are expected. - On hard-cut masters, assert known cut inventory when available; dissolves/fades may be missed — say so.
- On failure: retune
--threshold/--min-shot-secondsor escalate; do not invent shot boundaries.
Do not use for
- Full program structure / act breaks (use
program-master) - Vision-based scene understanding (use
vision-analysis)
Related skills
image—ocr.pyon a single extracted stillprogram-master— black/silence TV structure (different segmentation axis)video-transformation—extract_frame.pyfor a single timestamptimecode— frame-accurate timecode math
Does it work?
Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.
No reviews yet
People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.
- It worked
- Partly
- It didn't
Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.
Your trail
Files you open will collect here, so you can find them again.
Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.
Now do this for your own.
Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.

