mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-10-30 09:16:55 +00:00
* fix(core): a scene rendered on its own takes its master chain from its own root The standalone wrapper for a scene file reused the project index's root attributes, so the index's data-fx-chain became the master bus. The wrapper now carries the scene root's own chain, or none when the scene declares none, as the audio-effects reference describes. — Jerrai * fix(engine): run long audio chains window by window instead of reading the file whole applyAudioFxChain read the whole input WAV into memory, which Node refuses past 2 GiB (a stereo float mix beyond about 93 minutes), and the browser page then held the track twice. Inputs above 512 MiB of samples are now read, rendered and written in 5 minute windows, each with 10 s of preceding and 1 s of following audio rendered and discarded so stateful effects arrive warm. The output header is patched at the end. Inputs below the threshold keep the existing whole-file path. Parameter automation is clocked from the file start and is not windowed. An input past 2 GiB that carries automation now fails with an AudioFxRenderError naming that, instead of Node's raw file-size error. — Jerrai * chore(engine): trim the browser-lease comment to its live invariant — Jerrai * fix(core): a scene mounted as the index's own root takes its own master chain When the index's top-level composition is itself the scene's mount, the standalone extraction returned before the scene's chain was applied, so the index's chain still won. — Jerrai * fix(engine): windowed audio renders follow the file's clock and warm up for the whole chain - Pass each window's start time into the page and on to buildFxChain, and seed the pitch-shift worklet's tap phase from it, so chorus, phaser and pitch shift continue across a window seam instead of restarting from time zero. - Size the pre-roll from the chain (delay repeats, reverb room, dynamics release, to -60 dB), never below the configured floor and never above a cap. - Read a WAV data size of 0 or 0xFFFFFFFF as running to the end of the file, so audio past 4 GiB is no longer dropped. - Close the input descriptor when the output cannot be opened, and name the real cause when an input over 2 GiB cannot be streamed. - Cover reverb, a slow-release compressor, chorus and pitch shift in the windowed-vs-whole test, with an output-length check. — Jerrai * fix(engine): start each audio window on a render quantum and test the seams against a hard chain Windows that begin off a 128-frame block see worklet blocks shifted against a whole render, which left spikes in the tail after the last input sample. Align the window start, and make the windowed-vs-whole test cover modulation, delay, reverb and a slow-release compressor on windows whose start is not zero, failing above 0.001 where it previously tolerated 0.02. — Jerrai * fix(engine): keep a limiter's lookahead, seed bitcrush holds, close-check without /proc - Pad the render source with the limiter's lookahead of silence so the last samples of a clip leave the lookahead line instead of being dropped. - Seed the bitcrush hold counter from the window's start so holds that do not divide the render quantum stay in step across seams, and cover bitcrush in the windowed-vs-whole test. - Check that the input descriptor is closed through the fs mock instead of /proc/self/fd, which only exists on Linux. — Jerrai * test(engine): pick a bitcrush hold the window starts do not divide The earlier hold of 3 divided both window starts, so an unseeded counter passed. — Jerrai * fix(engine): warn at the pre-roll cap, share tail formulas, read a zero data size alike - Warn when a chain's memory exceeds the pre-roll cap, so cut repeats at window seams are not silent. - Export the delay and reverb tail formulas from audio-fx-tail and use them for the window warm-up too. - Both WAV readers now treat a declared data size of 0 or 0xFFFFFFFF as the rest of the file. — Jerrai
@hyperframes/engine
Seekable web-page-to-video rendering engine built on Puppeteer and FFmpeg.
Framework-agnostic: works with GSAP, Lottie, Three.js, CSS animations, or any web content that implements the window.__hf seek protocol.
Install
npm install @hyperframes/engine
Requirements: Node.js >= 22, Chrome/Chromium (auto-downloaded by Puppeteer), FFmpeg
What it does
The engine opens your HTML composition in a headless Chrome instance, seeks frame-by-frame using Chrome's HeadlessExperimental.beginFrame API, captures screenshots, and encodes them into video with FFmpeg.
Key services
| Service | Description |
|---|---|
| browserManager | Launches and pools headless Chrome instances (chrome-headless-shell) |
| frameCapture | Manages capture sessions — seek, screenshot, buffer lifecycle |
| screenshotService | BeginFrame-based capture with CDP (Chrome DevTools Protocol) |
| chunkEncoder | FFmpeg encoding with chunked concat, GPU detection, faststart |
| streamingEncoder | Pipe frames to FFmpeg in real time (no intermediate PNGs on disk) |
| audioMixer | Parse <audio> elements and mix audio tracks via FFmpeg |
| videoFrameExtractor | Extract frames from <video> elements for compositing |
| parallelCoordinator | Split frame ranges across worker processes |
| fileServer | Serve local HTML files to the browser via Hono |
Usage
import {
acquireBrowser,
createCaptureSession,
initializeSession,
captureFrame,
closeCaptureSession,
} from "@hyperframes/engine";
// 1. Launch browser
const browserLease = await acquireBrowser({ captureMode: "beginFrame" });
// 2. Open a capture session
const session = createCaptureSession({
browser: browserLease.browser,
url: "http://localhost:3000/my-composition.html",
width: 1920,
height: 1080,
fps: 30,
});
await initializeSession(session);
// 3. Capture frames
for (let i = 0; i < totalFrames; i++) {
await captureFrame(session, i, `/tmp/frames/frame-${i}.png`);
}
// 4. Clean up
await closeCaptureSession(session);
await browserLease.release();
Most users should use @hyperframes/producer or the hyperframes CLI instead of calling the engine directly.
Documentation
Full documentation: hyperframes.heygen.com/packages/engine
Related packages
@hyperframes/core— types, parsers, frame adapters@hyperframes/producer— high-level render pipeline built on this enginehyperframes— CLI