Hamza has Claude Code write an HTML page with a render(t) function, screenshots it frame by frame with Playwright and encodes with ffmpeg, making 30-second motion graphics at no cost beyond his Claude subscription
In late September, X filled with Claude motion videos credited to "one prompt," and most copies came out with five fonts, a rainbow palette and every word flying in from a different direction. Hamza (@imhmxi) wrote up the process he actually uses: a brief and a timed scene list first, then a STYLE.md of restraint rules (one type pairing, one accent colour, one easing), then Claude Code writes a page that only draws the frame for a time t, Playwright screenshots it at 30 fps, and ffmpeg encodes the frames. After each render he makes a contact sheet of sampled frames for himself and Claude to review, then adds sound and captions. He says it costs nothing beyond an existing Claude subscription. Following the method, we wrote a 3-second 1080×1920 page (headline fade-in, accent rule, caption), captured 90 JPEG frames with Playwright in about 5 s, encoded a 3-second MP4 with ffmpeg and built a 3×3 contact sheet; each element appeared on schedule. We did not test sound, captions or his full prompt templates.
Visit site Claude Code + HTML render(t) + Playwright + ffmpeg ↗- Pricing
- Paid
- Region
- Global
- Where it's from
- Overseas
- Added
- Nov 12, 2026
- Tested on
- Nov 12, 2026
- Version we used
- Playwright 1.65.1 (Python) + system Chrome + ffmpeg (libx264); our own minimal scene.html
- Original author
- Hamza @imhmxi ↗
- Our test
- Partly tested
- Cost / time
- Playwright and ffmpeg are free; the code is written with a Claude plan you already have (Pro or Max). Voice can use open-source TTS; paid services such as ElevenLabs cost extra.
- Source
- X @imhmxi ↗
The task
Make 15–45 second text-driven motion graphics for an article, product or channel without buying editing software or templates, and without the busy look that reads as AI-made.
Steps
- Write the brief first: one sentence on what viewers should take away; a scene list with start time, duration, what's on screen and what moves; the words per scene at about 2.5 words per second; and the format (aspect, length, platform, muted or not). Ask Claude to argue with it and suggest a scene to cut before any code.
- Save the approved scene list as timeline.json; the page, sound and captions all read their timing from it.
- Write STYLE.md and reference it from CLAUDE.md: one type pairing (display + sans, mono only for small labels); background, ink, muted ink and one accent; one easing (he uses ease-out cubic); nothing moves without a reason; one hero moment; text holds long enough to read twice.
- Have Claude Code write an HTML page that exposes render(t): given seconds, it sets every element's position, opacity and scale for that instant. No CSS transitions, setTimeout or requestAnimationFrame; seeded randomness; local fonts and wait for document.fonts.ready.
- Write a Playwright script that calls render(t) for t = 0, 1/30, 2/30… and screenshots each frame (he uses JPEG quality 93), then encode the frames to MP4 with ffmpeg. For long pieces, split the frame range across two browser pages.
- After each render, make a contact sheet with ffmpeg (2–4 frames per second) and check for text collisions after wrapping, anything touching edges or under platform buttons, and colours or fonts outside STYLE.md; give the sheet to Claude and ask what breaks STYLE.md or the scene list.
- Finish with sound (voice first to set timing, then music and effects) and captions; X autoplays muted, so captions are required.
Prompt
Build scene s2 from timeline.json inside render(t). Use only prog() and ease(). Follow STYLE.md. Render frames 300 to 450 and show me a contact sheet.
What the author says
Hamza @imhmxi (X article, 11 Nov 2026): the "one prompt" videos sit on long briefs, skills and example files; his own article explainers and a 40-second video were made with this process. He lists four routes: A. Claude Code + plain HTML + Playwright + ffmpeg (his); B. HyperFrames (HeyGen, open source, Apache-2.0, needs Node 22+ and FFmpeg); C. Remotion (React; read the license, companies over 3 employees need a paid license); D. Claude Motion (inside Claude, Team and Enterprise only for now). He finds Claude good at spotting layout bugs on a contact sheet and weak at judging timing, so he still watches every piece in full twice, once with sound and once muted.
Our test
On 12 Nov 2026 on Linux we built a minimal Route A example by hand (not generated by Claude Code, and not from his templates, since the article's code blocks aren't readable from X): a 1080×1920 scene.html with background #0B0A12, ink #ECEAF4 and accent #8B6CFF, exposing window.render(t) with ease-out cubic only; headline fades and rises 0–0.8 s, accent rule grows 0.8–1.4 s, caption fades in 1.6–2.2 s. Playwright 1.65.1 (Python, system Chrome) called render(i/30) at 30 fps and saved JPEG frames at quality 93: 90 frames in about 5 s. ffmpeg (libx264, yuv420p, crf 18) produced out.mp4 (1080×1920, 3.0 s, 90 frames, about 78 KB), and fps=3 with tile=3x3 produced a contact sheet showing the three elements arriving in order without overlap.
What we found when we tried it:The "page draws only from t, capture externally frame by frame" approach produced a deterministic vertical video with very little code, and the contact sheet showed at a glance when each element appeared.
How to get in
Public X article: https://x.com/imhmxi/status/2120362086253412510 . HyperFrames: https://github.com/heygen-com/hyperframes .
Who it suits
People who use Claude Code and want clean text-driven motion pieces for articles or products; a little HTML and command-line comfort helps. Not suited to editing live footage or on-camera video.
Pitfalls
- Any CSS animation or timer in the page desynchronises frames from t, so renders stop being repeatable.
- Capturing frame 0 before fonts load gives you a fallback font.
- Real footage inside the page must finish seeking before each screenshot, which is fiddly; he composites footage in the edit instead.
- We only built a 3-second minimal example; we did not do sound, captions or a 40-second piece, or compare HyperFrames or Remotion.
More in this category
- A demo video per docs page that flags itself when the UI changesVideoScreenplayClaude CodeTool free; uses your agent's quota◐ Partly testedOverseas
- Code-drawn stick-figure explainers for about $0.54 eachVideoClaude CodeFFmpegChromeNeeds Claude plan or API; renders locally○ Not tested by usChina
- One topic in, a narrated tech explainer video out, locallyVideoClaude CodeChatterboxffmpegSkill free; needs a Claude Code plan◐ Partly testedOverseas
- One reference image → a take-apart machine simVideoteardownClaude Codethree.jsSkill free; needs Claude Code/Opus◐ Partly testedOverseas
- One topic in, a sourced explainer short outVideoClaude CodeXiaomi MiMoRenoiseBase tier free; needs Claude plan◐ Partly testedChina