This is project 100. One hundred projects, thirty days, and the last one eats its own tail: a machine that watches a long video, reads what was said, picks the best bits, and cuts them into vertical Shorts with the captions burnt in. The Shorts promoting this series should be cut by this project. That is the demo, and this article tells you exactly what it produced — including the parts where it embarrassed itself.
Here is the deal in one sentence: Whisper writes down every word with a timestamp, Gemini (or a local scorer, if you have no API key) picks the moments worth keeping, and FFmpeg does the cutting, the vertical crop and the captions. You run one command. You get Shorts.
How it works
Four scripts, each doing one job, in a line:
transcribe.py— turns the video’s audio into timed segments. The real path is Whisper running on your own machine. It listens to the audio and writes out lines like[20.0–30.0] The camera runs MediaPipe Pose…. Nothing is uploaded anywhere.clipper.py— scores every possible clip and cuts the winners. With a Gemini API key it asks Gemini to pick the moments. Without one it scores windows of 2–4 transcript segments itself, using fixed weights (more on those below), then runs every winner through a quality gate.captions.py— turns each clip’s transcript slice into an SRT of short cues (seven words or fewer) and checks the caption words against the transcript words.config.py— every number you might want to change lives here: clip length limits, the score needed to survive the gate, the caption font size, the Whisper model.
The cutting itself is one FFmpeg command per clip: trim to the window, centre-crop the 16:9 frame to vertical, upscale to 720×1280, and burn the captions in with the subtitles filter. No video editor opens. No timeline scrubbing.

The maths
Two bits of maths do all the work: the scoring and the crop.
Scoring. The local scorer looks at every window of 2, 3 or 4 consecutive transcript segments. With 12 segments that is 11 windows of two, 10 of three and 9 of four — 30 candidates in total. Each window gets points: +3 for a hook word (slouch, spray, chair, coffee), +2 if it contains a digit (a real result beats a vague claim), +2 if it asks the viewer a question, +1 if it says “you”, +1 if it ends on a punchline. A clip needs 5 points to survive the gate, and it must be 15–60 seconds long and start and end exactly on a segment boundary. Windows that overlap a higher-scoring clip are dropped, so you never get the same moment twice.
The crop. A 720p frame is 1280×720. A Short is 9:16, so the crop width is 720 × 9 ÷ 16 = 405 pixels. FFmpeg cuts a 405×720 slice out of the centre — starting at x = (1280 − 405) ÷ 2 = 437 — then scales it up to 720×1280. The middle of your frame survives; the edges do not. If your speaker stands at the side of the frame, they will lose an arm. Stand in the middle. That is not a joke, it is a framing requirement.
The ratio. The demo input is 120 seconds. The machine kept 80 seconds of it, so two thirds of the video survived and one third hit the floor. That is about right for a talky video: if it keeps everything, it is not selecting.


What I fed it
Honest answer first: the demo input is synthetic. The brief said to run this on a real input the blog owns — a screen recording of one of the Day 1–25 demos. I checked the whole workspace. No such recording exists. The video files in the workspace are AI-generated reel clips, not recordings of demos, and feeding those in and calling it a real demo would be lying with extra steps.
So the demo input is a 120-second video generated by FFmpeg itself: testsrc2 colour bars at 1280×720, 30 frames per second, with a 440 Hz sine tone as the audio track, built by make_demo_input.py. The narration is real words, though — 12 segments, 216 words, written for this demo about the Day 27 Slouch Sprayer build (the chair that sprays you when you slouch). The transcript ships in the zip as sample_data/transcript.vtt, and the script that makes the video is in the zip too, so you can reproduce the whole run.
Two things did not run in this demo, and the article would be a lie without this paragraph. Whisper is not installed on this machine, so transcribe.py used the provided-VTT fallback: it read the transcript file instead of listening to the audio. Gemini has no API key here, so clipper.py used the local scorer instead of asking Gemini. Both fallbacks are loud about it — they print exactly what they did — and both real paths are in the code, wired up, waiting for a machine that has Whisper installed and a key in GEMINI_API_KEY. Every number below comes from the fallback path.
The demo run
One command — python3 run_demo.py — and 104.7 seconds later:
| What | Number |
|---|---|
| Input length | 120.0 seconds (synthetic) |
| Transcript segments | 12 |
| Transcript words | 216 (108 words per minute) |
| Candidate clips scored | 30 |
| Clips kept after the quality gate | 2 |
| Clips rejected | 28 |
| Clip 1 | 20–60 s, 40.0 s long, score 5 |
| Clip 2 | 80–120 s, 40.0 s long, score 5 |
| Total output | 80.0 seconds |
| Caption spot-check, clip 1 | 76 words checked, 0 wrong, 100% |
| Processing time | 104.7 seconds |
Clip 1 is the middle of the video: how the camera measures the shoulder angle, the ten-second rule, the two-second spray, the thirty-second cooldown, and the demo numbers (20 frames, 12 upright, 8 slouched, 3 long slouches). Clip 2 is the ending: what the rig costs, the parts list, the relay safety rule, and the send-off. Both are 720×1280, both have burnt-in captions, and clip 1 ships in the zip under sample_data/ so you can watch the machine’s work.
The 28 rejections are not failures — that is the gate doing its job. Most of them scored 3 or 4 and fell one or two points short of the 5-point line. The machine is picky, and picky is the whole point. A clipper that keeps everything is a copy machine.
The caption check deserves a sentence of its own. It compares the words in clip 1’s SRT file against the words in the source transcript for the same 40 seconds: 76 words, zero mismatches. That 100% is exactly what you would expect, because the captions are built from the same transcript — the check exists to catch bugs in the SRT writer, not to grade Whisper. When Whisper runs for real, this is the check you run by hand: watch one clip, read the captions, count the wrong words yourself.
Processing time: 104.7 seconds to chew through a 120-second video, which is about 0.87× real time — slightly faster than watching it. Most of that is FFmpeg re-encoding the two clips. On a faster machine it will be quicker; on a Raspberry Pi it will be slower.
What it costs
Nothing. That is the honest answer, with one footnote.
Whisper runs locally, free, on your own hardware — the tiny model in config.py works on a laptop; base is better if you have the RAM. Gemini’s free tier covers the clip picking, and you only need it at all if you want a language model choosing instead of the local scorer. FFmpeg is local and free. The whole pipeline runs on your machine, so there is no per-video bill and no upload.
The footnote is about hosting. The research behind this series notes that Hugging Face Spaces gives you 5 GPU minutes a day on its free ZeroGPU tier. This demo is not hosted there — it ran on a plain virtual machine with no GPU at all — so no GPU minutes were used, and if you deploy it to Spaces, 5 minutes a day is your budget. A two-minute video fits. A forty-minute podcast does not. Run the long stuff locally.
What broke
Three things, all worth knowing before you run it yourself.
The captions ate the video. The first render burnt the captions in at a font size that covered the whole frame — six lines of giant text, you could not see the video at all. The bug is a classic: libass scales font sizes by video height divided by its default PlayResY of 384, so a size-28 font at 1280 pixels tall renders at about 93 pixels. The fix was twofold: drop the configured size to 12 (which renders at about 40 pixels), and split each transcript segment into caption cues of at most seven words, so no single cue is ever a wall of text. The frame in the demo now shows a tidy two-line caption. Check a frame before you trust a caption setting — ffmpeg -ss 5 -i clip.mp4 -frames:v 1 frame.png costs nothing.
The scorer rejected the best line. “Slouch once. Get sprayed.” is the hook of the whole video, and the opening 20-second window scored 3 points and got rejected: it has a hook word (+3) but no number, no “you”, and no punchline ending. The local scorer cannot hear delivery — it cannot tell that a short, punchy opening is worth more than a long, number-filled middle. Gemini would probably have kept it. This is the real difference between the fallback and the real path. If you run the local scorer, consider giving the first segment a bonus, or just accept that a keyword scorer is a blunt instrument and check its homework.
The input is synthetic. Already covered above, but it belongs here too: the demo proves the cutting, scoring, cropping and captioning work. It does not prove Whisper hears your voice correctly, because Whisper never ran. The first time you point this at a real video, run the transcription step alone, read the segments, and fix the transcript before you let the clipper loose on it.
Only clip what you own
This one is not a suggestion. Only clip video you own, or video that is public-domain or Creative Commons licensed. Do not clip other creators’ videos. The whole point of this tool is turning your own long videos into your own Shorts — the Day 1–25 demos, your talks, your tutorials. Pointing it at someone else’s work and re-uploading the cuts is theft with extra steps, and no amount of “but the AI picked it” changes that.
Build it yourself
You need Python 3.10 or newer and FFmpeg on your path. That is the whole system requirement — no GPU, no paid account.
git clone <your-repo> clip-machine
cd clip-machine
pip install -r requirements.txt # openai-whisper, google-generativeai
python3 make_demo_input.py # builds the synthetic demo video
python3 run_demo.py # full pipeline + demo_report.jsonFor your own video, skip the demo input and run the pieces directly:
python3 transcribe.py my_video.mp4 --vtt my_transcript.vtt
python3 clipper.py my_video.mp4 --vtt my_transcript.vtt --outdir outputSet GEMINI_API_KEY in your environment if you want Gemini picking the moments instead of the local scorer. Tune the gate in config.py: MIN_SCORE_TO_KEEP is the pickiness dial, MIN_CLIP_SECONDS and MAX_CLIP_SECONDS are the length dials.
The transcript step is the one to babysit. Whisper’s tiny model is fast and free and wrong more often than you would like on names and numbers; base is the sweet spot on a laptop. Read the segments file before you cut. A wrong number in a transcript becomes a wrong number burnt into a Short, and Shorts do not come with footnotes.
# clipper.py — the local scorer, in full
def _score_window(window):
text = " ".join(s.text for s in window)
lower = text.lower()
score = 0
if any(w in lower for w in config.HOOK_WORDS):
score += config.SCORE_HOOK_WORD # +3
if re.search(r"\d", text):
score += config.SCORE_NUMBER # +2
if "?" in text:
score += config.SCORE_QUESTION # +2
if re.search(r"\byou\b", lower):
score += config.SCORE_YOU # +1
if any(w in window[-1].text.lower()
for w in config.PUNCHLINE_WORDS):
score += config.SCORE_PUNCHLINE_END # +1
return score# the cut: trim, centre-crop to 9:16, upscale, burn captions
ffmpeg -y -ss 20 -to 60 -i input.mp4 -vf \
"crop=405:720:437:0,scale=720:1280,subtitles='clip.srt':force_style='FontName=DejaVu Sans,FontSize=12,Alignment=2,MarginV=120'" \
-c:v libx264 -pix_fmt yuv420p -c:a aac clip_01.mp4
Expected outcome
Feed it a two-minute video of you explaining something, and you get two or three vertical, captioned Shorts back in about two minutes, each 15–60 seconds, each starting and ending on a real sentence boundary, each with a score telling you why it was kept. Feed it an hour-long talk and you get a week’s worth of Shorts, assuming the talk has that many good moments in it — the machine cannot invent moments your video does not contain.
That is project 100. One hundred projects, thirty days, and the last one is a machine that makes the adverts for the other ninety-nine. The demo clips in the zip were cut by this project, and the real ones will be cut the same way the moment there is a real recording to feed it. Go build it, point it at something you made, and let your own code do the boring part.
Download
The full project — all six scripts, the config, the requirements, the README, the sample transcript and segment list, and clip 1 from the demo run — is in the zip below. Watch the ad, hit download, and run python3 run_demo.py to reproduce every number in this article.
Premium Download
Get the complete project code ZIP — watch a short ad to unlock the download.
