@hyperframes/engine is the low-level layer beneath the
Producer. It opens a page that implements the HyperFrames
seek protocol, seeks to an exact time, and captures the resulting frame.
Most integrations should use the CLI or Producer. Use the Engine only when you
need to own frame capture, encoding, media extraction, or browser management.
Why it is different from screen recording
A screen recorder waits for the wall clock and may miss frames under load. The Engine asks the page to seek to a specific time and captures that state before moving on. That makes frame scheduling repeatable and prevents dropped frames caused by a slow machine. Exact pixels can still vary with Chrome, fonts, codecs, GPU behavior, and the host environment. Pin those dependencies when exact visual reproducibility matters.Capture frames
The page atserverUrl must expose window.__hf with a duration and a
deterministic seek(time) function.
captureFrameToBuffer() when the next stage needs an in-memory buffer
instead of a file.
WebGPU requirements
A composition markeddata-requires-webgpu must be able to create a WebGPU
device before capture starts. Finding an adapter alone is insufficient: device
creation can still fail because of the browser or graphics driver. The adapter
and device check share a ten-second timeout, and failure stops capture with
WebGpuUnavailableError.
Hardware adapters are required by default. A launch explicitly configured for
software WebGPU may use SwiftShader, but it must also create a device. The check
releases its temporary device; the composition still creates its own device
with any features or limits its renderer needs.
Remote media downloads
The engine downloads remotehttps:// video, audio, image, and font sources
into the render’s work directory before it uses them. Each download has these
limits, and an environment variable changes each one:
Sizes are in bytes and the time limit is in milliseconds. A speed or free-space
value of
0 turns that check off.
A download that passes one of these limits stops with an error. The time limit
applies to each attempt: a stalled or too-slow attempt that is retried starts a
new 30 minutes, while an attempt stopped by the time limit is not retried.
The free-space check counts the declared sizes of all downloads running at the
same time in this process, so parallel downloads in one render cannot fill the
volume together. Separate render processes on one host see each other’s writes
only when they measure free space again, every 4 MiB received. On a shared host
that evicts workloads below a free-disk threshold, set
HYPERFRAMES_DOWNLOAD_MIN_FREE_BYTES above that threshold.
What else the package exposes
Paths passed to
encodeFramesChunkedConcat() and concatVideoFiles() may be
relative or absolute. Relative paths resolve from the calling process’s working
directory.
muxVideoWithAudio() recognizes output filename extensions regardless of case.
WebM output, including .WEBM and .WeBm, converts audio to Opus while copying
the video stream.
These are rendering internals. Their result and error conventions differ by
operation: browser and capture orchestration throws, FFmpeg wrappers generally
return result objects, and teardown helpers avoid masking the original failure.
Browser and frame-capture diagnostics, including motion-blur reports, go to
stderr. This keeps stdout available for machine-readable results such as
hyperframes benchmark --json.
Related topics
@hyperframes/producer
Get a finished video without assembling the pipeline yourself.
Deterministic rendering
Understand what HyperFrames controls and what the environment still affects.