Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion packages/core/src/mediaGradeAnalyzer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ function probeMedia(mediaPath: string, ffprobePath: string): GradeMediaProbe {
"--",
mediaPath,
],
{ encoding: "utf8", timeout: 5_000, stdio: ["ignore", "pipe", "pipe"] },
{ encoding: "utf8", timeout: 5_000, stdio: ["ignore", "pipe", "pipe"], windowsHide: true },
);
const parsed = asRecord(JSON.parse(raw));
const streams = Array.isArray(parsed.streams) ? parsed.streams : [];
Expand Down Expand Up @@ -341,6 +341,7 @@ export function analyzeMediaGrade(
encoding: "utf8",
timeout: Number(process.env.HYPERFRAMES_ANALYZE_TIMEOUT_MS) || DEFAULT_TIMEOUT_MS,
stdio: ["ignore", "pipe", "pipe"],
windowsHide: true,
},
);
return summarizeMediaTreatmentAnalysis(probe, parseMediaTreatmentSignalStats(raw));
Expand Down
4 changes: 4 additions & 0 deletions packages/engine/src/services/browserManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -809,6 +809,10 @@ function probeNvidiaVramMb(): number | null {
timeout: 3000,
encoding: "utf-8",
stdio: ["pipe", "pipe", "pipe"],
// execSync goes through a shell, so without this every probe flashes a
// cmd.exe window on the user's desktop — including on the machines with
// no NVIDIA GPU, where the command only exists to fail.
windowsHide: true,
}).trim();
const mb = parseInt(out.split("\n")[0] ?? "", 10);
if (Number.isFinite(mb) && mb > 0) {
Expand Down
2 changes: 1 addition & 1 deletion packages/producer/src/parity-harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ function writeImageDiff(basePath: string, comparePath: string, outputPath: strin
"[0:v][1:v]blend=all_mode=difference",
outputPath,
],
{ stdio: "pipe" },
{ stdio: "pipe", windowsHide: true },
);
if (ffmpeg.status !== 0) {
const stderr = (ffmpeg.stderr || Buffer.from("")).toString("utf-8");
Expand Down
3 changes: 2 additions & 1 deletion packages/producer/src/plan-parity-analysis.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ function requireCommandSuccess(
encoding: "buffer",
maxBuffer,
stdio: ["ignore", "pipe", "pipe"],
windowsHide: true,
});
if (result.error) throw result.error;
if (result.status !== 0) {
Expand Down Expand Up @@ -218,7 +219,7 @@ async function canonicalPcmAudio(
"s16le",
"-",
],
{ stdio: ["ignore", "pipe", "pipe"] },
{ stdio: ["ignore", "pipe", "pipe"], windowsHide: true },
);
const hash = createHash("sha256");
const stderr: Buffer[] = [];
Expand Down
14 changes: 10 additions & 4 deletions packages/producer/src/regression-harness.ts
Original file line number Diff line number Diff line change
Expand Up @@ -544,6 +544,7 @@ function runFfmpeg(args: string[], label: string): { stdout: Buffer; stderr: str
stdio: ["ignore", "pipe", "pipe"],
maxBuffer: 256 * 1024 * 1024,
encoding: "buffer",
windowsHide: true,
});
const stderr = result.stderr.toString("utf-8");
if (result.status !== 0) {
Expand Down Expand Up @@ -630,10 +631,15 @@ export function psnrAtFrames(
const statsDir = mkdtempSync(join(tmpdir(), "hf-psnr-"));
const statsFile = join(statsDir, "psnr.log");
try {
// ffmpeg treats `:` and `\` in filter option values as syntax, so a temp
// path containing either would break the filtergraph. mkdtemp under
// tmpdir() does not produce those on POSIX, but escape defensively.
const escaped = statsFile.replace(/\\/g, "\\\\").replace(/:/g, "\\:");
// ffmpeg treats `:` and `\` in filter option values as syntax, and a
// filtergraph argument is unescaped TWICE: once when the graph is split
// into filters and their options, then again when the option value itself
// is read. One round of escaping only survives the first pass, so on
// Windows `C:\Users\...` reaches the option parser as `C:\Users\...`,
// whose bare `:` starts a new option and fails the whole graph with
// "No option name near '\Users\...'". Escaping for both passes is a no-op
// on POSIX, where mkdtemp under tmpdir() produces neither character.
const escaped = statsFile.replace(/\\/g, "\\\\\\\\").replace(/:/g, "\\\\:");
const selectExpr = wanted.map((frame) => `eq(n\\,${frame})`).join("+");
const stream = (index: number, label: string) =>
`[${index}:v]select='${selectExpr}',settb=1/1,setpts=N[${label}]`;
Expand Down
4 changes: 3 additions & 1 deletion packages/producer/src/services/mediaTypeTestFixtures.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import { spawnSync } from "node:child_process";

export function synthesizeMediaFixture(args: string[]): void {
const result = spawnSync("ffmpeg", ["-y", "-hide_banner", "-loglevel", "error", ...args]);
const result = spawnSync("ffmpeg", ["-y", "-hide_banner", "-loglevel", "error", ...args], {
windowsHide: true,
});
if (result.status !== 0) {
throw new Error(`ffmpeg fixture synthesis failed: ${result.stderr.toString().slice(-400)}`);
}
Expand Down
5 changes: 4 additions & 1 deletion packages/producer/src/services/render/audioPadTrim.ts
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,10 @@ async function runFfprobeJson<T>(args: string[], signal?: AbortSignal): Promise<
if (!args.includes("--")) {
throw new Error('[audioPadTrim] ffprobe args must terminate options with "--".');
}
const proc = spawn(getFfprobeBinary(), args, { stdio: ["ignore", "pipe", "pipe"] });
const proc = spawn(getFfprobeBinary(), args, {
stdio: ["ignore", "pipe", "pipe"],
windowsHide: true,
});
trackChildProcess(proc);
let stdout = "";
proc.stdout.on("data", (data: Buffer) => {
Expand Down
4 changes: 2 additions & 2 deletions packages/producer/src/utils/audioRegression.ts
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ export function computeAudioResidualRmsDb(
"null",
"-",
],
{ encoding: "utf-8" },
{ encoding: "utf-8", windowsHide: true },
);

// `spawnSync` swallows `ENOENT`, signal kills, and non-zero exits
Expand Down Expand Up @@ -318,7 +318,7 @@ function probeAudioDuration(file: string): { seconds: number; error?: string } {
"--",
file,
],
{ encoding: "utf-8" },
{ encoding: "utf-8", windowsHide: true },
);
if (proc.error) {
return {
Expand Down