You have a web page with an animation in it, and someone wants an MP4. You press a screen recorder, the animation stutters on the slow frames, and the file is only as smooth as your laptop was that minute. This post is about getting from HTML to video without that problem.
HTML to video: the short answer
To turn HTML into a video, open the page in a browser and either record it while it plays or render it frame by frame. Rendering means you pause the animation, move it to each frame's exact time, take a screenshot, and encode the screenshots into an MP4 with FFmpeg. Recording is quicker to set up. Rendering frame by frame gives a smooth file on any machine, because how fast the computer draws no longer matters.
You can script the frame-by-frame route yourself with Playwright and FFmpeg, or use a framework that does it for you. HyperFrames renders plain HTML under Apache 2.0, and Remotion renders React components under its own license. For an animation drawn on a <canvas>, captureStream() and MediaRecorder record it inside the browser.
Pick a method
| Method | You start from | Timing | Fits when |
|---|---|---|---|
| Screen recorder | Any page open in a browser | Real time | You need one clip now and the animation is light |
| Playwright or Puppeteer recording | A URL and a script of clicks | Real time | You want a recorded walk through a site |
| Your own frame-by-frame script | HTML with CSS or JavaScript animation | Set for each frame | You want full control and no framework |
| HyperFrames | HTML and CSS with a seekable animation, such as GSAP or CSS | Set for each frame | You design videos as web pages, or an agent writes them |
| Remotion | React components | Set for each frame | Your team already works in React |
captureStream() and MediaRecorder | A <canvas> element | Real time | Users export a video from your web app |
Why frame-by-frame rendering matters
A recording captures the page while real time runs. Whatever the browser has drawn when a frame is sampled is what ends up in the file, so a moment that is slow to draw shows up as a stutter.
Rendering frame by frame takes real time out of it. The renderer stops the page's clock, moves the animation to exactly 0, 1/30 and 2/30 of a second and so on, and takes a screenshot of each moment. A slow frame only takes longer to capture; it does not change the video.
There are two clocks to control. CSS animations, CSS transitions and the Web Animations API can be paused and set to any time through document.getAnimations(). JavaScript that reads Date, timers or requestAnimationFrame needs those replaced with fakes that move only when the renderer says so.
Do it yourself, or use a framework
The do-it-yourself script needs Node.js, Playwright and FFmpeg. It installs a fake clock, waits for document.fonts.ready so no frame uses a fallback font, then loops over the frames: pause every animation at that frame's time, take a screenshot, advance the clock. FFmpeg then joins the numbered PNGs into an MP4. Two details are easy to miss. Tell FFmpeg the frame rate you rendered at, because its image reader assumes 25 without it. And set the pixel format to yuv420p, because FFmpeg picked 4:4:4 in our test when the flag was left out.
The caveat from our own test: a CSS animation came out byte for byte the same in every run, but a requestAnimationFrame animation on a canvas sat up to about 10 milliseconds off the target time, and not by the same amount each run. For exact JavaScript animation, use a library timeline you can seek.
That is what HyperFrames does. You write the video as an HTML page the size of the frame, mark when each element is on screen, and register a paused timeline. The renderer seeks each frame in headless Chrome and encodes with FFmpeg, so you never write the capture loop:
<div id="root" data-composition-id="main" data-start="0" data-duration="5" data-width="1920" data-height="1080"> <h1 id="title" class="clip" data-start="0" data-duration="5" data-track-index="0">Ship it today.</h1> </div> <script> const tl = gsap.timeline({ paused: true }) tl.from('#title', { y: 60, duration: 0.6, ease: 'power3.out' }, 0) window.__timelines['main'] = tl </script> It needs Node.js 22 or newer and FFmpeg. Animation can come from GSAP, CSS, Lottie, Three.js, Anime.js, the Web Animations API or your own frame adapter, as long as it can be seeked. In version 0.8.192, render writes MP4 by default, and also WebM, MOV, GIF, HLS or a PNG sequence.
Remotion takes the same frame-by-frame approach from React: a component reads the current frame number and draws that moment. Check its license before using it at work.
When recording is enough
If the animation is light and you need a clip now, record it. On a Mac, Shift-Command-5 records the screen to a .mov. Playwright takes recordVideo when you create a browser context; in our test it wrote a WebM, and the recording began when the page opened, so it ran about a second longer than the wait. For a canvas, canvas.captureStream(30) plus MediaRecorder records inside the page, which suits an export button. Only the canvas is recorded, not the HTML around it, and it runs in real time.
A worked example: Kinetic Title Drop
Frame-by-frame rendering of HTML is a good fit for an agent, because the video is just a file the agent can edit. Kinetic Title Drop is an agent skill built on exactly this route. It makes a six-second, 1920x1080 type-only film in three beats: a huge first word opens the frame with a hairline slash and settles top left, a second word drops in as an outline and fills with the accent colour, and a payoff line whips in from the right with an accent bar under it. A chip and a footer fade in, everything holds, then exits.
It is one of our 38 free MIT skills. Install it with any of these:
npx skills add lookbkdev/lookbk-skills --skill kinetic-title-drop /plugin marketplace add lookbkdev/lookbk-skills /plugin install kinetic-title-drop@lookbk-skills The repository is at https://github.com/lookbkdev/lookbk-skills.
The template is a HyperFrames composition. You fill in a brief, a script writes it into the template, and HyperFrames checks and renders the MP4 locally. You need Node.js 22 or newer and FFmpeg on the PATH. The first render downloads a headless Chrome.
Write the brief
Three short lines plus a chip, a footer and three colours. Every field has a length limit, and the script rejects values over it. Copy the template into a project:
cp -r <skill>/template ./title-drop cd title-drop Then write brief.json:
{ "line1": "Ship", "line2": "it", "line3": "today.", "chip": "v2.0 · Out now", "metaLeft": "Release notes · 14 fixes · 3 new features", "metaRight": "relay.example/changelog", "ground": "#0f1013", "ink": "#f5f4ef", "accent": "#ff5b2e" } Lines 1 and 2 share the top row, so they should read as the start of one phrase, and line 3 finishes it. Everything is set in capitals. The colours above are the Ember preset; the skill also ships Fieldnote, Cobalt, Paper and Lime. ink needs strong contrast with ground, and accent needs at least 3:1 against ground, because line 2 is drawn in it.
Write the brief into the template:
node <skill>/scripts/apply-brief.mjs . brief.json It checks type, length and colour format, and lists every problem at once if anything is off.
Check, look, render
npx --yes hyperframes@0.8.192 check --json check lints the file, plays it in a browser, measures the layout over time and tests contrast. "ok": true with no findings means it is ready. If it reports text_box_overflow, clipped_text or content_overlap, a value is too long, usually a footer or chip running into its neighbour. Shorten the brief rather than changing the template.
Before rendering, look at a few frames:
npx --yes hyperframes@0.8.192 snapshot --at 0.3,1.6,3.6,5.2 -o snapshots Open the PNGs in snapshots/ and check the opening frame, the second word landing, and the held end frame. Then render:
npx --yes hyperframes@0.8.192 render --quality delivery -o renders/title-drop.mp4 Use --quality draft for a fast test. To make one version per language or product, write a JSON array of briefs and pass it with --batch variants.json, with a placeholder such as {index} in the output path so the files do not overwrite each other.
Common problems
- The render hangs, then shows a static frame, or reports
sub_timeline_script_failure: GSAP did not load. The template fetches it fromcdn.jsdelivr.net, so if your network blocks that, installgsap@3.14.2in the project and point the script tag at a local copy. - Colours did not change: run
apply-briefagain and check it printedApplied N values. Editing the CSS:rootcolours has no effect. - Want a different length: keep it at 6 seconds. The beats are timed to that window, and stretching the duration only lengthens the hold.
Where to go next
The full comparison of all five methods, with the license notes and the Google Web Designer route, is on the Lookbk guide: HTML to video: 5 ways to turn HTML into an MP4. Our skills library has 200+ skills, and 38 of them are free.
This post was drafted with AI assistance and checked against the skill's SKILL.md.