ViralClipBrain: long podcasts to ranked vertical clips
I built a pipeline that takes a long podcast video and returns ranked, captioned 9:16 clips with the crop following whoever is speaking.
The problem
Finding the few good moments in a one to three hour podcast and cutting them into vertical clips takes an editor hours per episode, and it has to work in more than one language. I wanted the whole path from raw video to postable clip to run on its own, and to be checkable.
How I built it
Deepgram transcribes with word timestamps, forced alignment tightens the timing, and a multi-step LLM engine finds candidate clips, snaps their edges to clean sentence ends and pauses, validates the boundaries, picks the opening hook, then scores and de-duplicates. MediaPipe face tracking keeps the active speaker framed, subtitles are burned in word by word, and FFmpeg renders 1080x1920. A separate QA step with its own append-only log judges every rendered clip frame by frame.
What got hard
- Face tracking could fall back to a static centre crop with no error, so renders looked fine and were wrong.
A dependency update had removed a protobuf function that MediaPipe still calls. I added a compatibility shim at the top of the tracker and wrote the failure mode into the project rules so it cannot degrade quietly again.
- Verification flags did not influence which clips got rendered, so a clip flagged for a filler start and a weak ending could land at rank one.
Verification status now decides the ranking and the score only breaks ties inside a band. If the verification call itself fails, the run says so loudly and marks every clip unverified instead of passing as a clean run.
- A QA check reported a defect that was not in the clip. The frame sampler picked a frame from inside each interval, not the true first frame, so an eyes-closed opening was a false finding.
I rebuilt the frame selection so frame one is always included, then cross-checked with three independent methods (ffmpeg first frame, OpenCV seek, a MediaPipe eye-openness measure). All three agreed the eyes were open.
- Asked whether a clip opening was good, the model approved almost everything.
I gave it a stranger test with specific bad examples (filler starts, dangling pronouns, fragments) and up to five sentences either side of the start so it can pick a better opening.
- Cutting cleanly in English, Hindi, Urdu and Hebrew without hardcoded grammar rules.
Boundary logic uses punctuation and pauses, which carry across languages, and an LLM pass validates each clip's start and end as complete thoughts. Hindi, Urdu and Hebrew have language-specific alignment models, with a generic multilingual aligner as the fallback.
The result
On a 46 minute test podcast, Deepgram returned 9,261 words in about two minutes and the pipeline rendered three 1080x1920 clips. A frame by frame review passed one as sendable and flagged two with specific, fixable issues, and a loudness pass brought the spread between clips from 4.4 dB to 0.4 dB.
The ← and → keys turn the page too.