HyperFrames: Rendering Video From HTML, CSS and JavaScript
HyperFrames treats a video as code: you describe frames in HTML and CSS, a headless browser paints them, and a converter stitches the result.
Most motion work is still assembled by hand in a timeline editor, which makes every revision a manual operation. HyperFrames takes the opposite position: if a frame can be described declaratively, then a video is just a sequence of frames driven by a variable, and the whole thing can live in a repository, be diffed, reviewed and regenerated on demand. That is the entire premise of the project, and once it clicks, the workflow stops feeling like design work and starts feeling like a build step.
What HyperFrames Actually Is
HyperFrames is an open-source framework that renders video from web code. You write scenes as HTML documents with CSS for layout and styling, use JavaScript to change state over time, and the framework drives a headless browser to capture every frame before handing the images to a video encoder. There is no proprietary timeline format and no GUI file to lose: the source is text, the render is reproducible, and an agent can read it, modify it and render it again without a human touching an editor.
The Render Pipeline End to End
- You define a scene, its dimensions, and the number of frames or the duration it should produce.
- The framework boots a headless browser instance and loads the scene document.
- For each frame index it sets a time value, waits for the page to settle, and captures a screenshot.
- The captured frames are passed to a converter that assembles them into a video file at the requested rate.
- Audio, if any, is attached afterwards as a separate track rather than being generated by the renderer.
The useful property here is determinism: the same source and the same frame count produce the same output, so a failed render is a bug you can reproduce instead of a mystery you have to eyeball.
Writing a Scene in HTML and CSS
Because the scene is a web page, everything you already know applies: flexbox for alignment, variables for theming, keyframe animations for anything continuous. The one habit to change is to stop thinking in absolute frame numbers and start thinking in a normalized time value that the framework injects. Drive transforms from that value rather than from animation state, so scrubbing to any frame gives the correct pose. Keep the document free of network requests, because a slow or unavailable asset turns into a flickering frame in the middle of your render.
Wiring Frames to an Agent
This is where the approach earns its keep. An agent can generate a scene, render it, look at the output and iterate, because every input and output is a plain file. In practice you give the agent a brief, a set of asset paths and a target duration; it writes the scene, invokes the render, checks a frame or two, and revises. Since there is no GUI, the loop runs without a human in the middle, and failures surface as console output and exit codes rather than as silent visual regressions.
Handling Assets and Timing
Fonts should be local files loaded by the page, images should be referenced by stable paths, and anything fetched at render time is a risk you are accepting on purpose. Timing deserves the same discipline: express durations in seconds and let the frame count fall out of the rate, rather than hard-coding frame numbers in three different places. When a scene needs to loop cleanly, make the first and last state identical by construction instead of nudging values until it looks close.
Where the Approach Falls Short
Hand-tuned effects with many interactive layers are still faster in a dedicated motion editor, and any scene that depends on a heavy real-time asset will render slower than it previews. For explainers, title sequences, data-driven clips and anything a script should be able to regenerate, the trade is clearly worth it. For one-off hero animation with an art director in the room, it may not be.
— Nam Hoai (Nam Hoài Đất Mỏ)