Skip to content
GUIDES#HyperFrames#video as code#HeyGen

HyperFrames: The Complete Guide to "Video as Code", Write HTML, Get MP4

Instead of dragging clips on a timeline, you write the video as an HTML file and get back an MP4. HyperFrames is HeyGen's open-source engine built specifically so AI agents can produce video on their own.

Yaakov Tzedek
Yaakov Tzedek · AI expert·9 min read
HyperFrames, video as code, write HTML and get MP4
THE BOTTOM LINE
  • What it is: An open-source video rendering engine where you define a video as an HTML file and get a deterministic MP4 as output.
  • Who it's for: Developers, technical marketers, and especially AI agent workflows (Claude Code, Cursor, Gemini CLI, Codex).
  • What it costs: Free. Apache 2.0 license, no render fee, no commercial usage threshold.
Apache 2.0 (free)License
Deterministic MP4Output
50+Ready-made components in the catalog
DID YOU KNOW?

HyperFrames is running in production at HeyGen itself, and was built specifically so AI agents can produce video independently, because LLMs "speak" HTML naturally.

HyperFrames is HeyGen's open-source engine that turns HTML into an MP4 video. Instead of dragging clips on a timeline, you write the video as code. It was built specifically so AI agents like Claude Code can produce video on their own. This guide covers what it is, how it works, installation, CLI commands, and a comparison with Remotion.

In short (TL;DR)

  • What it is: An open-source video rendering engine where you define a video as an HTML file and get a deterministic MP4 as output.
  • Who it's for: Developers, technical marketers, and especially AI agent workflows (Claude Code, Cursor, Gemini CLI, Codex).
  • What it costs: Free. Apache 2.0 license, no render fee, no commercial usage threshold.
  • How to get started: Install HyperFrames skills, describe the video in plain language, and the agent writes, previews, and renders it.

What is HyperFrames?

HyperFrames is HeyGen's open-source framework that converts HTML, CSS, media, and seekable animations into deterministic MP4 videos. The concept is called "Video as Code": every element in the HTML becomes a "clip" in the video, and timing is defined directly in the markup using data- attributes.

According to the official GitHub repository, you can run it locally via the CLI, from AI agents using skills, or as the rendering core behind hosted video generation services. HyperFrames is used in production at HeyGen itself, with community examples from teams like tldraw and TanStack.

Deterministic rendering: The same input always produces exactly the same output, the same frames, the same video. That's what enables automated regression testing, continuous integration (CI), and scheduled rendering without surprises.

How does HyperFrames work?

You define a video as an HTML file with data- attributes for timing, wire up an animation (e.g. GSAP), preview it in a browser, and finally render to MP4 using headless Chrome and FFmpeg. Here is a basic composition: a background video, a logo that appears after 2 seconds, and background music:

<!-- index.html -->
<div id="stage" data-composition-id="my-video"
     data-start="0" data-width="1920" data-height="1080">
  <video id="clip-1" data-start="0" data-duration="5"
         data-track-index="0" src="intro.mp4" muted playsinline></video>
  <img id="overlay" class="clip" data-start="2" data-duration="3"
       data-track-index="1" src="logo.png" />
  <audio id="bg-music" data-start="0" data-duration="9"
         data-track-index="2" data-volume="0.5" src="music.wav"></audio>
</div>

Under the hood, the engine uses Puppeteer (headless Chrome) to "photograph" the page frame by frame through the beginFrame API, and FFmpeg encodes those frames into a video file. This means rendering is not tied to a real-time clock, so there are no dropped frames.

What is the Rule of Three?

Three rules that must be satisfied for the code to render correctly as video:

  1. Root element: Must include data-composition-id, data-width, and data-height.
  2. Timed elements: Must include class="clip" as well as data-start, data-duration, and data-track-index.
  3. Animations: A GSAP timeline is created with { paused: true } and registered on window.__timelines.
// 1. Create a paused timeline
const tl = gsap.timeline({ paused: true });
// 2. Add animations
tl.from("#title", { opacity: 0, y: -50, duration: 1 }, 0);
// 3. Register the timeline so HyperFrames can seek through it
window.__timelines["my-video"] = tl;

How do you install and get started?

Prerequisites: Node.js version 22 or higher, and FFmpeg installed.

npx skills add heygen-com/hyperframes

This command teaches the agent (Claude Code, Cursor, Gemini CLI, Codex) how to write correct compositions and GSAP animations. In Claude Code, the skills are registered as slash commands: /hyperframes for writing a composition and /gsap for animation help. After that, simply describe what you want:

Example prompt: "Using /hyperframes, create a 10-second product intro with a fade-in title, a background video, and soft background music."

Option 2: Manual project

npx hyperframes init my-video
cd my-video
npx hyperframes preview   # browser preview with live reload
npx hyperframes render    # render to MP4

What are the main CLI commands?

The CLI is non-interactive by default, making it suitable for scripts and agents:

CommandWhat it does
hyperframes initCreates a new project and installs skills automatically
hyperframes lintStatic HTML structure check
hyperframes validateRuntime check in headless Chrome (catches JS errors and missing media)
hyperframes previewBrowser preview with live reload
hyperframes renderRenders the composition to MP4
hyperframes addInstalls a ready-made block or component from the catalog

Note: Both lint and validate must pass before you preview or render, ensuring the composition is valid before you spend time processing it.

What's in the ready-made catalog?

HyperFrames ships with more than 50 ready-made blocks and components: social media overlays, shader transitions, data visualizations, and cinematic effects. Install any of them with a single command:

npx hyperframes add flash-through-white  # shader transition
npx hyperframes add instagram-follow     # social overlay
npx hyperframes add data-chart           # animated chart

HyperFrames vs. Remotion

Both render video with headless Chrome and FFmpeg. The key difference is the authoring model:

AspectHyperFramesRemotion
Authoring modelHTML with data attributesReact components
Build stepNone, index.html plays as-isRequired
AI agent compatibilityHigh (LLMs "speak" HTML)Requires React knowledge
Rendering engineHeadless Chrome + FFmpegHeadless Chrome + FFmpeg

HyperFrames declares itself inspired by Remotion. Remotion's bet is React components; HyperFrames' bet is plain HTML. Want to go deeper on Remotion itself? There is a full Remotion guide in Hebrew.

Who is HyperFrames right for (and who is it less right for)?

It's a good fit for anyone comfortable with code or with AI coding tools, and for anyone who wants to produce video programmatically and automatically at scale.

  • Especially well-suited for: product videos, social clips, animated explainers, data visualizations, captions and overlays, and recurring automated production.
  • Ideal workflow: An AI agent receives a PDF, CSV, or article and converts it into a video, because the agent already knows how to write HTML.
  • Less suited for: Anyone who isn't comfortable with the command line and prefers a full drag-and-drop interface.

The bottom line

HyperFrames moves video production into the world of HTML, a format that both developers and AI agents know well. For anyone already working with Claude Code or similar AI tools, it's a practical way to turn text, data, or a document into a high-quality MP4, without opening a video editor. Want to learn how to harness tools like this for your business? That's exactly what we teach.

Continue reading: Free Claude Code course · What is Claude Code · AI automation for businesses · Recommended AI tools

Frequently asked questions

Was this article helpful?
Share:WhatsAppLinkedInX
Yaakov Tzedek
WRITTEN BY

Yaakov Tzedek

An Israeli AI lecturer, consultant and implementer who has supported 100+ organizations in AI implementation and lectured for 200+. Official content partner of Meta, Google, Canva and TikTok, featured on Israel's Channel 13.

More about Yaakov →