feat(engine): render sets a keyframe interval and a peak bitrate cap (#6444)

* feat(engine): encoders cap peak bitrate and place keyframes on a set interval

* style(engine): shorten the rate-cap comment

* style(engine): drop the doc lines the comment ratchet flagged

* feat(producer): mp4 renders honour a keyframe interval and a peak bitrate cap on every encoder path

* style(producer): shorten the delivery encoder file headers

* style(producer): drop a comment line from the segment manifest

* style(producer): shorten the integration test header

* test: delivery encoder tests follow the ffprobe argv contract and run in the integration lane

* feat: the render request, server and Lambda plan carry the keyframe interval and peak bitrate cap

* fix(studio): the Studio render route passes the keyframe interval and bitrate cap to the encoder

* chore(studio-server): drop a comment the helper's name already says

* feat(cli): render and lambda render take --keyframe-interval, --max-bitrate and --buffer-size
This commit is contained in:
Miguel Ángel
2026-10-27 00:29:06 +00:00
committed by GitHub
parent 95e3930faf
commit 54d0af57eb
50 changed files with 1101 additions and 38 deletions
@@ -168,6 +168,12 @@ describe("buildLambdaBatchRenderConfig — aspect-agnostic wire threading", () =
expect(config.outputResolutionAspectAgnostic).toBeUndefined();
});
it("sends the delivery options to every batch entry", () => {
expect(
buildLambdaBatchRenderConfig({ ...baseArgs, keyframeIntervalSeconds: 2, maxBitrate: "8M" }),
).toMatchObject({ keyframeIntervalSeconds: 2, maxBitrate: "8M" });
});
it("hands the deploy's reserved concurrency to the planner", () => {
expect(buildLambdaBatchRenderConfig(baseArgs, 64).workerConcurrency).toBe(64);
});
@@ -41,6 +41,7 @@ import { normalizeErrorMessage } from "../../utils/errorMessage.js";
import { resolveOutputResolutionFromSize } from "./_dimensions.js";
import { runWithConcurrencyLimit } from "../../utils/concurrency.js";
import { requireStack } from "./state.js";
import type { DeliveryFlagValues } from "../../utils/deliveryFlags.js";
// Dynamic-import the SDK so tsup keeps it out of the static-import head of
// the CLI bundle. See sites.ts loadSDK() for the full rationale.
@@ -49,7 +50,7 @@ async function loadSDK(): Promise<typeof import("@hyperframes/aws-lambda/sdk")>
}
/** Arguments accepted by `hyperframes lambda render-batch`. */
export interface RenderBatchArgs {
export interface RenderBatchArgs extends DeliveryFlagValues {
projectDir: string;
stackName: string;
/** Path to the JSONL batch file. Each line is a {@link BatchEntry}. */
@@ -361,6 +362,9 @@ export function buildLambdaBatchRenderConfig(
chunkSize: args.chunkSize,
maxParallelChunks: args.maxParallelChunks,
targetChunkFrames: args.targetChunkFrames,
keyframeIntervalSeconds: args.keyframeIntervalSeconds,
maxBitrate: args.maxBitrate,
bufferSize: args.bufferSize,
workerConcurrency,
runtimeCap: "lambda",
};
@@ -51,6 +51,21 @@ describe("buildLambdaRenderConfig — aspect-agnostic wire threading", () => {
expect(config.outputResolutionAspectAgnostic).toBeUndefined();
});
it("sends the delivery options on the wire and nothing when they are unset", () => {
const config = buildLambdaRenderConfig(
{ ...BASE_ARGS, keyframeIntervalSeconds: 2, maxBitrate: "8M", bufferSize: "12M" },
undefined,
);
expect(config).toMatchObject({
keyframeIntervalSeconds: 2,
maxBitrate: "8M",
bufferSize: "12M",
});
expect(
JSON.parse(JSON.stringify(buildLambdaRenderConfig(BASE_ARGS, undefined))),
).not.toHaveProperty("maxBitrate");
});
it("carries variables verbatim through the wire config", () => {
const config = buildLambdaRenderConfig(BASE_ARGS, { alice: "hello" });
expect(config.variables).toEqual({ alice: "hello" });
+5 -1
View File
@@ -13,6 +13,7 @@ import type {
} from "@hyperframes/aws-lambda/sdk";
import type { CanvasResolution, DistributedFps } from "@hyperframes/core";
import { c } from "../../ui/colors.js";
import type { DeliveryFlagValues } from "../../utils/deliveryFlags.js";
import {
reportVariableIssues,
resolveVariablesArg,
@@ -27,7 +28,7 @@ async function loadSDK(): Promise<typeof import("@hyperframes/aws-lambda/sdk")>
return import("@hyperframes/aws-lambda/sdk");
}
export interface RenderArgs {
export interface RenderArgs extends DeliveryFlagValues {
projectDir: string;
stackName: string;
siteId?: string;
@@ -255,6 +256,9 @@ export function buildLambdaRenderConfig(
chunkSize: args.chunkSize,
maxParallelChunks: args.maxParallelChunks,
targetChunkFrames: args.targetChunkFrames,
keyframeIntervalSeconds: args.keyframeIntervalSeconds,
maxBitrate: args.maxBitrate,
bufferSize: args.bufferSize,
workerConcurrency,
runtimeCap: "lambda",
variables,