# I built a pipeline that turns a topic into a 20-30 minute documentary

> Source: <https://dev.to/summitsingh/i-built-a-pipeline-that-turns-a-topic-into-a-20-30-minute-documentary-bfp>
> Published: 2026-09-20 19:59:40+00:00

I've been working on AI Video Factory, an MIT-licensed Python pipeline that turns a topic into a complete 20-30 minute documentary: researched script, per-scene visuals, local TTS narration, music bed, karaoke captions, FFmpeg assembly, QC, thumbnail, and YouTube metadata.

You give it a topic. It researches the topic, writes a script with citations, pulls per-scene visuals from Pexels/Pixabay/NASA, narrates it with local TTS, lays down a music bed, burns in karaoke captions, assembles everything in FFmpeg, runs a QC gate, and outputs a thumbnail plus YouTube metadata. Seven presets: business autopsy, history reconstruction, science doc, horror anthology, and more.

**1. LLM-written scripts invent citations that look completely legit.** The first scripts came back with references that sounded real but pointed nowhere. Now every cited URL gets a real HTTP check against a 200 response. Anything that fails the check gets cut or rewritten.

**2. A "25 minute" video kept coming out at 14 minutes.** Runtime drift is a real problem with generated scripts. Scripts are now written in timed beats, and underweight beats get extended at roughly 150 wpm until the target runtime holds.

**3. Real stock footage beats AI visuals for most scenes.** This one honestly surprised me. AI-generated visuals look impressive frame by frame but feel off across a 20-minute runtime. The pipeline prefers real footage, with local still generation and procedural fallbacks when nothing fits.

Scripting runs against any OpenAI-compatible endpoint (LM Studio, llama-server), TTS is local, and nothing cloud is required. Roadmap includes Whisper-based caption alignment, more music profiles, optional Veo/Sora providers, and multilingual narration.

The repo is here: [https://github.com/summitsingh/ai-video-factory](https://github.com/summitsingh/ai-video-factory)

I genuinely don't know if anyone besides me wants this. Tell me what you'd throw at it first.
