/youtube-screenshotter:youtube-screenshotterfrom youtube-screenshotter
Downloads YouTube videos and extracts PNG frames at specified timestamps with perceptual hashes. Discovers candidate timestamps via ffmpeg scene-detect and pHash run-grouping. Outputs JSON manifests for downstream processing.
Ships in youtube-screenshotter. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Mechanical primitives for video analysis: downloads a YouTube video at 720p via yt-dlp, extracts PNG frames at given timestamps via ffmpeg, computes perceptual hashes (pHash), and discovers candidate timestamps. Emits JSON manifests. No content classification, no LLM calls; the caller (e.g. youtube-synthesizer) decides what to do with the output.
Script paths below are relative to this skill's directory.
# Discover candidate timestamps (ffmpeg scene-detect + per-second pHash runs)
scripts/discover.py "<URL_OR_VIDEO_ID>" -o ./out
# Extract frames at specific timestamps
scripts/extract.py "<URL_OR_VIDEO_ID>" -t 1 -t 30 -t 500 -o ./out
extract.py output is a JSON manifest printed to stdout. The output dir holds the cached video file (<video_id>.mp4) and a frames/ subdir of t<ms>.png extracted frames. Repeated calls with the same URL skip the download; repeated timestamps hit the per-frame cache.
discover.py returns a manifest with two source signals (scene_detect and phash_runs) plus a unioned candidates list. Typical pipeline: discover.py → pick candidates from the manifest → extract.py -t <ts1> -t <ts2> ... → classify the extracted frames.
{
"video_path": "/abs/path/to/<video_id>.mp4",
"metadata": {
"video_id": "...", "source_url": "...", "source_title": "...",
"source_author": "...", "source_published_date": "YYYY-MM-DD",
"channel": "...", "channel_id": "...",
"duration_seconds": 1119, "description": "...",
"chapter_markers": [{"title": "...", "start_time": 0.0, "end_time": 153.0}, ...],
"playlist_id": null, "playlist_title": null
},
"entries": [
{"timestamp": 1.0, "frame_path": "/abs/.../frames/t00001000.png", "phash": "b230d3532d4b8de9"},
...
]
}
source_published_date is "" when unknown.
scripts/extract.py composes three primitives that can also be invoked independently:
scripts/video.py <url> [-o DIR] [--no-download] — yt-dlp wrapper for download + metadata. --no-download for cheap metadata-only probes (video_path is then null).scripts/frames.py <video> -t <ts> [-t <ts> ...] [-o DIR] — ffmpeg frame extraction.scripts/phash.py compute <image> / scripts/phash.py compare <a> <b> — perceptual-hash compute + Hamming-distance pair classifier (same / ambiguous / different bands).scripts/discover.py is a separate entrypoint that produces a candidate-timestamp manifest:
ffmpeg select='gt(scene,N)' over the video for sharp-cut transitions (configurable via --threshold-scene, default 0.2).ffmpeg fps=1,scale=320:180 for a single-pass per-second thumbnail set, then computes pHash per thumbnail and groups consecutive thumbnails into a run while their Hamming distance to the run's first thumbnail is ≤ --threshold-phash (default 12 — merges talking-head microexpressions into single runs).--min-run seconds (default 3).The two signals complement each other: scene-detect catches sharp cuts (including 1–2s content stretches that the run-duration filter would drop) but misses slow fade-ins; pHash run-grouping catches every sustained content stretch ≥ --min-run seconds (including fade-in diagrams).
scripts/motion.py handles what discover.py misses: a small object moving across a static background, where run-grouping merges the whole animation into one run. It takes a local video file and a sub-range, re-samples densely (default 4 fps), computes Farneback optical flow, picks the largest moving component, and scores each frame by area * centeredness * edge_penalty. With --sprite-out PATH it also re-extracts evenly-spaced frames across the motion-active span at full resolution and composites a grid (9 frames, 3×3 by default). The JSON manifest has samples, best_candidate, has_progressive_motion, longest_motion_run, sprite_timestamps, and (with --sprite-out) sprite_path and sprite_layout.
scripts/motion.py <video> --start S --end E [--fps 4] [-o DIR]
[--sprite-out PATH] [--sprite-frames 9] [--sprite-cols 3]
Whether to sprite a span, pick a single frame, or annotate in text is the caller's decision (youtube-synthesizer Phase A.5).
scripts/grid.py <extract-manifest.json> -o DIR [--cols 3] [--rows 3] tiles an extract.py manifest's frames into labeled contact sheets (DIR/sheet-NN.jpg, nine frames each by default, each cell labeled #<n> <MM:SS>) and prints [{sheet, cells: [{label, timestamp, frame_path}]}].
{
"video_path": "...", "duration_seconds": 1119,
"thresholds": {"scene": 0.2, "phash": 12, "min_run": 3.0},
"sources": {
"scene_detect": [4.8, 6.9, 18.6, ...],
"phash_runs": [
{"start_t": 88.0, "end_t": 90.0, "duration": 3.0, "phash": "..."},
...
]
},
"candidates": [
{"timestamp": 4.8, "source": "scene_detect", "run_duration": null},
{"timestamp": 88.0, "source": "phash_run", "run_duration": 3.0},
...
]
}
For 64-bit pHash with default thresholds (SAME_MAX=5, DIFFERENT_MIN=20):
same (no meaningful change)different (clear scene/content change)ambiguous — pHash can't disambiguate; needs visual judgmentResolving the ambiguous band is the caller's job (youtube-synthesizer does it by viewing the frames).
Accepted inputs:
https://www.youtube.com/watch?v=VIDEO_IDhttps://youtu.be/VIDEO_IDhttps://youtube.com/embed/VIDEO_IDhttps://youtube.com/shorts/VIDEO_IDuv — installs each script's Python deps into a cached environment. curl -LsSf https://astral.sh/uv/install.sh | sh or pip install uv.ffmpeg 5.1 or newer — required for frame extraction and yt-dlp's video+audio merge. sudo apt install ffmpeg (Linux), brew install ffmpeg (macOS).node or deno on PATH — yt-dlp needs a JavaScript runtime for YouTube, or downloads fail with HTTP 403.youtube.com and googlevideo.com for downloads.scripts/discover.py (opens in a new tab)scripts/extract.py (opens in a new tab)scripts/frames.py (opens in a new tab)scripts/grid.py (opens in a new tab)scripts/motion.py (opens in a new tab)scripts/phash.py (opens in a new tab)scripts/video.py (opens in a new tab)tests/test-discover.sh (opens in a new tab)tests/test-grid.sh (opens in a new tab)tests/test-video.sh (opens in a new tab)What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
youtube, video-analysis, frame-extraction, ffmpeg, phash, scene-detection
npx claudepluginhub devonjones/devon-claude-skills --plugin youtube-screenshotterOther plugins' skills for the same job