Skip to content

Menu

Making narrated videos with p5.js, Python and Claude Code

I wanted to create short narrated explainer videos with AI. So I built on-cue, a small video studio, together with Claude Code. The scenes are code, a synthetic voice reads the script, the diagrams are drawn programmatically.

This first video explains how it works, in 35 seconds.

The pipeline has three parts:

  1. p5.js draws one frame.
  2. Python steps a headless Chromium through the frames with Playwright and grabs the canvas each time.
  3. ffmpeg turns the PNGs and the narration into an MP4.

Time comes from the frame number: frame n shows the moment n / 30 seconds, however long the browser takes to draw it. So a slow render can’t make the video stutter, and the same inputs always give the same frames.

The narration comes first as explained in the second video:

Claude (Opus 5.5) wrote the engine, the styles, the scripts and the scenes. I set the briefs and reviewed the results.

The code is available on GitHub.

Read next

An AI-drawn comic page showing Sherlock Holmes and Watson meeting Helen Stoner
Sep 06, 2026 ai

Working with AI, Beyond the First Draft

In May I wrote about building small websites with AI. Since then I’ve built more sites, simulations, tools, and a set of comics. Every project raised the same question: how...

#gen-ai #ai #software-engineering #image-gen
Read more
Polyptych — turning one essay into many kinds of visuals
Jun 14, 2026 ai

Polyptych: One Essay, Many Pictures

I built my own slide and infographic generator because I couldn’t stop poking at Google’s NotebookLM. It’s called Polyptych, and it turns a single essay into the visuals you’d want...

#gen-ai #ai #infographics #image-gen #software-engineering
Read more