Long-form video generation pipeline by Allan BenameurLong-form video generation pipeline by Allan Benameur

Long-form video generation pipeline

Allan Benameur

Allan Benameur

Overview I built a local Python pipeline that turns a text script into a narrated long-form video without manual editing between input and final MP4. The repository contains 4,441 lines of Python and has produced three complete videos around 20 minutes long, with 345 to 380 scenes each. Pipeline design The workflow has eight resumable steps: TTS, forced alignment, scene segmentation, prompt generation, character references, location references, image generation and rendering. Each step writes one artifact and skips work that already exists. A failed run can resume from the last completed stage, and a single stage can be invalidated without rebuilding everything. Timing and segmentation The script stays the source of truth while Whisper supplies word timings. Scene boundaries are scored from pauses, punctuation and language-specific connective words. Two invariants ensure that aligned words and scene text reproduce the normalized script exactly. A separate plausibility check catches valid text paired with broken timing. All 15 tests currently pass. Fast iteration A sample mode renders three 30-second windows from the beginning, middle and end. This reduces a full run from roughly 350 images to about 20 or 30, so pacing and visual consistency can be reviewed before spending hours on generation. Local generation and rendering TTS can run through Piper or Chatterbox. ComfyUI generates images from FLUX.2 through HTTP while keeping PyTorch outside the pipeline environment. FFmpeg renders one animated scene per image with a Ken Burns effect, processes segments in parallel and concatenates them with the narration. Measured output The completed videos run from 19.6 to 21.4 minutes and use 345 to 380 images each. On the local GPU, image generation measured about 64 seconds per frame. A FastAPI control panel exposes project status, service health, sample reviews and partial reruns.
Like this project

Posted Sep 14, 2026

Local Python pipeline that turns scripts into narrated 20-minute videos with TTS, Whisper alignment, AI images and parallel FFmpeg rendering.