HeadlessExperimental.beginFrame API. This is the layer that makes Hyperframes rendering deterministic.
When to Use
Use@hyperframes/engine when you need to:
- Build a custom rendering pipeline with full control over frame capture
- Integrate Hyperframes capture into an existing video processing system
- Capture individual frames (e.g., for thumbnails or sprite sheets) without encoding to video
- Implement a custom encoding backend (not FFmpeg)
- Render an HTML composition to a finished MP4 — use the producer or CLI
- Preview compositions in the browser — use the CLI or studio
- Lint or parse composition HTML — use core
How It Works
The engine implements a seek-and-capture loop that is fundamentally different from screen recording:Launch headless Chrome
The engine starts
chrome-headless-shell, a minimal headless Chrome binary optimized for programmatic control via the Chrome DevTools Protocol (CDP).Load the composition
Your HTML composition is loaded into a browser page. The Hyperframes runtime is injected to manage timeline seeking.
Seek to each frame
For every frame in the video (e.g., 900 frames for a 30-second video at 30fps), the engine calls
renderSeek(time) to advance the composition to the exact timestamp. No wall clock is involved — each frame is independently positioned.Capture via BeginFrame
Chrome’s
HeadlessExperimental.beginFrame API captures the compositor output as a pixel buffer. This produces pixel-perfect frames without any screen recording artifacts.Configuration
Quality Presets
| Preset | Use Case | Speed |
|---|---|---|
draft | Fast iteration during development | Fastest |
standard | Production renders with good quality/speed balance | Moderate |
high | Final delivery, maximum quality | Slowest |
FPS Options
| FPS | Use Case |
|---|---|
24 | Cinematic look, smaller file size |
30 | Standard web video, good balance |
60 | Smooth motion, UI animations, screen recordings |
Programmatic Usage
Key Concepts
BeginFrame Rendering
Traditional screen capture records at wall-clock speed — if your system is under load, frames get dropped. The engine uses Chrome’sHeadlessExperimental.beginFrame to explicitly advance the compositor, producing each frame on demand. This means:
- No dropped frames — every frame is captured
- No timing dependency — a 60-second video does not take 60 seconds to capture
- Pixel-perfect output — the compositor produces the exact pixels it would display
Seek Contract
The engine relies on the Hyperframes runtime’srenderSeek(time) function. When called, renderSeek:
- Pauses all GSAP timelines
- Seeks every timeline to the exact timestamp
- Updates all media elements (video, audio) to match
- Mounts/unmounts clips based on their
data-startanddata-duration
Chrome Requirements
The engine requireschrome-headless-shell, which is included when you install the package. It uses a pinned Chrome version to ensure consistent rendering across environments. For fully deterministic output (including fonts), use Docker mode via the producer.
Related Packages
Producer
Wraps the engine with runtime injection, FFmpeg encoding, and audio mixing for complete MP4 output.
Core
Provides the types, runtime, and linter that the engine depends on.
CLI
The easiest way to render — calls the producer (and engine) under the hood.
Studio
Visual editor for building compositions before rendering them with the engine.