Write HTML. Render video. Built for agents.
JavaScript aiai-agentsanimationclaude-codeffmpegframeworkgsaphtmlhtml-to-videomcpmotion-graphicspuppeteerrenderingtypescriptvideo-editor
import type { EngineConfig, MotionBlurOptions } from "@hyperframes/engine";
/**
* The format a render captures its frames in.
*
* Two independent reasons force PNG, and conflating them is how the encoder ends up
* hunting for `frame_%06d.jpg` against files written as `.png`:
*
* - the output container keeps alpha, which JPEG cannot carry;
* - motion blur is on, because the sub-frame samples are averaged pixel by pixel and
* JPEG samples would be averaged after a lossy quantization.
*
* Every consumer of "is this render PNG" reads the resolved capture format rather than
* re-deriving it from one of the reasons.
*/
export function resolveCaptureImageFormat(input: {
needsAlpha: boolean;
motionBlur: MotionBlurOptions | undefined;
}): "jpeg" | "png" {
return input.needsAlpha || input.motionBlur ? "png" : "jpeg";
}
/**
* Below 100, Chrome's JPEG turns graded colour and grain into 8x8 chroma blotches that survive
* the final encode. Draft keeps the smaller, faster frames.
*/
export function resolveCaptureJpegQuality(quality: EngineConfig["quality"]): number {
return quality === "draft" ? 80 : 100;
}