Skip to content

Commit cc9e1bb

Browse files
feat(producer): distributed renders accept 25 fps (#5423)
Lambda and Cloud Run renders refused 25 fps although it is an integer rate like 24, 30 and 60, and PAL footage is 25 fps. The distributed fps set is now {24, 25, 30, 60} in the producer's config validation, the plan v2 manifest, the render request mapping, the Lambda and Cloud Run event types, the CLI's lambda and cloudrun commands and the regression harnesses. Co-authored-by: Cursor <[email protected]>
1 parent 09c0307 commit cc9e1bb

28 files changed

Lines changed: 87 additions & 54 deletions

‎docs/deploy/migrating-to-hyperframes-lambda.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ Most adopters' render config maps directly:
5252

5353
| Concept | HyperFrames equivalent | Where it lives |
5454
| ------------------------ | ----------------------------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
55-
| `fps` | `--fps=30` (CLI) or `config.fps` (SDK) | 24, 30, 60 only — non-integer NTSC rationals are an in-process-only feature. |
55+
| `fps` | `--fps=30` (CLI) or `config.fps` (SDK) | 24, 25, 30, 60 only — non-integer NTSC rationals are an in-process-only feature. |
5656
| `width` / `height` | `--width` / `--height` flags, or `config.width` / `config.height` | Even integers ≤ 7680 (yuv420p parity). |
5757
| `codec: 'h264' / 'h265'` | `--codec=h264` or `--codec=h265` (mp4 only) | h265 uses libx265 with closed-GOP keyint params so chunked concat-copy round-trips losslessly. |
5858
| Output format | `--format=mp4 / mov / webm / png-sequence` | webm uses libvpx-vp9 + closed-GOP concat-copy. Distributed mode still refuses HDR mp4 at plan time. |

‎docs/packages/cli.mdx‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1937,7 +1937,7 @@ And these drive `render` and `render-batch`:
19371937
| ----------------------- | ----------------------------------- | ----------------------------------------------------------------------------------------------------------------- |
19381938
| `--width`, `--height` | required | Render dimensions in pixels |
19391939
| `--site-id` | content hash | Reuse an uploaded site instead of uploading again |
1940-
| `--fps` | `30` | `24`, `30`, or `60` |
1940+
| `--fps` | `30` | `24`, `25`, `30`, or `60` |
19411941
| `--format` | `mp4` | `mp4`, `mov`, `webm`, or `png-sequence` |
19421942
| `--codec` | `h264` | `h264` or `h265`, MP4 only |
19431943
| `--quality` | `standard` | `draft`, `standard`, or `high` |

‎packages/aws-lambda/src/events.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ interface PlanLambdaResultBase {
164164
PlanHash: string;
165165
ChunkCount: number;
166166
TotalFrames: number;
167-
Fps: 24 | 30 | 60;
167+
Fps: 24 | 25 | 30 | 60;
168168
Width: number;
169169
Height: number;
170170
Format: DistributedFormat;

‎packages/aws-lambda/src/sdk/renderToLambda.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -173,7 +173,7 @@ describe("renderToLambda", () => {
173173
projectDir,
174174
bucketName: "test-bucket",
175175
stateMachineArn: "arn:aws:states:us-east-1:1234:stateMachine:hf",
176-
config: { ...baseConfig, fps: 25 as 24 | 30 | 60 },
176+
config: { ...baseConfig, fps: 50 as 24 | 25 | 30 | 60 },
177177
sfn: asSFNClient(sfn),
178178
s3: asS3Client(s3),
179179
});

‎packages/aws-lambda/src/sdk/validateConfig.test.ts‎

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,11 @@ describe("validateDistributedRenderConfig", () => {
2020
expect(validateDistributedRenderConfig(VALID)).toBe(VALID);
2121
});
2222

23+
it("accepts 25 fps", () => {
24+
const cfg: SerializableDistributedRenderConfig = { ...VALID, fps: 25 };
25+
expect(validateDistributedRenderConfig(cfg)).toBe(cfg);
26+
});
27+
2328
it("accepts optional fields when valid", () => {
2429
const cfg: SerializableDistributedRenderConfig = {
2530
...VALID,
@@ -39,7 +44,7 @@ describe("validateDistributedRenderConfig", () => {
3944
["null config", null as unknown as SerializableDistributedRenderConfig, "config"],
4045
[
4146
"wrong fps",
42-
{ ...VALID, fps: 25 as 24 | 30 | 60 } satisfies SerializableDistributedRenderConfig,
47+
{ ...VALID, fps: 50 as 24 | 25 | 30 | 60 } satisfies SerializableDistributedRenderConfig,
4348
"config.fps",
4449
],
4550
[

‎packages/cli/src/commands/cloudrun.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export default defineCommand({
167167
"site-id": { type: "string", description: "Explicit site id (overrides content hash)" },
168168
width: { type: "string", description: "Render width in pixels" },
169169
height: { type: "string", description: "Render height in pixels" },
170-
fps: { type: "string", description: "Render fps (24 | 30 | 60)" },
170+
fps: { type: "string", description: "Render fps (24 | 25 | 30 | 60)" },
171171
format: { type: "string", description: "mp4 | mov | png-sequence | webm (default: mp4)" },
172172
codec: { type: "string", description: "h264 | h265 (mp4 only)" },
173173
quality: { type: "string", description: "draft | standard | high" },
@@ -529,11 +529,11 @@ function resolveCloudRunFps(
529529
args: Record<string, unknown>,
530530
projectDir: string,
531531
command: "render" | "render-batch",
532-
): 24 | 30 | 60 {
532+
): 24 | 25 | 30 | 60 {
533533
const fps =
534-
parseIntFlag(args.fps) ?? readAllowedCompositionFpsFromDir(projectDir, [24, 30, 60]) ?? 30;
535-
if (fps === 24 || fps === 30 || fps === 60) return fps;
536-
console.error(`[cloudrun ${command}] --fps must be 24, 30, or 60; got ${fps}.`);
534+
parseIntFlag(args.fps) ?? readAllowedCompositionFpsFromDir(projectDir, [24, 25, 30, 60]) ?? 30;
535+
if (fps === 24 || fps === 25 || fps === 30 || fps === 60) return fps;
536+
console.error(`[cloudrun ${command}] --fps must be 24, 25, 30, or 60; got ${fps}.`);
537537
failCommand();
538538
}
539539

‎packages/cli/src/commands/lambda.ts‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ export default defineCommand({
126126
description:
127127
"Output resolution preset that engages Chrome deviceScaleFactor supersampling. Accepts canonical names (landscape, landscape-4k, portrait, portrait-4k, square, square-4k) and aliases (1080p, 4k, uhd, hd). When set, the composition's authored data-width/data-height is supersampled to the target preset without changing the layout.",
128128
},
129-
fps: { type: "string", description: "Render fps (24 | 30 | 60)" },
129+
fps: { type: "string", description: "Render fps (24 | 25 | 30 | 60)" },
130130
format: { type: "string", description: "mp4 | mov | png-sequence | webm (default: mp4)" },
131131
codec: { type: "string", description: "h264 | h265 (mp4 only)" },
132132
quality: { type: "string", description: "draft | standard | high" },
@@ -298,10 +298,10 @@ export default defineCommand({
298298
}
299299
const fpsRaw =
300300
parseIntFlag(args.fps) ??
301-
readAllowedCompositionFpsFromDir(projectDir, [24, 30, 60]) ??
301+
readAllowedCompositionFpsFromDir(projectDir, [24, 25, 30, 60]) ??
302302
30;
303-
if (fpsRaw !== 24 && fpsRaw !== 30 && fpsRaw !== 60) {
304-
console.error(`[lambda render] --fps must be 24, 30, or 60; got ${fpsRaw}.`);
303+
if (fpsRaw !== 24 && fpsRaw !== 25 && fpsRaw !== 30 && fpsRaw !== 60) {
304+
console.error(`[lambda render] --fps must be 24, 25, 30, or 60; got ${fpsRaw}.`);
305305
failCommand();
306306
}
307307
const { runRender } = await import("./lambda/render.js");
@@ -355,10 +355,10 @@ export default defineCommand({
355355
}
356356
const fpsRaw =
357357
parseIntFlag(args.fps) ??
358-
readAllowedCompositionFpsFromDir(projectDir, [24, 30, 60]) ??
358+
readAllowedCompositionFpsFromDir(projectDir, [24, 25, 30, 60]) ??
359359
30;
360-
if (fpsRaw !== 24 && fpsRaw !== 30 && fpsRaw !== 60) {
361-
console.error(`[lambda render-batch] --fps must be 24, 30, or 60; got ${fpsRaw}.`);
360+
if (fpsRaw !== 24 && fpsRaw !== 25 && fpsRaw !== 30 && fpsRaw !== 60) {
361+
console.error(`[lambda render-batch] --fps must be 24, 25, 30, or 60; got ${fpsRaw}.`);
362362
failCommand();
363363
}
364364
const { runRenderBatch } = await import("./lambda/render-batch.js");

‎packages/cli/src/commands/lambda/render-batch.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ export interface RenderBatchArgs {
6161
*/
6262
siteId?: string;
6363
/** Composition config — fps/width/height/format required, rest optional. */
64-
fps: 24 | 30 | 60;
64+
fps: 24 | 25 | 30 | 60;
6565
width: number;
6666
height: number;
6767
/** See {@link RenderArgs.outputResolution}. */

‎packages/cli/src/commands/lambda/render.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ export interface RenderArgs {
3232
stackName: string;
3333
siteId?: string;
3434
/** Composition config — fps/width/height/format required, rest optional. */
35-
fps: 24 | 30 | 60;
35+
fps: 24 | 25 | 30 | 60;
3636
width: number;
3737
height: number;
3838
/**

‎packages/cli/src/utils/compositionFps.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ export function readCompositionFps(html: string): string | null {
3636

3737
/**
3838
* Cloud render backends (Lambda, Cloud Run) accept only an integer fps
39-
* from a small fixed allowed set (currently {24, 30, 60}) — unlike local
39+
* from a small fixed allowed set (currently {24, 25, 30, 60}) — unlike local
4040
* `render`, they can't take an arbitrary/fractional data-fps. Reads
4141
* `<projectDir>/index.html` and returns its declared data-fps as a number
4242
* ONLY when it parses to an integer AND is a member of `allowed`;

0 commit comments

Comments
 (0)