Skip to content

Commit 98e7743

Browse files
feat(cli): doctor names the tested ffmpeg build and says loudness is only comparable on it (#6566)
* feat(cli): doctor names the tested ffmpeg build and says loudness is only comparable on it * style(cli): format the doctor ffmpeg note * fix(cli): drop the doctor ffmpeg comments the comment ratchet counts * style(cli): format the doctor ffmpeg match
1 parent 8cd9c51 commit 98e7743

2 files changed

Lines changed: 51 additions & 2 deletions

File tree

‎packages/cli/src/commands/doctor.test.ts‎

Lines changed: 39 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,21 @@
1-
import { existsSync, mkdirSync, mkdtempSync, rmSync, utimesSync, writeFileSync } from "node:fs";
1+
import {
2+
existsSync,
3+
mkdirSync,
4+
mkdtempSync,
5+
readFileSync,
6+
rmSync,
7+
utimesSync,
8+
writeFileSync,
9+
} from "node:fs";
210
import { tmpdir } from "node:os";
311
import { join } from "node:path";
412
import { pathToFileURL } from "node:url";
513
import { describe, it, expect, beforeEach, afterEach } from "vitest";
614
import { optionalPackageDir } from "../utils/optionalPackages.js";
715
import {
16+
TESTED_FFMPEG_VERSION,
817
buildDoctorReport,
18+
ffmpegDoctorDetail,
919
checkFramesCache,
1020
checkOptionalPackage,
1121
redactHome,
@@ -347,3 +357,31 @@ describe("checkSettingsLock", () => {
347357
}
348358
});
349359
});
360+
361+
describe("ffmpegDoctorDetail", () => {
362+
it("marks the tested build and warns on any other", () => {
363+
expect(ffmpegDoctorDetail(`ffmpeg n${TESTED_FFMPEG_VERSION}-66-gabc`)).toContain(
364+
"(tested build)",
365+
);
366+
for (const other of [
367+
"ffmpeg 7.0.2-static",
368+
`ffmpeg 7.1 at ~/ffmpeg-${TESTED_FFMPEG_VERSION}/bin/ffmpeg`,
369+
`ffmpeg ${TESTED_FFMPEG_VERSION}0-static`,
370+
]) {
371+
expect(ffmpegDoctorDetail(other)).toContain(`only comparable on ${TESTED_FFMPEG_VERSION}`);
372+
}
373+
});
374+
375+
it("names the build CI and the render images pin", () => {
376+
const root = join(__dirname, "../../../..");
377+
for (const f of [
378+
".github/actions/install-ffmpeg-linux/action.yml",
379+
"packages/cli/src/docker/Dockerfile.render",
380+
"packages/gcp-cloud-run/Dockerfile",
381+
"Dockerfile.test",
382+
"examples/k8s-jobs/Dockerfile.example",
383+
]) {
384+
expect(readFileSync(join(root, f), "utf8")).toContain(`n${TESTED_FFMPEG_VERSION}-`);
385+
}
386+
});
387+
});

‎packages/cli/src/commands/doctor.ts‎

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,16 @@ interface CheckResult {
4646

4747
export { parseToolVersion };
4848

49+
export const TESTED_FFMPEG_VERSION = "8.0.1";
50+
51+
export function ffmpegDoctorDetail(detail: string): string {
52+
return new RegExp(`^ffmpeg n?${TESTED_FFMPEG_VERSION.replaceAll(".", "\\.")}(?![.\\d])`).test(
53+
detail,
54+
)
55+
? `${detail} (tested build)`
56+
: `${detail}; loudness numbers are only comparable on ${TESTED_FFMPEG_VERSION}`;
57+
}
58+
4959
function checkDocker(): CheckResult {
5060
try {
5161
const version = execSync("docker --version", { encoding: "utf-8", timeout: 5000 }).trim();
@@ -406,7 +416,8 @@ export default defineCommand({
406416
outcomes.push({
407417
name: result.name,
408418
ok: result.ok,
409-
detail: result.detail,
419+
detail:
420+
result.name === "FFmpeg" && result.ok ? ffmpegDoctorDetail(result.detail) : result.detail,
410421
...(result.hint ? { hint: result.hint } : {}),
411422
});
412423
}

0 commit comments

Comments
 (0)