Skip to content

Zero Image Models, Twenty Episodes: The Case for Code-Drawn Video

#generative-video #procedural-animation #hyperframes #text-to-speech #creative-ai #hugging-face-spaces

Twenty episodes. Four and a quarter hours of video. About 180 named characters, fifteen battle formations, a Hindi narrator, and English subtitles. Built on one Windows laptop.

There is no Premiere project. There is no After Effects file. And there is no image model anywhere in the pipeline. Every face, horse, chariot, tent and planet is SVG written by a Python script, animated with GSAP, and captured frame by frame out of a headless browser by HyperFrames.

The project is Mahabharata: The Eighteen Days, and the full engine plus one complete episode is on GitHub. I went in expecting a story about prompt craft. I came out with a story about determinism, because that's the thing that decided whether twenty episodes with a recurring cast were possible at all.

A series where every pixel is a function call ​

The core idea fits in one sentence: a video is just a web page that changes over time.

If a frame is HTML, then a character is a function, a chariot duel is a function, and an episode is a list of function calls. A character definition is a Python dict:

python
dict(id="bhagadatta", en="Bhagadatta",
     role="old king of Pragjyotisha, rider of Supratika",
     skin="#C29A78", hair="#EDEAE3", hair_back="long", beard="long",
     crown="royal", armour="#2C4F8C", cloth="#8E2A1E",
     weapon="spear", age="old")

One dict produces three views: a close-up bust, a front-facing full figure, and a side view for chariots. A minor king who appears for eleven seconds before Arjuna ends his career is one line of a variant call. The eight sons of Dhritarashtra who die on day four took a few minutes total.

That's the argument for code over prompts in a single contrast. A generated image of Bhishma looks different every time you ask. A function called bhishma does not. When your cast has to stay recognizable across 2,500 shots, "looks different every time" isn't a quirk. It's a blocker.

The pipeline, end to end ​

An episode goes from a text file to an MP4 in seven steps, and four of them are one command each.

The spine of everything is segments.json, which records the start time, end time and text of every narrated line. Shots and subtitles are placed from those numbers, so the pictures cannot drift from the voice. Nothing was synced by hand.

Each episode has 70 to 80 narration lines and 110 to 150 shots. Multiply that out and the series lands somewhere around 2,500 shots. The review step is one frame per shot, which means 2,500 PNGs to eyeball before you commit to a render. That sounds miserable until you compare it to the alternative: finding a continuity error at episode twelve after rendering four hours of footage twice.

Two ways to put motion on screen ​

The interesting split in generative media right now isn't open versus closed, or fast versus slow. It's who owns continuity.

DimensionGenerated pixels (Wan2.2 I2V, LTX-2.5, MiniMax H3)Code-drawn frames (SVG + GSAP + HyperFrames)
Same character in shot 400 as in shot 4prompt drift; needs reference conditioningidentical by construction
Fixing one bad shotre-prompt, re-roll, hopechange one line, rebuild that section
Re-running the rendernew seed, new filmbyte-identical frames
Cost drivermetered per second of generated videoyour laptop's time plus TTS characters
Realism ceilingphotorealmotion graphics
Skill you needprompt craft and model selectionrigs, easing curves, layout
Failure modeforty clips that don't cut togethera rig that never quite looks natural

Neither column is wrong. But the failure modes are not symmetric, and that matters more than any benchmark.

Quick take: for episodic work with a recurring cast, consistency is a software problem before it's a generation problem, and a coding agent with a deterministic renderer beats a better image model every time.

The stack, and what each piece is for ​

Four AI models are involved in the series. None of them draws a picture.

PieceVersionJob
Claude Code (Opus 5.5, Fable 5.2)Max planwrote and ran nearly all the code; the engineer
HyperFrames0.9.88 to 0.9.96turns an HTML page with a paused timeline into MP4
GSAP3.15.0one paused timeline per scene, every movement an entry on it
p5.brush3.0.0, patchedink and watercolour for maps, formations, verse cards
Sarvam Bulbulbulbul:v4-flashHindi narration, single voice, 48 kHz
Lyria 3 (Gemini app)five instrumental tracks, reused across the series
ffmpeg9.0joins sections, mixes audio, builds contact sheets
Python / Node3.13 / 24draws characters and props, runs the render CLI

Two small libraries were written for the project rather than downloaded. rig.js is about 100 lines and handles poses, walking, breathing, blinking, speaking and expressions. brush-kit.js is about 350 lines wrapping p5.brush with the fifteen battle formations and helpers like moveArrow and inkWipe. Neither exists on npm. Both live in the repo.

By the numbers. Narration for all 20 episodes: 169,000 characters, ₹338.01, about $3.71 at ₹91 to the dollar. Cast: 180 characters, each a Python dict. Shots: 110 to 150 per episode. Music: 5 tracks carrying 4.25 hours. Image models used: zero. Frames captured at 24 fps over 15,300 seconds: 367,200.

Why frame-exactness beats fidelity ​

HyperFrames works by opening your page in a headless browser, seeking the animation timeline to frame 0, taking a picture, seeking to frame 1, taking a picture, and so on until it has the lot.

The contract is unforgiving. Your page must look exactly the same every time it is asked for time t. No wall clock. No Math.random(). No "it'll settle in a moment."

p5.brush, out of the box, is not deterministic, which the renderer cannot tolerate. The copy in this project carries two small patches: Math.random is replaced by a fixed sequence, and the seed is reset on every frame. Same frame in, same pixels out, every run.

I tested this the way anyone would, by rendering the same twenty-second scene twice and diffing the frames. Identical. Then I removed the seed reset and did it again. The ink strokes drifted within three seconds. If you're building anything with a procedural brush layer and you skip that patch, your review screenshots are lying to you, because they show a film you will never render again.

This is also why the "change one line and rebuild" workflow is real rather than aspirational. Fixing a wrong shot costs one edit and one section render. There's no re-roll, no seed hunting, no accepting a second-best take because the good one won't reproduce.

Where the generative models actually belong ​

So what are all those Spaces for? hugging-apps/bfs-best-face-swap has 1,150 likes, JCisHERE/wan2-2-i2v-v3 has 959, MiniMaxAI/minimax-h3-image has 410. Here's the shape of demand in the cluster.

The most-liked thing in the cluster puts a face into a video. That's a tell. People don't want a new world, they want their world with one variable swapped. Wan2.2 image-to-video at 959 likes is the workhorse: one still in, a few seconds of motion out, usable as a cutaway or a transition. MiniMax H3 at 410, plus two separate re-uploads of the same base Space, says demand is outrunning whatever the official default endpoint can serve. Kandinsky-ImageSR-2.0 at 109 likes is the unglamorous one that saves projects: it upscales frames you already have instead of generating new ones.

Lightricks/LTX-2.5 and nvidia/Nemotron-Labs-Image-30B-A3B sit in the same cluster with far less visible community footprint on their model cards. That's normal for base releases, and it's also a warning: the model card tells you what it is, not whether it holds up on your footage.

Here's how I'd actually decide, shot by shot.

What the Spaces felt like in practice ​

The first thing I hit wasn't output quality. It was the spinner. Half these Spaces open on a "fetching metadata" state and sit there while a container spins up, and on a free GPU tier you're sharing that wait with everyone else in the queue.

The duplication pattern is the most useful signal in the whole cluster. MINIMAX-H3-Ref2VA-Revamped is explicitly duplicated from another user's Space, and Krea2T-Revamped is duplicated from a turbo variant. People fork when the original is congested, gated, or ships defaults they don't want. If you're picking a Space to build on, a fork with more likes than the original is a red flag about the original's reliability, not a vote of confidence in the fork.

My team ran into the reproducibility wall on the first afternoon. We generated a five-second image-to-video clip that cut perfectly into a sequence, went to lunch, came back, and could not get it again. Different seed, different motion path, different clip. That's fine when you're exploring. It's fatal when you're assembling something with a fixed runtime.

The other thing nobody warns you about is face drift across a sequence. Individually, each generated clip looks right. Cut three of them together with the same reference image and the jawline moves. There's a reason code-drawn rigs exist.

What trips people up ​

  1. Seeding once per render instead of per frame. If you reset the RNG at the start of a capture run but not at every seek, a mid-render restart hands you different ink for the second half. Reset on every frame, not every job.

  2. Leaving a wall clock anywhere in the scene. Date.now(), performance.now(), requestAnimationFrame as a driver: all of them break the contract. A snapshot at 12.5 seconds and a full render at 12.5 seconds must produce the same PNG, or your contact sheet is fiction.

  3. Redrawing heavy backdrops every frame. Four hundred tiny soldiers re-laid-out 24 times a second will dominate your render time. The two camps, the throne room, the dice hall: draw once, bake to a flat PNG, composite over it.

  4. Asking a prompt to hold a character across thousands of shots. Prompt drift is invisible per clip and glaring in a playlist. If a face needs to recur, rig it or reference-condition it. There's no third option that scales.

  5. Syncing subtitles and shots by hand. Derive both from the narration timing file. Manual sync drifts slowly enough that you'll only catch it around episode twelve, at which point you're re-cutting four hours.

The one thing that actually matters ​

The bet this project makes is that a video is a program, and programs can be tested. The shot list is a spec, the one-frame-per-shot contact sheet is CI, and the deterministic renderer is the thing that makes either of them worth building. That's the part worth stealing regardless of what you think of the art. If your output can't be reproduced from its inputs, you don't have a pipeline. You have a slot machine that occasionally pays out.

What this means ​

If you're building anything episodic with a recurring cast, whether that's a series, a course, or a channel, rig the characters in code before you touch a video model. A prompt gets you one good shot. A function gets you the same character in shot 2,500.

If you need a photoreal five-second insert of a real place or a real person, skip the rig entirely and use Wan2.2 I2V or LTX-2.5. Just budget for re-rolls, and save the exact reference image and seed for every clip you keep, because you will not find it again by hand.

If narration cost is what's stopping you from shipping, it stopped being a real constraint. Four and a quarter hours of Hindi TTS came to ₹338, about $3.71, which is less than the coffee you'll drink while reviewing contact sheets. Spend the budget on render time and human review instead.

Sources ​