fix(engine): skip unnecessary dimension pad (#2398)

This commit is contained in:
Miguel Ángel
2026-07-14 00:42:16 -04:00
committed by GitHub
parent 90be05019b
commit 0dfc85b680
6 changed files with 89 additions and 10 deletions
+10 -2
View File
@@ -417,14 +417,22 @@ export function buildEncoderArgs(
// encoder with no `-vf`. They hit the same "height not divisible by 2"
// abort as libx264 on an odd-sized 4:2:0 canvas, so pad odd dimensions
// up to even on the software side before the encode.
const vf = withEvenDimensionPad("", pixelFormat);
const vf = withEvenDimensionPad("", pixelFormat, options.width, options.height);
if (vf) args.push("-vf", vf);
} else {
// Range conversion: Chrome screenshots are full-range RGB.
// The scale filter handles both 8-bit and 10-bit correctly. Pad odd
// dimensions up to even so libx264/libx265 (4:2:0) don't abort with
// "height not divisible by 2" on an odd-sized composition canvas.
args.push("-vf", withEvenDimensionPad("scale=in_range=pc:out_range=tv", pixelFormat));
args.push(
"-vf",
withEvenDimensionPad(
"scale=in_range=pc:out_range=tv",
pixelFormat,
options.width,
options.height,
),
);
}
// Fixed timescale for consistent A/V timing across platforms.