cut-windows
Skill2 starsChanged 13 days agoMITView on GitHub
Cut exact time windows out of a stream VOD or a local file, ready to upload to OpusClip. Uses ytfrag.py while a YouTube VOD is still served as 2-second fragments (which yt-dlp can't cut), yt-dlp once YouTube has processed it and for Twitch, Kick and other links, and ffmpeg for local files, then normalizes the frame rate for upload. Use when a source is over OpusClip's 10-hour limit, is a Kick link, or the user wants frame-exact in and out points.
In this repository15 other files it gives its agents.
- campaignsSkill
- captions-copySkill
- clip-deskSkill
- clipping-pageSkill
- clip-rulesSkill
- countdownSkill
- find-streamsSkill
- hooks-titlesSkill
- launch-daySkill
- opusclip-clipSkill
- pick-momentsSkill
- schedule-postSkill
- scoreboardSkill
- setupSkill
- vodwatchSkill
The file
We split this skill into the rules it gives an agent
3 rules. About 0 are common, 1 is distinctive, and 2 are very specific to this project.
≈0
Common · estimate
Many files like this have a rule of this kind.
≈1
Distinctive · estimate
This author's own choices. Worth a look.
2
Very specific
Tied to their project's names, files or tools. Probably skip.
- Common
- Distinctive
- Very specific
- Distinctive: line 48
After every cut, the script checks the frame rate.
- Very specific: line 54
Add a row to gtavi/provenance.csv: VOD id, in, out, UTC fetch time, file, credit.
- Very specific: line 56
Never run yt-dlp -J on a 24-hour VOD.
≈ “Common” is an estimate: at least 1 in 5 of the 408,460 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
Cut windows
When this is needed
OpusClip imports links up to 10 h long and processes only the range you send, so a source of 10 h or less usually needs no cut.
Cut locally when:
- the source is longer than 10 h (a 24-hour launch stream, for example);
- it is a Kick link (the API's source list names Twitch but not Kick);
- it is a local file;
- the user wants exact edges.
plan_jobs.py already routes these jobs as upload.
Cut every upload job in a plan
python3 -I "${CLAUDE_PLUGIN_ROOT}/scripts/cut_windows.py" --plan gtavi/scans/<slug>/plan.jsonIt writes each job's file and fps back into the plan. Then the opusclip-clip skill runs opusclip_api.py batch, which uploads with the 4-step V2 flow.
Before the first cut it puts the plan on the VOD as YouTube serves it now. A scan of a VOD's 2-second fragments keeps their timeline, which the processed VOD can play later (IShowSpeed's launch VOD: 144 s). So for a plan from such a scan, once YouTube has processed the VOD, timeline.py measures the shift once (a minute of the processed audio cross-correlated with the scan folder's audio.m4a, kept in run.json) and moves every window by it; scanStart/scanEnd keep the scan's times. A weak match stops and asks for a re-scan; --timeline-offset SECONDS sets the shift by hand.
Cut one window
python3 -I "${CLAUDE_PLUGIN_ROOT}/scripts/cut_windows.py" --source <youtube id | url | file> \
--start 4:13:54 --end 4:16:54 --out gtavi/cuts/speed-alligator.mp4 [--height 1080]--start/--end are times as the VOD plays now. For times from a fragment scan of a VOD YouTube has processed since, add the shift: --timeline-offset 144 for IShowSpeed's launch VOD (timeline.py <scan folder> prints it for any scan).
| Source | Method |
YouTube VOD still served as 2-second fragments (protocol http_dash_segments, usual right after a stream; yt-dlp --download-sections fails on these) | ytfrag.py window. It fetches only the fragments it needs, rotates throttled signed URLs and retries. |
processed YouTube VOD (protocol https), Twitch, Kick and other links | yt-dlp --download-sections "*start-end" --force-keyframes-at-cuts. For YouTube the H.264 + AAC renditions come first (299+140, then 137+140, and so on). |
| local file | ffmpeg -ss/-to, re-encoded so the cut is frame-exact |
For YouTube the script asks yt-dlp for the protocol before every cut (yt-dlp --print protocol, nothing downloaded). YouTube processes a VOD into whole files some time after the stream (the launch-day VODs took about a day), and from then on it answers every fragment request with the entire file. ytfrag.py checks again before its first request and exits with status 3 on a processed VOD, or after a reply over 16 MB; the cut then goes to yt-dlp.
After every cut, the script checks the frame rate. OpusClip local uploads need an integer frame rate, so 59.94 or 29.97 fps is re-encoded to 60 or 30.
Checks
ffprobe -v error -show_entries format=duration:stream=width,height,r_frame_rate -of compact <file>: the length should match out minus in, at 1080p.- Make a frame sheet of the cut (
frame_sheet.py --video <file> --out <file>.jpg) and Read it to confirm the right moment. - Add a row to
gtavi/provenance.csv: VOD id, in, out, UTC fetch time, file, credit. - Disk: 1080p windows are large. Delete the cuts once OpusClip has the uploads.
- Never run
yt-dlp -Jon a 24-hour VOD; its info JSON can be hundreds of MB.
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.

