fix(engine): tune VP9 cpu-used across render paths (#1614)

* fix(engine): tune VP9 cpu-used across render paths

* fix: address VP9 review feedback
This commit is contained in:
Miguel Ángel
2026-06-20 16:36:59 -04:00
committed by GitHub
parent d6135ca155
commit 8408a44745
30 changed files with 273 additions and 26 deletions
@@ -50,6 +50,15 @@ const baseSdr: StreamingEncoderOptions = {
useGpu: false,
};
const baseVp9 = {
...baseSdr,
codec: "vp9" as const,
preset: "good",
quality: 18,
pixelFormat: "yuva420p",
imageFormat: "png" as const,
};
function getX265ParamsValue(args: string[]): string | undefined {
const idx = args.indexOf("-x265-params");
return idx === -1 ? undefined : args[idx + 1];
@@ -166,6 +175,21 @@ describe("buildStreamingArgs", () => {
});
});
describe("VP9 cpu-used", () => {
it("emits the default speed/quality tradeoff for streaming WebM", () => {
const args = buildStreamingArgs(baseVp9, "/tmp/out.webm");
expect(args[args.indexOf("-c:v") + 1]).toBe("libvpx-vp9");
expect(args[args.indexOf("-cpu-used") + 1]).toBe("4");
});
it("honors the resolved engine override for streaming WebM", () => {
const args = buildStreamingArgs({ ...baseVp9, vp9CpuUsed: 2 }, "/tmp/out.webm");
expect(args[args.indexOf("-cpu-used") + 1]).toBe("2");
});
});
describe("fps rational forwarding", () => {
// Regression for the fps fraction-syntax feature: both `-framerate`
// (input timestamping) and `-r` (output framerate) must carry the