Study Brainrot Generator
Type in a topic and get back a finished short-form study video: script, voiceover, render.
- 01Research
- 02Script generation
- 03Validation before trust
- 04Voice and word timings
- 05Captions and cut
- 06Packing and background continuity
Architecture Overview
Type a topic into a workflow input and finished short-form study videos come back: researched, scripted, narrated, captioned and cut to phone shape. Four stages hand work to each other as files in a build folder rather than talking directly, so any one of them can be rerun or replaced on its own. GitHub Actions is the entire runtime — nothing is installed, nothing is hosted, and the machine disappears when the run ends.
How it works
Core mechanics, failure recovery paths, and system design decisions.
Research
Takes the top three real Wikipedia articles, discarding disambiguation pages, and fits them into a 15,000-character budget by equal shares, shortest first, handing unused space back. Otherwise one enormous article crowds the other two out entirely.
Script generation
Asks for twelve chunks of 25 to 35 words under a strict-JSON contract, working down a ranked list of the Gemini models that are actually free today and falling back to DeepSeek. A quota or missing-model error moves to the next one; a bad key stops immediately, because retrying will never fix it.
Validation before trust
The script has to parse, hold 6 to 16 chunks, and keep every chunk non-empty and under 60 words — a hand-written script goes through exactly the same gate. A bad one fails here rather than five minutes later inside a finished video.
Voice and word timings
edge-tts narrates each chunk and returns the start and length of every spoken word. The newer conversational voices return none at all, so the run measures the audio with ffprobe and shares the time out by word length instead, and says so in the log.
Captions and cut
Word timings become karaoke subtitle tags, three words to a line, with a timer covering the silence before each word — without it the highlight drifts ahead of the voice and the error compounds along the line. FFmpeg burns them into background footage scaled and cropped to 1080×1920, with padding silence and loudness normalisation.
Packing and background continuity
Chunks are packed into videos up to 55 seconds and never cut in half, so no video ends mid-sentence. Background clips play as one continuous timeline across segments, seeked with the trim filter on a rotated playlist because seeking the concat demuxer silently drops frames.
Engineering Highlights
- •Runs entirely on GitHub Actions: no install, no hosting, no video editor
- •Stages talk through files, so any one of them can be rerun alone
- •Model failover ranked by which free models actually have quota today
- •Caption timing pays for the silences, so it stays locked to the voice
- •Typed workflow input never reaches the shell: passed as an environment variable and pattern-checked