Article · · 6 min read

AI video without made-up facts: retrieval first, quality gate before spending

An eight-stage pipeline from a library of books to a published video: scripts written only from retrieved passages, a quality score before any paid generation, and provider fallback so one outage does not stop the run.

Running a content channel by hand means research, an accurate script, voiceover, visuals, music, editing and upload for every video. Letting a language model write the script from memory is fast and quietly wrong. This pipeline was built to keep the speed and drop the made-up facts.

Retrieval before writing

Ebooks and PDFs are extracted, cleaned and cut into passages, embedded with sentence-transformers and stored in ChromaDB. Before the model writes anything, the passages relevant to the topic are retrieved, and the script is written scene by scene only from them. No passage, no line.

A quality gate before money is spent

Voiceover, image generation and rendering cost money; the script costs almost nothing. So every script gets a quality score, and a weak one is rejected before any paid step runs. This single check saves more than any optimisation further down the pipeline.

Voice, pictures, music

Narration comes from several TTS providers with fallback, and faster-whisper gives word-level timings for subtitles. Each scene gets an image, checked against the spoken line with a CLIP-style model so the picture actually matches what is being said. Music is mixed under the voice.

Render, publish, never twice

MoviePy and FFmpeg render the video with encoder settings tuned for throughput. Title, description and tags are generated, and every video is tracked per channel in the database, so a scheduled run knows what already exists and never double-posts.

  • 8 stages from source library to upload, no manual step
  • 1 quality gate before paid generation
  • 3 TTS providers with fallback
  • scripts written only from retrieved sources

The lesson

Put the cheap check in front of the expensive work, ground the model in your own sources, and assume any one provider will fail on the day you need it.

The project behind this article: AI Video Studio →

Have a similar problem?

Tell me what you are building and what data you have. I reply with how I would approach it.

Discuss a project →