From be05c86932be215ec70621dc568af96415555fa0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miguel=20=C3=81ngel?= Date: Thu, 29 Oct 2026 06:40:21 +0000 Subject: [PATCH] perf(engine): encode high quality with the x264 fast preset (#6640) * perf(engine): encode high quality with the x264 fast preset * test(engine): name the NVENC p5 case by its preset, not the high tier --- packages/engine/src/services/chunkEncoder.test.ts | 6 +++--- packages/engine/src/services/chunkEncoder.ts | 2 +- packages/producer/src/services/distributed/assemble.test.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/packages/engine/src/services/chunkEncoder.test.ts b/packages/engine/src/services/chunkEncoder.test.ts index f6ae92b7ab..cdf04fd263 100644 --- a/packages/engine/src/services/chunkEncoder.test.ts +++ b/packages/engine/src/services/chunkEncoder.test.ts @@ -130,8 +130,8 @@ describe("ENCODER_PRESETS", () => { expect(ENCODER_PRESETS.draft.codec).toBe("h264"); }); - it("high uses slow preset with low CRF for better quality", () => { - expect(ENCODER_PRESETS.high.preset).toBe("slow"); + it("high uses the fast preset with low CRF for better quality", () => { + expect(ENCODER_PRESETS.high.preset).toBe("fast"); expect(ENCODER_PRESETS.high.quality).toBeLessThan(ENCODER_PRESETS.standard.quality); expect(ENCODER_PRESETS.high.codec).toBe("h264"); }); @@ -1071,7 +1071,7 @@ describe("buildEncoderArgs GPU preset mapping", () => { expect(presetArg(args)).toBe("p4"); }); - it("translates the high slow preset to NVENC p5", () => { + it("translates the slow preset to NVENC p5", () => { const args = buildEncoderArgs( { ...baseOptions, codec: "h264", preset: "slow", quality: 15, useGpu: true }, inputArgs, diff --git a/packages/engine/src/services/chunkEncoder.ts b/packages/engine/src/services/chunkEncoder.ts index 77c762aaf7..f3a598a73f 100644 --- a/packages/engine/src/services/chunkEncoder.ts +++ b/packages/engine/src/services/chunkEncoder.ts @@ -55,7 +55,7 @@ export type { EncoderOptions, EncodeResult, MuxResult } from "./chunkEncoder.typ export const ENCODER_PRESETS = { draft: { preset: "ultrafast", quality: 28, codec: "h264" as const }, standard: { preset: "medium", quality: 18, codec: "h264" as const }, - high: { preset: "slow", quality: 15, codec: "h264" as const }, + high: { preset: "fast", quality: 15, codec: "h264" as const }, }; export interface EncoderPreset { diff --git a/packages/producer/src/services/distributed/assemble.test.ts b/packages/producer/src/services/distributed/assemble.test.ts index eee102dc5d..4f654757f1 100644 --- a/packages/producer/src/services/distributed/assemble.test.ts +++ b/packages/producer/src/services/distributed/assemble.test.ts @@ -684,7 +684,7 @@ describe("assemble()", () => { it("cfr re-encode keeps the chunks' rate control", () => { expect(cfrRateControlArgs({})).toEqual(["-preset", "medium", "-crf", "18"]); - expect(cfrRateControlArgs({ quality: "high" })).toEqual(["-preset", "slow", "-crf", "15"]); + expect(cfrRateControlArgs({ quality: "high" })).toEqual(["-preset", "fast", "-crf", "15"]); expect(cfrRateControlArgs({ quality: "standard", crf: 12 })).toEqual([ "-preset", "medium",