HTML Video Maker

Tutorial

HyperFrames tutorial: from HTML page to rendered MP4

A step-by-step HyperFrames tutorial: install the skill, write a seekable HTML composition, set the frame size and duration, then render to MP4.

What HyperFrames actually does

A composition is a self-contained page: HTML in the body, CSS in a style, and optionally a script. HyperFrames plays that page's timeline through a headless browser and encodes the result to a video file. No React, no component model, no build step — the thing you open in a tab is the thing that gets rendered.

That single idea explains all the advice below. If a piece of your page only works when someone is watching it live — a requestAnimationFrame loop that changes things "just in time" — the renderer can still see it, but you lose the ability to seek into it frame by frame.

Step 1: get the tooling and read the index

Install the skill, which is how the framework is distributed for agents and editors:

npx skills add heygen-com/hyperframes

The documentation publishes a machine-readable index at developers.heygen.com/llms.txt. Fetch that first when you are working with an assistant: it lists every page in the docs, which is faster than guessing URLs and much faster than searching.

Step 2: write the page

Start with something small and true. A title, a subtitle, a background — 30 lines of markup and 40 of CSS.

<div class="scene">
  <p class="kicker">QUARTERLY</p>
  <h1>Three things we shipped</h1>
</div>
body{margin:0;min-height:100vh;background:#0b1220;color:#fff;font-family:system-ui,sans-serif;display:grid;place-items:center}
.scene{padding:0 8vw}
.kicker{margin:0 0 16px;letter-spacing:.3em;font-size:13px;color:#7f9bff}
h1{margin:0;font-size:clamp(30px,6vw,68px);line-height:1.08;letter-spacing:-.03em}

Do not open a terminal for this. Paste it into the editor on the home page, check it in 16:9 and 9:16, and only then think about rendering. Ninety per cent of "the render looks wrong" problems are design problems you could have seen in ten seconds in a preview.

Step 3: make the motion seekable

This is the step that separates a page from a composition.

Good: CSS animations and transitions, or a timeline library such as GSAP. Both are expressions of a timeline that can be paused and set to any position.

Fragile: setTimeout chains, requestAnimationFrame counters that mutate the DOM, anything that depends on wall-clock time instead of animation progress. A renderer can still capture the frames, but if the motion is not a function of the timeline, it is not reproducible.

CSS is the cheapest way to get this right:

.kicker{animation:up .5s .1s both}
h1{animation:up .6s .25s both}
@keyframes up{from{opacity:0;transform:translateY(16px)}to{opacity:1;transform:none}}

Two details do most of the work: both (so the element holds its start state before the delay and its end state after), and staggered delays rather than longer durations.

On top of that, HyperFrames wants each element to declare where it sits on the composition timeline, through data-* attributes. Treat those attributes as the source of truth for timing and the CSS delays as the visual equivalent — if they disagree, the render is what matters.

Step 4: set the frame and the length

The composition needs a size and a duration. Pick the size from where the video will live, not from your monitor:

Target Size
YouTube, X, embedded demo 1920×1080 (or 1280×720)
Shorts, Reels, TikTok 1080×1920
Square post 1080×1080

Then set the duration to the length of the longest timeline, plus a beat of stillness at the end. Videos that cut off mid-motion look broken; half a second of held frame reads as a deliberate end.

Step 5: render

There are two routes, and the choice is mostly about where the CPU lives:

  • Locally or self-hosted. You run the render on your machine or your own cloud (Lambda, Cloud Run). Flat cost, your files stay with you, and the first render takes the longest because of the browser download.
  • HeyGen's cloud rendering API. You send the composition, they return the video. No local browser to babysit, and it is the route that makes sense when a backend is generating hundreds of compositions.

Output formats include MP4, MOV, WebM, GIF and a PNG sequence. For social, MP4; for a Lottie-style asset or a thumbnail grid, the PNG sequence is more useful than it looks.

Step 6: check the file, not the page

Open the rendered video and look for four things, in this order:

  1. Fonts. A webfont that loaded a second late renders as a fallback. Load fonts explicitly and give the first frame a moment of stillness.
  2. Infinite animations. A looping pulse looks intentional on a page and like a glitch in a 4-second clip. Bound it.
  3. The first frame. Most players show it as the poster. If it is a black rectangle, you have shipped a black thumbnail.
  4. The last frame. Same logic — do not end on emptiness unless the emptiness is the point.

Common mistakes

  • Fixed pixel widths. width:640px breaks the moment you cut the same composition vertically. Use vw, vh and clamp().
  • Timing split across three places. CSS delay, data-* attribute and a JS variable will drift. Keep one source of truth.
  • Remote assets without width and height. Images that arrive late reflow the layout mid-render.
  • Testing only in the preview. The preview is a browser; the render is a different browser session with a cold cache.

Ready-made scenes to start from are in HyperFrames examples. If you are still choosing between frameworks, read HyperFrames vs Remotion first — the licence question is worth settling before you write code.

Frequently asked questions

Do I need React or a build step to use HyperFrames?

No, and that is the point: a composition is a self-contained HTML/CSS/JS page, so it runs in any browser. A build step is only needed if you want TypeScript or a bundler for your own convenience.

What is the difference between the CSS animation delay and the timing attributes?

They should agree. The CSS delay controls what a visitor sees in a browser preview; the timing attributes tell the renderer where the element sits on the timeline. Set both from the same number and the two stay in sync.

What formats can I render to?

MP4, MOV, WebM, GIF and a PNG sequence, rendered locally, on your own cloud, or through HeyGen's cloud rendering API.

Why do my fonts change in the rendered video?

Usually a webfont that had not loaded when the first frame was captured. Load the font explicitly in the page and let the opening frame hold still for a beat before the animation starts.

What kind of JavaScript is safe to use in a composition?

Use CSS animations, transitions or a timeline library such as GSAP. Timing built from setTimeout chains or wall-clock counters is not reproducible frame to frame.

How do I debug a render that looks wrong?

Check the frame size first, then duration, then fonts. Those three account for almost every case, and all three are visible in a browser preview before you spend a render.