mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-09-13 07:40:06 +00:00
test(producer): add mp4 H.265 SDR distributed fixture
This commit is contained in:
@@ -117,6 +117,12 @@ export interface RunDistributedSimulatedInput {
|
|||||||
/** From the fixture's renderConfig — must pass `checkDistributedSupport`. */
|
/** From the fixture's renderConfig — must pass `checkDistributedSupport`. */
|
||||||
fps: 24 | 30 | 60;
|
fps: 24 | 30 | 60;
|
||||||
format: "mp4" | "mov" | "png-sequence";
|
format: "mp4" | "mov" | "png-sequence";
|
||||||
|
/**
|
||||||
|
* Codec for `format: "mp4"`. Defaults to `"h264"`; pass `"h265"` to
|
||||||
|
* exercise the libx265 closed-GOP path. Ignored for non-mp4 formats —
|
||||||
|
* `plan()` throws if codec is passed with a non-mp4 format.
|
||||||
|
*/
|
||||||
|
codec?: "h264" | "h265";
|
||||||
/** Optional chunkSize override; defaults to the plan's 240. */
|
/** Optional chunkSize override; defaults to the plan's 240. */
|
||||||
chunkSize?: number;
|
chunkSize?: number;
|
||||||
/** Optional maxParallelChunks override; defaults to the plan's 16. */
|
/** Optional maxParallelChunks override; defaults to the plan's 16. */
|
||||||
@@ -147,10 +153,25 @@ export async function runDistributedSimulatedRender(
|
|||||||
mkdirSync(planDir, { recursive: true });
|
mkdirSync(planDir, { recursive: true });
|
||||||
mkdirSync(chunksDir, { recursive: true });
|
mkdirSync(chunksDir, { recursive: true });
|
||||||
|
|
||||||
// Step A: plan.
|
// Step A: plan. `codec` is only forwarded when the format actually
|
||||||
|
// accepts it — `plan()` throws if codec is set for a non-mp4 format,
|
||||||
|
// and a caller passing `format: "mov", codec: undefined` would still
|
||||||
|
// surface that field in the resulting object. We omit it conditionally
|
||||||
|
// to keep the off-path planDir identical to pre-codec-knob output.
|
||||||
const planResult = await plan(
|
const planResult = await plan(
|
||||||
input.projectDir,
|
input.projectDir,
|
||||||
{
|
input.format === "mp4"
|
||||||
|
? {
|
||||||
|
fps: input.fps,
|
||||||
|
width: 1920,
|
||||||
|
height: 1080,
|
||||||
|
format: "mp4",
|
||||||
|
codec: input.codec,
|
||||||
|
chunkSize: input.chunkSize,
|
||||||
|
maxParallelChunks: input.maxParallelChunks,
|
||||||
|
hdrMode: "force-sdr",
|
||||||
|
}
|
||||||
|
: {
|
||||||
fps: input.fps,
|
fps: input.fps,
|
||||||
// Required-by-type but overridden by the composition's own attrs;
|
// Required-by-type but overridden by the composition's own attrs;
|
||||||
// see docstring above. Any positive integer works.
|
// see docstring above. Any positive integer works.
|
||||||
|
|||||||
@@ -56,6 +56,17 @@ type TestMetadata = {
|
|||||||
* time; the in-process renderer accepts it.
|
* time; the in-process renderer accepts it.
|
||||||
*/
|
*/
|
||||||
format?: "mp4" | "webm" | "mov" | "png-sequence";
|
format?: "mp4" | "webm" | "mov" | "png-sequence";
|
||||||
|
/**
|
||||||
|
* Codec selection for `format: "mp4"`, forwarded to
|
||||||
|
* `DistributedRenderConfig.codec`. The in-process renderer doesn't take
|
||||||
|
* a codec hint — for the baseline it always picks the format's default
|
||||||
|
* (h264 for mp4 SDR), so `codec: "h265"` is exercised exclusively in
|
||||||
|
* `--mode=distributed-simulated`. The PSNR comparison against the
|
||||||
|
* baseline therefore measures "h265 chunked + concat" ≈ "h264 single-
|
||||||
|
* pass" rather than byte equality. Fixtures asserting a tighter
|
||||||
|
* contract should explicitly pin a higher `minPsnr`.
|
||||||
|
*/
|
||||||
|
codec?: "h264" | "h265";
|
||||||
workers?: number; // Optional: auto-calculates if omitted
|
workers?: number; // Optional: auto-calculates if omitted
|
||||||
/** Force HDR in the harness; omitted/false preserves historical SDR-only test behavior. */
|
/** Force HDR in the harness; omitted/false preserves historical SDR-only test behavior. */
|
||||||
hdr?: boolean;
|
hdr?: boolean;
|
||||||
@@ -250,6 +261,18 @@ function validateMetadata(meta: unknown): TestMetadata {
|
|||||||
"meta.json: 'renderConfig.format' must be 'mp4', 'webm', 'mov', or 'png-sequence' (or omit for mp4)",
|
"meta.json: 'renderConfig.format' must be 'mp4', 'webm', 'mov', or 'png-sequence' (or omit for mp4)",
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
if (rc.codec !== undefined && rc.codec !== "h264" && rc.codec !== "h265") {
|
||||||
|
throw new Error(
|
||||||
|
"meta.json: 'renderConfig.codec' must be 'h264' or 'h265' (or omit for the format's default)",
|
||||||
|
);
|
||||||
|
}
|
||||||
|
if (rc.codec !== undefined && rc.format !== undefined && rc.format !== "mp4") {
|
||||||
|
throw new Error(
|
||||||
|
`meta.json: 'renderConfig.codec' is only valid for format='mp4' (got format=${JSON.stringify(
|
||||||
|
rc.format,
|
||||||
|
)})`,
|
||||||
|
);
|
||||||
|
}
|
||||||
if (rc.workers !== undefined) {
|
if (rc.workers !== undefined) {
|
||||||
if (typeof rc.workers !== "number" || rc.workers < 1) {
|
if (typeof rc.workers !== "number" || rc.workers < 1) {
|
||||||
throw new Error("meta.json: 'renderConfig.workers' must be >= 1 (or omit to auto-calculate)");
|
throw new Error("meta.json: 'renderConfig.workers' must be >= 1 (or omit to auto-calculate)");
|
||||||
@@ -822,6 +845,7 @@ async function runTestSuite(
|
|||||||
renderedOutputPath,
|
renderedOutputPath,
|
||||||
fps: fpsNum,
|
fps: fpsNum,
|
||||||
format: outputFormat as "mp4" | "mov" | "png-sequence",
|
format: outputFormat as "mp4" | "mov" | "png-sequence",
|
||||||
|
codec: suite.meta.renderConfig.codec,
|
||||||
chunkSize: suite.meta.renderConfig.chunkSize,
|
chunkSize: suite.meta.renderConfig.chunkSize,
|
||||||
maxParallelChunks: suite.meta.renderConfig.maxParallelChunks,
|
maxParallelChunks: suite.meta.renderConfig.maxParallelChunks,
|
||||||
variables: suite.meta.renderConfig.variables,
|
variables: suite.meta.renderConfig.variables,
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
{
|
||||||
|
"name": "Distributed: mp4 H.265 SDR",
|
||||||
|
"description": "60-frame composition (2s @ 30fps) with text, a crossfade transition, and a small rotating SVG icon. renderConfig.format=mp4 + codec=h265 routes the distributed pipeline through libx265 with closed-GOP keyint params (min-keyint=N:scenecut=0:open-gop=0:repeat-headers=1). The in-process baseline is rendered as h264 because the in-process renderer doesn't expose a codec hint — the harness's PSNR comparison therefore measures 'libx265 chunked + concat' against 'libx264 single-pass', catching gross codec failures while accepting normal cross-codec PSNR drift (~30-35 dB at standard quality).",
|
||||||
|
"tags": ["distributed", "mp4", "h265", "hevc", "sdr"],
|
||||||
|
|
||||||
|
"minPsnr": 30,
|
||||||
|
"maxFrameFailures": 0,
|
||||||
|
|
||||||
|
"minAudioCorrelation": 0.9,
|
||||||
|
"maxAudioLagWindows": 120,
|
||||||
|
|
||||||
|
"renderConfig": {
|
||||||
|
"fps": 30,
|
||||||
|
"format": "mp4",
|
||||||
|
"codec": "h265",
|
||||||
|
"chunkSize": 15
|
||||||
|
}
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
@@ -0,0 +1,3 @@
|
|||||||
|
version https://git-lfs.github.com/spec/v1
|
||||||
|
oid sha256:c62e51a616e24c4ba16504a8508bafa58866bd3dabc68cbf32076a49eabb53bd
|
||||||
|
size 59699
|
||||||
@@ -0,0 +1,103 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<meta content="width=device-width, initial-scale=1.0" name="viewport" />
|
||||||
|
<title>mp4 H.265 SDR distributed fixture</title>
|
||||||
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.12.2/gsap.min.js"></script>
|
||||||
|
<style>
|
||||||
|
@import url("https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&display=swap");
|
||||||
|
|
||||||
|
body,
|
||||||
|
html {
|
||||||
|
margin: 0;
|
||||||
|
padding: 0;
|
||||||
|
width: 640px;
|
||||||
|
height: 360px;
|
||||||
|
background: #0f172a;
|
||||||
|
overflow: hidden;
|
||||||
|
font-family: "Space Mono", monospace;
|
||||||
|
}
|
||||||
|
|
||||||
|
#main-comp {
|
||||||
|
position: relative;
|
||||||
|
width: 640px;
|
||||||
|
height: 360px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.label {
|
||||||
|
position: absolute;
|
||||||
|
top: 22%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translateX(-50%);
|
||||||
|
font-size: 18px;
|
||||||
|
letter-spacing: 4px;
|
||||||
|
color: #94a3b8;
|
||||||
|
text-transform: uppercase;
|
||||||
|
}
|
||||||
|
|
||||||
|
.title {
|
||||||
|
position: absolute;
|
||||||
|
top: 50%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, -50%);
|
||||||
|
font-family: "Space Mono", monospace;
|
||||||
|
font-size: 56px;
|
||||||
|
font-weight: 700;
|
||||||
|
color: #6366f1;
|
||||||
|
white-space: nowrap;
|
||||||
|
}
|
||||||
|
|
||||||
|
.stage {
|
||||||
|
position: absolute;
|
||||||
|
inset: 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.icon {
|
||||||
|
position: absolute;
|
||||||
|
bottom: 18%;
|
||||||
|
left: 50%;
|
||||||
|
transform: translate(-50%, 0);
|
||||||
|
width: 48px;
|
||||||
|
height: 48px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div
|
||||||
|
id="main-comp"
|
||||||
|
data-composition-id="main-comp"
|
||||||
|
data-width="640"
|
||||||
|
data-height="360"
|
||||||
|
data-start="0"
|
||||||
|
data-duration="2"
|
||||||
|
>
|
||||||
|
<div class="stage" id="stage-a">
|
||||||
|
<div class="label">CODEC</div>
|
||||||
|
<div class="title" id="title-a">HEVC ONE</div>
|
||||||
|
</div>
|
||||||
|
<div class="stage" id="stage-b" style="opacity: 0">
|
||||||
|
<div class="label">CODEC</div>
|
||||||
|
<div class="title" id="title-b">HEVC TWO</div>
|
||||||
|
</div>
|
||||||
|
<svg class="icon" viewBox="0 0 48 48" xmlns="http://www.w3.org/2000/svg" id="icon">
|
||||||
|
<circle cx="24" cy="24" r="18" fill="none" stroke="#6366f1" stroke-width="4" />
|
||||||
|
<circle cx="24" cy="24" r="6" fill="#6366f1" />
|
||||||
|
</svg>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
const tl = gsap.timeline({ paused: true });
|
||||||
|
window.__timelines = window.__timelines || {};
|
||||||
|
window.__timelines["main-comp"] = tl;
|
||||||
|
|
||||||
|
const stageA = document.getElementById("stage-a");
|
||||||
|
const stageB = document.getElementById("stage-b");
|
||||||
|
const icon = document.getElementById("icon");
|
||||||
|
|
||||||
|
tl.to(stageA, { opacity: 0, duration: 0.2, ease: "none" }, 0.9);
|
||||||
|
tl.to(stageB, { opacity: 1, duration: 0.2, ease: "none" }, 0.9);
|
||||||
|
tl.to(icon, { rotation: 360, duration: 2, ease: "none" }, 0);
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user