When you need a short video, you usually pick between two options: feed a prompt to a video generator like Sora, Veo, or Kling, or hire a motion designer. Video models share one well-known flaw: the AI re-guesses pixels on every frame, so a character's face drifts halfway through the scene and small text falls apart.
You can skip that lottery by using code. Claude doesn't have a video model, but video is just a stack of images flipped quickly. If you define a scene in code, step through it frame by frame in a browser, and stitch it into an MP4, the guesswork disappears.
Why Code Holds Geometry Better Than a Video Model
This workflow runs on Claude Code, Anthropic's agent in the terminal or the Code tab of Claude Desktop (Pro and Max plans). It creates files and runs commands on its own. For 3D, the agent uses Three.js, a free open-source JS library that draws 3D scenes, lighting, and cameras right in the browser. For flat graphics or comics, plain HTML Canvas or SVG works instead.
The big difference is deterministic rendering. The scene is calculated from exact formulas, so every frame reproduces 100% identically. Your character is built from the same shapes and colors, meaning its proportions and logo physically cannot "melt" mid-clip—or even by episode fifty.
To turn a web page into a video file, a script opens it in a headless browser (a windowless browser like Playwright or Puppeteer), advances time by 1/60 of a second, and saves PNG snapshots. Then the free command-line tool FFmpeg stitches those frames into smooth 60 frames-per-second (60 fps) video.
Character Spec, Frame Loop, and the FFmpeg Command
You need Node.js, FFmpeg (brew install ffmpeg or apt install ffmpeg), and Claude Code. To keep your mascot consistent from episode to episode, drop a spec file named character.md in the project folder (shapes, 1:1.15 proportions, exact hex colors #E8A849 / #F7D388 / #1E1E1E, soft studio lighting, and personality) and tell the agent to read it before building any new scene.
The second key piece is the time step. Standard requestAnimationFrame is tied to your monitor's refresh rate, so heavy scenes drop frames. A headless script runs a strict loop at 1 / 60 of a second and captures each snapshot one by one.
// 5 seconds of animation (300 frames at 60 fps) with a fixed time step
for (let i = 0; i < 300; i++) {
animationMixer.setTime(i / 60);
renderer.render(scene, camera);
// Zero-padded numbering: frame_00001.png .. frame_00300.png
const num = String(i + 1).padStart(5, '0');
const dataUrl = renderer.domElement.toDataURL('image/png');
// The headless script saves dataUrl as frame_${num}.png
}
This loop decouples smoothness from GPU speed: even if a heavy frame takes half a second to draw, it still lands at its exact fraction of a second in the final clip. Once the PNG folder is ready, one command stitches it together.
# Stitch numbered PNGs into a compatible 60 fps MP4
ffmpeg -framerate 60 -i frame_%05d.png \
-c:v libx264 -pix_fmt yuv420p output.mp4
The -framerate 60 flag must go strictly before -i, otherwise FFmpeg assumes the input is 25 fps. The libx264 codec outputs universal H.264 video, and -pix_fmt yuv420p is mandatory: without it, the video encodes in rgb24 or yuv444p and won't play in QuickTime, social apps, or Windows Media Player.
Time-Saving Habits and Honest Limits
You don't have to render a web scene blind: open the HTML file in a normal browser to check timing and lighting right away. This format works best for recurring mascots (a pastry waking up in a steamy oven, rolling on a pin, or sneezing from sprinkles), 3D product breakdowns (a bottle flying out of the dark and splitting into labeled parts), stickman explainers, and vertical A/B ad tests. Cartoon characters are great for "how our product works" clips, though you should never pass them off as real customer testimonials.
- Direct like a filmmaker. Specify the character, location, one main focal point, duration, and aspect ratio up front.
- Check still frames before rendering. Ask Claude Code to save 3–5 key frames first so the agent catches flaws and fixes the scene before a long 60 fps render.
- Export two formats at once. From one scene, it's easy to render both
9:16for Reels/Shorts and16:9for YouTube.
The boundaries of this approach are strict. You can't build photorealistic humans, organic live textures, or cinema-style footage in Three.js; that still belongs to video models or a real camera. The Three.js -> PNG -> FFmpeg pipeline also produces silent video, so voiceover and music must be added in a separate FFmpeg pass or a video editor. Plus, frame-by-frame capture at 1080p and 60 fps puts real load on your CPU and GPU, which makes browser previews and a few test stills well worth the habit.


