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
@@ -45,6 +45,7 @@ describe("background-removal/pipeline — buildEncoderArgs", () => {
const args = buildEncoderArgs("webm", 1920, 1080, 30, "/tmp/out.webm");
expect(args).toContain("libvpx-vp9");
expect(args).toContain("yuva420p");
expect(args[args.indexOf("-cpu-used") + 1]).toBe("4");
// The alpha_mode metadata must be present; without it Chrome ignores the alpha plane.
const idx = args.indexOf("-metadata:s:v:0");
expect(idx).toBeGreaterThan(-1);
@@ -18,6 +18,7 @@ import { extname } from "node:path";
import { findFFmpeg, findFFprobe, getFFmpegInstallHint } from "../browser/ffmpeg.js";
import { createSession, type Session } from "./inference.js";
import { type Device, type ModelId } from "./manager.js";
import { DEFAULT_VP9_CPU_USED } from "@hyperframes/engine";
export type OutputFormat = "webm" | "mov" | "png";
@@ -159,6 +160,8 @@ export function buildEncoderArgs(
"good",
"-row-mt",
"1",
"-cpu-used",
String(DEFAULT_VP9_CPU_USED),
"-auto-alt-ref",
"0",
"-pix_fmt",