{"slug": "rendering-video-from-code-with-claude-opus-5-5-a-480-frame-verification", "title": "Rendering Video From Code With Claude Opus 5.5: A 480-Frame Verification Checklist", "summary": "A developer built a code-driven video pipeline on claude-opus-5-5 in which the model writes a single HTML file exposing a seek(t) function, Playwright screenshots each timestamp at 24fps, and FFmpeg stitches 480 PNGs into a 20-second DNS-lookup explainer MP4 in about eight and a half minutes across two API calls. The first call returned finish_reason: length after 164 seconds, truncated at 16,000 tokens inside an unclosed script tag; raising max_tokens to 32,000 with the same prompt produced 251 lines and a clean stop in 211.4 seconds. All six automated checks passed, yet one frame was still broken — the gap the developer argues verification must account for.", "body_md": "There is a way to make video with an LLM that never generates a single frame of footage. The model writes one HTML file. A browser draws the frame at whatever timestamp you hand it. Playwright screenshots each one. FFmpeg stitches them together. The pixels are computed, not sampled.\n\nI ran this end to end on `claude-opus-5-5` with a 20-second explainer of a DNS lookup: two API calls, 480 frames, roughly eight and a half minutes to a playable MP4. All six automated checks passed. One frame was still broken.\n\nThat gap is the interesting part. What follows is verification: what the contract looks like, what to measure, what the measurements cannot tell you.\n\nWith a video generator, the output arrives as one indivisible artifact. A caption with a typo means re-rolling, and the camera move comes back different. There's no way to request that a phrase hold for exactly two seconds, or that an arrow shift 30px left at second three.\n\nFor mood and abstract transitions, those models are excellent. For something with structure — steps, labels, fixed ordering — you need an edit that touches exactly one thing.\n\nCode changes the premise. The frame becomes a function of time. Element positions sit in `f(t)`, playback is `t` from 0 to 20, and editing becomes recomputation instead of redo. Everything below is a consequence of that one property.\n\nThe whole pipeline rests on a single interface. The page must expose something like `seek(t)`: given any moment, draw the frame for that moment.\n\nThis is where models fail by default. Left unconstrained, they hand back a page animated with CSS transitions. It looks right in a browser and it is useless for rendering, because the page never sits at a determinate time. Screenshots then either repeat or drift.\n\nEverything else is plumbing:\n\n**Playwright walks the timeline.** At 24fps, push every 41.7ms, capture a PNG each time.\n\n**FFmpeg encodes the sequence.** 480 PNGs in, one MP4 out.\n\nIf React is more your register than raw canvas, Remotion's renderer runs the same loop — [the Remotion repository](https://github.com/remotion-dev/remotion) is the reference implementation.\n\n*Frame 12. Bottom right: the live time parameter. The four hops of a DNS query sit on one continuous timeline rather than four edited shots.*\n\nThe same skeleton handles a different subject. This is a frame from a 46-second explainer of the twin paradox, drawn in canvas with no image assets at all.\n\n*Paper grain, torn edges and the slight jitter are computed. No footage sits behind this frame.*\n\nThese came out of two calls. Drop any one and you rerun.\n\n`seek(t)`, ban browser-driven motion.` requestAnimationFrame`, no `Date.now`, no `Math.random`. Each frame must be uniquely determined by the value passed in.\nAll six enforce one idea: time belongs to the code, not the browser. The counterintuitive part is that the model doesn't need richer description here — it needs tighter boundaries. The closer your prompt reads to an acceptance test, the likelier one pass is enough.\n\nThe first call returned after 164 seconds with `finish_reason: length`. 16,000 tokens spent, 3,636 characters out, 70 lines, cut inside a function called `seg()`. The `<script>` tag was never closed, so the file wouldn't open.\n\nHere's what I got wrong. Of those 16,000 tokens, only about 3,600 characters reached the code. The rest went to reasoning. This kind of task can't be budgeted by output length; it has to be budgeted by thinking plus writing.\n\nRaising `max_tokens` to 32,000 was the only change for the second call. Same prompt, same constraints. It came back in 211.4 seconds with `finish_reason: stop`, 251 lines, 11,022 characters, 22,218 tokens. The first attempt didn't fail on capability. It failed on my budget.\n\nTwo calls totaled roughly 38,000 tokens. On commercial API pricing that's noise; the expensive input is your attention.\n\nEvery number below is from this run, not an estimate.\n\n`typeof window.seek` returned `function`, not `undefined`.` img`, `link` and `script[src]` all returned empty arrays. The page renders with the network off.\nTiming, for calibration: rendering took 118.5 seconds, an average of 0.247 seconds per frame. Encoding took 14.4 seconds and produced 1.0 MB. Page load was 0.69 seconds.\n\nSix green checks, and the file passed every automated standard I could think of. Then I watched all 480 frames.\n\nAt second 8, two labels were printed on top of each other.\n\n*Left: second 8. Right: second 12. \"Asking the root server\" and \"asking the authoritative server\" were cross-faded in the same spot without clearing the first string.*\n\nThe cause is mundane: the text swap used an opacity fade and never cleared the previous string from that region. The reason it matters is what it implies about the toolchain. No frame count, no error log, no pixel-hash comparison catches this. Each frame was correctly rendering a wrong picture.\n\nThat's the boundary worth internalizing. Automation proves a pipeline is consistent. It cannot prove the output reads well. The technical bar for this workflow is low, and the taste bar hasn't moved at all.\n\nAll three are silent — no exception, no red log, just a wrong result.\n\n**The page is animated by CSS.** Symptom: 480 identical frames, or 480 different ones. Cause: the page doesn't hold a determinate time and the browser advances the animation on the wall clock. Fix: strip CSS animation entirely and draw from `t` only; grep the file before capture.\n\n**Fonts load from a CDN.** Symptom: a blank first frame, or the typeface shifting between frames. Cause: capture starts before the font resolves. Fix: await `document.fonts.ready`, and pin system fonts in the prompt.\n\n**Frame count doesn't match duration.** Symptom: a dark tail, or one flickering frame. Cause: 20s at 24fps is exactly 480. Fix: compute `duration × fps` and diff it against the file count in `frames/` before encoding.\n\nUse it when you can decompose the subject into quantities on a timeline: a process, a mechanism, a product surface, a data story. You also need to read a stack trace, change one line, re-run, and accept that the first cut looks amateur.\n\nDon't use it for live action, realistic footage, or anything carried by atmosphere. It's strong on structure and indifferent to texture.\n\nOne test settles it: strip the narration and see whether the visuals still make sense. If yes, structure is carrying the piece and this workflow serves it. If no, mood is carrying it, and a generator is the better tool.\n\nAccess is a one-line change. Point the client at a compatible endpoint instead of the vendor's:\n\n```\nhttps://api.crazyrouter.com/v1\n```\n\nThe model ID is `claude-opus-5-5`. CLI tools read it from an environment variable, SDKs take it as `base_url` at client construction. Either way it's one place. If you want the same endpoint to switch between Claude, GPT and DeepSeek without per-vendor billing and reconciliation, [the pricing page](https://crazyrouter.com/en/pricing?utm_source=devto&utm_medium=article&utm_campaign=offsite_article&utm_content=cr_890995936de0_mid_text) carries the model catalog and current per-token tiers, and [docs.crazyrouter.com/llms.txt](https://docs.crazyrouter.com/llms.txt) has the endpoint plus the model IDs.\n\nMaking video used to be a craft gate: learn to cut, learn motion, learn sound, or don't ship. The gate moved. It now sits at whether you can turn an idea into quantities along a timeline, which is what people who write code do all day. The taste gate didn't move. The renderer will draw exactly what you specify — including the frame where two words print on top of each other.\n\nThe first four are starting points you can copy. The last two are infrastructure, and most of the style libraries above run on top of them.", "url": "https://wpnews.pro/news/rendering-video-from-code-with-claude-opus-5-5-a-480-frame-verification", "canonical_source": "https://dev.to/buluo/rendering-video-from-code-with-claude-opus-55-a-480-frame-verification-checklist-46nl", "published_at": "2026-11-25 09:03:27+00:00", "updated_at": "2026-11-25 09:13:42.441650+00:00", "lang": "en", "topics": ["large-language-models", "generative-ai", "ai-tools", "ai-agents"], "entities": ["Anthropic", "Claude Opus 5.5", "Playwright", "FFmpeg", "Remotion"], "also_reported_by": [], "takeaway": "Budget LLM code-generation calls by reasoning plus output tokens, not output length: the same prompt truncated at 16,000 tokens but produced a complete 251-line file at 32,000.", "recommendation": {"advice": "Constrain generated animation pages to a deterministic seek(t) function with no requestAnimationFrame, Date.now or Math.random, then screenshot every frame and verify each one — passing automated checks can still leave a broken frame.", "playbook": "output-verification", "playbook_url": "https://wpnews.pro/playbooks/output-verification"}, "alternates": {"html": "https://wpnews.pro/news/rendering-video-from-code-with-claude-opus-5-5-a-480-frame-verification", "markdown": "https://wpnews.pro/news/rendering-video-from-code-with-claude-opus-5-5-a-480-frame-verification.md", "text": "https://wpnews.pro/news/rendering-video-from-code-with-claude-opus-5-5-a-480-frame-verification.txt", "jsonld": "https://wpnews.pro/news/rendering-video-from-code-with-claude-opus-5-5-a-480-frame-verification.jsonld"}}