@camstack/types 1.2.227 → 1.2.229
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/capabilities/device-manager.cap.d.ts +5 -0
- package/dist/capabilities/pipeline-orchestrator.cap.d.ts +6 -0
- package/dist/deps/binary-downloader.d.ts +12 -0
- package/dist/deps/ffmpeg-artifacts.d.ts +66 -0
- package/dist/deps/ffmpeg-binary-source.d.ts +43 -45
- package/dist/deps/ffmpeg-downloader.d.ts +12 -41
- package/dist/deps/index.d.ts +2 -1
- package/dist/index.js +21 -1
- package/dist/index.mjs +21 -2
- package/dist/interfaces/camera-switches.d.ts +10 -0
- package/dist/node.d.ts +2 -1
- package/dist/node.js +216 -119
- package/dist/node.mjs +216 -120
- package/package.json +1 -1
package/dist/node.mjs
CHANGED
|
@@ -50,6 +50,23 @@ function findInPath(name) {
|
|
|
50
50
|
}
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
|
+
* Refuse an artifact that is not the one we pinned, and leave nothing behind.
|
|
54
|
+
*
|
|
55
|
+
* The failure is deliberately loud and terminal rather than a warning: a
|
|
56
|
+
* mismatch means the bytes are not what was verified, and "not what was
|
|
57
|
+
* verified" is the only state in which running this binary is worse than not
|
|
58
|
+
* having it. The partial file is removed so a retry cannot pick it up.
|
|
59
|
+
*/
|
|
60
|
+
function verifyChecksum(file, expected, name, url) {
|
|
61
|
+
if (expected === void 0) return;
|
|
62
|
+
const actual = createHash("sha256").update(readFileSync(file)).digest("hex");
|
|
63
|
+
if (actual === expected) return;
|
|
64
|
+
try {
|
|
65
|
+
unlinkSync(file);
|
|
66
|
+
} catch {}
|
|
67
|
+
throw new Error(`${name}: downloaded artifact does not match its pinned checksum — refusing it. url=${url} expected=${expected} actual=${actual}`);
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
53
70
|
* Download a binary to the target directory.
|
|
54
71
|
* Handles archives (zip, tar.gz, tar.xz) and raw binaries.
|
|
55
72
|
*/
|
|
@@ -74,6 +91,7 @@ async function downloadBinary(opts) {
|
|
|
74
91
|
const ext = archiveFormat ?? "tar.gz";
|
|
75
92
|
const tmpArchive = join(targetDir, `${name}-download.${ext}`);
|
|
76
93
|
await pipeline(Readable.fromWeb(response.body), createWriteStream(tmpArchive));
|
|
94
|
+
verifyChecksum(tmpArchive, opts.sha256, name, url);
|
|
77
95
|
const tmpExtractDir = join(targetDir, `${name}-extract`);
|
|
78
96
|
mkdirSync(tmpExtractDir, { recursive: true });
|
|
79
97
|
if (ext === "zip") try {
|
|
@@ -120,7 +138,10 @@ async function downloadBinary(opts) {
|
|
|
120
138
|
recursive: true,
|
|
121
139
|
force: true
|
|
122
140
|
});
|
|
123
|
-
} else
|
|
141
|
+
} else {
|
|
142
|
+
await pipeline(Readable.fromWeb(response.body), createWriteStream(targetPath));
|
|
143
|
+
verifyChecksum(targetPath, opts.sha256, name, url);
|
|
144
|
+
}
|
|
124
145
|
chmodSync(targetPath, 493);
|
|
125
146
|
logger.info("Binary downloaded", { meta: {
|
|
126
147
|
name,
|
|
@@ -271,64 +292,177 @@ async function probeFfmpegBinary(path) {
|
|
|
271
292
|
return parseFfmpegCapabilities(path, versionOut, hwaccelOut, encoderOut);
|
|
272
293
|
}
|
|
273
294
|
//#endregion
|
|
295
|
+
//#region src/deps/ffmpeg-artifacts.ts
|
|
296
|
+
/**
|
|
297
|
+
* The ffmpeg build every CamStack node downloads, per platform and arch.
|
|
298
|
+
*
|
|
299
|
+
* ## Why a download, on every node, including the container
|
|
300
|
+
*
|
|
301
|
+
* The version of ffmpeg used to be CODE: baked into the image, changeable only
|
|
302
|
+
* by rebuilding and rolling it. Now it is DATA — this file states the release,
|
|
303
|
+
* and a node that boots with a different one downloads it. Changing ffmpeg is a
|
|
304
|
+
* framework bump, not an image rebuild.
|
|
305
|
+
*
|
|
306
|
+
* It also settles the licence question by removing it. FFmpeg's licence is
|
|
307
|
+
* chosen at compile time: the core is LGPL 2.1+, `--enable-gpl` makes it GPL
|
|
308
|
+
* (for x264/x265), `--enable-version3` makes that v3, and `--enable-nonfree`
|
|
309
|
+
* makes the result undistributable. These are GPL v3 builds, and we do not
|
|
310
|
+
* distribute them: the user's own node fetches the archive from the project
|
|
311
|
+
* that publishes it, so we convey no GPL work and inherit none of the
|
|
312
|
+
* obligations that come with conveying one. That is the whole reason the image
|
|
313
|
+
* no longer installs ffmpeg at all — not a technical preference.
|
|
314
|
+
*
|
|
315
|
+
* ## Why jellyfin-ffmpeg
|
|
316
|
+
*
|
|
317
|
+
* One vendor covering linux-amd64, linux-arm64, darwin-arm64 and darwin-x64
|
|
318
|
+
* from one release, with the widest hardware surface of anything maintained:
|
|
319
|
+
* VAAPI, QSV, NVENC/NVDEC, AMF, Vulkan, OpenCL and DRM on amd64, plus Rockchip
|
|
320
|
+
* MPP on arm64. It reaches the vendor libraries through dlopen trampolines,
|
|
321
|
+
* so the binary is not linked against a driver stack it may not find.
|
|
322
|
+
*
|
|
323
|
+
* **What it still needs from the host, measured 2026-09-19.** On the Unraid
|
|
324
|
+
* HOST, which has no libva, `-vaapi_device` aborts the process outright —
|
|
325
|
+
* `implib-gen: libva-drm.so.2: failed to load library ... Assertion '0 &&
|
|
326
|
+
* "Assertion in generated code"' failed`. Inside our container, which installs
|
|
327
|
+
* libva plus the iHD driver, the same command encodes: verified end to end with
|
|
328
|
+
* `testsrc → format=nv12,hwupload → h264_vaapi`. So the image drops ffmpeg and
|
|
329
|
+
* KEEPS the Intel media stack; the drivers are the part a binary cannot bring.
|
|
330
|
+
*
|
|
331
|
+
* ## Why each artifact carries a checksum and a claim
|
|
332
|
+
*
|
|
333
|
+
* The download is now the only source, so `sha256` is verified before anything
|
|
334
|
+
* is extracted — jellyfin publishes no checksums on its release assets, so
|
|
335
|
+
* these are ours, taken at the version bump. And `expectedHwaccels` is what the
|
|
336
|
+
* build is supposed to be able to do: a binary that probes short of its own
|
|
337
|
+
* claim is a source that changed under us, which is precisely what went
|
|
338
|
+
* unnoticed for months when a static build turned out to carry no VAAPI at all
|
|
339
|
+
* (D536).
|
|
340
|
+
*/
|
|
341
|
+
/** The pinned jellyfin-ffmpeg release. Changing this is the version change. */
|
|
342
|
+
var FFMPEG_RELEASE = "8.1.2-5";
|
|
343
|
+
var BASE = `https://github.com/jellyfin/jellyfin-ffmpeg/releases/download/v${FFMPEG_RELEASE}`;
|
|
344
|
+
function portable(target) {
|
|
345
|
+
return `${BASE}/jellyfin-ffmpeg_${FFMPEG_RELEASE}_portable_${target}-gpl.tar.xz`;
|
|
346
|
+
}
|
|
347
|
+
/**
|
|
348
|
+
* Every artifact below was fetched and hashed on 2026-09-19, and each one's
|
|
349
|
+
* capability claim was verified by RUNNING it: the linux64 build on the hub
|
|
350
|
+
* itself, the two macOS builds on an M-series Mac (the x86_64 one under
|
|
351
|
+
* Rosetta, which translates x86 to arm — never the reverse, which is why the
|
|
352
|
+
* darwin split matters at all).
|
|
353
|
+
*
|
|
354
|
+
* linux-arm64 is hashed but NOT executed — there is no arm64 Linux node in
|
|
355
|
+
* this cluster yet. Its claim is taken from the project's build script, so the
|
|
356
|
+
* first ARM node to boot will either confirm it or trip the assertion, which is
|
|
357
|
+
* the outcome the assertion exists for.
|
|
358
|
+
*/
|
|
359
|
+
var FFMPEG_ARTIFACTS = {
|
|
360
|
+
"linux-x64": {
|
|
361
|
+
url: portable("linux64"),
|
|
362
|
+
archiveFormat: "tar.xz",
|
|
363
|
+
sha256: "1fd859927053c44a4f2dbf67ae8b9ba8d29fb3b8930df0dd57d91aa60589363d",
|
|
364
|
+
sizeBytes: 60255400,
|
|
365
|
+
expectedHwaccels: [
|
|
366
|
+
"vaapi",
|
|
367
|
+
"qsv",
|
|
368
|
+
"drm",
|
|
369
|
+
"vulkan",
|
|
370
|
+
"opencl"
|
|
371
|
+
]
|
|
372
|
+
},
|
|
373
|
+
"linux-arm64": {
|
|
374
|
+
url: portable("linuxarm64"),
|
|
375
|
+
archiveFormat: "tar.xz",
|
|
376
|
+
sha256: "1bd4fafaf4c309cad896d3479152c31d6b7604d4be8b8526882ea16cc6d5f589",
|
|
377
|
+
sizeBytes: 53958064,
|
|
378
|
+
expectedHwaccels: ["vaapi", "drm"]
|
|
379
|
+
},
|
|
380
|
+
"darwin-arm64": {
|
|
381
|
+
url: portable("macarm64"),
|
|
382
|
+
archiveFormat: "tar.xz",
|
|
383
|
+
sha256: "b2ac80bb184e9a2f3f7c236876b2f56a5639596a95b42f41ced34fab66ad720d",
|
|
384
|
+
sizeBytes: 32896684,
|
|
385
|
+
expectedHwaccels: ["videotoolbox"]
|
|
386
|
+
},
|
|
387
|
+
"darwin-x64": {
|
|
388
|
+
url: portable("mac64"),
|
|
389
|
+
archiveFormat: "tar.xz",
|
|
390
|
+
sha256: "021cd321ea169722cd2e4aca35884305449666a0d231d3378af7f87d6a5626e5",
|
|
391
|
+
sizeBytes: 37852180,
|
|
392
|
+
expectedHwaccels: ["videotoolbox"]
|
|
393
|
+
}
|
|
394
|
+
};
|
|
395
|
+
/** The artifact for this node, or a refusal naming what was asked for. */
|
|
396
|
+
function getFfmpegArtifact(platform, arch) {
|
|
397
|
+
const artifact = FFMPEG_ARTIFACTS[`${platform}-${arch}`];
|
|
398
|
+
if (!artifact) throw new Error(`Unsupported platform/architecture for ffmpeg: ${platform}-${arch}. Point CAMSTACK_FFMPEG_PATH at a binary this node can run.`);
|
|
399
|
+
return artifact;
|
|
400
|
+
}
|
|
401
|
+
/** The URL alone, for a caller that wants nothing else. */
|
|
402
|
+
function getFfmpegDownloadUrl(platform, arch) {
|
|
403
|
+
return getFfmpegArtifact(platform, arch).url;
|
|
404
|
+
}
|
|
405
|
+
//#endregion
|
|
274
406
|
//#region src/deps/ffmpeg-binary-source.ts
|
|
275
407
|
/**
|
|
276
|
-
* WHICH ffmpeg a node runs
|
|
408
|
+
* WHICH ffmpeg a node runs — one rule, on every node.
|
|
277
409
|
*
|
|
278
|
-
*
|
|
279
|
-
* WebRTC transcode leg, the recorder, snapshots and the camera grid. What that
|
|
280
|
-
* binary is compiled with decides whether any of them can use the machine's
|
|
281
|
-
* hardware, so it is not a detail to leave to whatever the host happens to have
|
|
282
|
-
* on its PATH:
|
|
410
|
+
* ## The rule
|
|
283
411
|
*
|
|
284
|
-
*
|
|
285
|
-
*
|
|
286
|
-
*
|
|
412
|
+
* 1. `CAMSTACK_FFMPEG_PATH`, when the operator set it and it exists. Pointing
|
|
413
|
+
* at your own build is a deliberate act and it wins over everything.
|
|
414
|
+
* 2. The pinned build this node has already downloaded, named by release
|
|
415
|
+
* (`ffmpeg-<release>`), in `<dataDir>/deps`.
|
|
416
|
+
* 3. Nothing — the caller downloads it. See `ffmpeg-artifacts.ts`.
|
|
287
417
|
*
|
|
288
|
-
*
|
|
289
|
-
*
|
|
418
|
+
* The system PATH is not on that list and must never be. A host binary is an
|
|
419
|
+
* unknown version with unknown vendor libraries, and it changes under us on any
|
|
420
|
+
* host update; a self-hosted NVR cannot assume the host has ffmpeg at all
|
|
421
|
+
* (D536).
|
|
290
422
|
*
|
|
291
|
-
*
|
|
292
|
-
* | --- | --- |
|
|
293
|
-
* | our container image | {@link BUNDLED_FFMPEG_PATH}, installed by the image |
|
|
294
|
-
* | anything else (a native macOS agent) | the static build we download into `<dataDir>/deps` |
|
|
423
|
+
* ## Why the container image is not special any more
|
|
295
424
|
*
|
|
296
|
-
*
|
|
297
|
-
*
|
|
298
|
-
*
|
|
299
|
-
*
|
|
300
|
-
* write can.
|
|
425
|
+
* It was, for one day: the image installed ffmpeg, CamStack preferred it, and
|
|
426
|
+
* that made the answer depend on where a node ran — an image node got VAAPI, a
|
|
427
|
+
* native one got a portable build with none. Now every node downloads the same
|
|
428
|
+
* pinned build, so:
|
|
301
429
|
*
|
|
302
|
-
*
|
|
303
|
-
*
|
|
304
|
-
*
|
|
305
|
-
*
|
|
430
|
+
* - the ffmpeg version is DATA, not code: changing it is a framework bump, not
|
|
431
|
+
* an image rebuild and a container swap on every machine;
|
|
432
|
+
* - we ship no ffmpeg binary, so we convey no GPL work — the node fetches it
|
|
433
|
+
* from the project that publishes it;
|
|
434
|
+
* - one binary, one set of capabilities, everywhere. A bug that depends on
|
|
435
|
+
* which ffmpeg answered stops being possible.
|
|
306
436
|
*
|
|
307
|
-
*
|
|
308
|
-
*
|
|
309
|
-
*
|
|
310
|
-
*
|
|
437
|
+
* What the image still owes is the DRIVERS, which no binary can bring: libva
|
|
438
|
+
* plus the iHD media driver for Intel. Measured 2026-09-19 — the portable build
|
|
439
|
+
* encodes VAAPI inside our container and ABORTS on the bare Unraid host, where
|
|
440
|
+
* `libva-drm.so.2` does not exist.
|
|
311
441
|
*
|
|
312
|
-
*
|
|
313
|
-
* `Device creation failed: -12` — the name parses, the device cannot exist —
|
|
314
|
-
* then transcodes in software with nothing naming the cause.
|
|
442
|
+
* ## Absent is absent
|
|
315
443
|
*
|
|
316
|
-
*
|
|
317
|
-
*
|
|
318
|
-
* sets it.
|
|
444
|
+
* The naming carries the release, so two versions coexist during a change and a
|
|
445
|
+
* rollback is a file that is already on disk rather than a download.
|
|
319
446
|
*/
|
|
320
|
-
/** Where our container image puts the ffmpeg it installs. Only the image writes this. */
|
|
321
|
-
var BUNDLED_FFMPEG_PATH = "/opt/camstack/bin/ffmpeg";
|
|
322
447
|
/** Operator override. Unset on every node unless a human deliberately set it. */
|
|
323
448
|
var FFMPEG_PATH_ENV = "CAMSTACK_FFMPEG_PATH";
|
|
324
449
|
/**
|
|
325
|
-
* The
|
|
326
|
-
*
|
|
450
|
+
* The file name the pinned build is stored under.
|
|
451
|
+
*
|
|
452
|
+
* Versioned on purpose: a download is then idempotent, two releases can sit
|
|
453
|
+
* side by side while a change rolls through a cluster, and going back is a path
|
|
454
|
+
* that already exists instead of a fetch that has to succeed.
|
|
455
|
+
*/
|
|
456
|
+
function ffmpegBinaryName(platform) {
|
|
457
|
+
return `ffmpeg-${FFMPEG_RELEASE}${platform === "win32" ? ".exe" : ""}`;
|
|
458
|
+
}
|
|
459
|
+
/**
|
|
460
|
+
* The binary to use, or `null` when it has to be downloaded first.
|
|
327
461
|
*
|
|
328
462
|
* An override that does not exist is NOT silently skipped — it is an operator
|
|
329
463
|
* mistake, and falling through to a different binary than the one they named
|
|
330
|
-
* would hide it. The caller reports it and carries on with the
|
|
331
|
-
* is the only safe direction: a typo must not stop a node
|
|
464
|
+
* would hide it. The caller reports it and carries on with the pinned build,
|
|
465
|
+
* which is the only safe direction: a typo must not stop a node serving video.
|
|
332
466
|
*/
|
|
333
467
|
function chooseFfmpegBinary(input) {
|
|
334
468
|
const override = input.override?.trim() ?? "";
|
|
@@ -336,121 +470,83 @@ function chooseFfmpegBinary(input) {
|
|
|
336
470
|
origin: "override",
|
|
337
471
|
path: override
|
|
338
472
|
};
|
|
339
|
-
|
|
340
|
-
if (bundled !== null && input.exists(bundled)) return {
|
|
341
|
-
origin: "bundled",
|
|
342
|
-
path: bundled
|
|
343
|
-
};
|
|
344
|
-
if (input.exists(input.downloadedPath)) return {
|
|
473
|
+
if (input.exists(input.pinnedPath)) return {
|
|
345
474
|
origin: "downloaded",
|
|
346
|
-
path: input.
|
|
475
|
+
path: input.pinnedPath
|
|
347
476
|
};
|
|
348
477
|
return null;
|
|
349
478
|
}
|
|
350
|
-
/** The image-provided path for a platform, or `null` where we ship no image. */
|
|
351
|
-
function bundledFfmpegPath(platform) {
|
|
352
|
-
return platform === "linux" ? BUNDLED_FFMPEG_PATH : null;
|
|
353
|
-
}
|
|
354
479
|
//#endregion
|
|
355
480
|
//#region src/deps/ffmpeg-downloader.ts
|
|
356
481
|
/**
|
|
357
|
-
*
|
|
358
|
-
* provided one.
|
|
359
|
-
*
|
|
360
|
-
* Which binary, and why it is never the host's, is in `ffmpeg-binary-source.ts`.
|
|
361
|
-
* This module is the download half: the URLs, and the resolution that reports
|
|
362
|
-
* what it picked.
|
|
482
|
+
* Provisioning the ffmpeg binary for this node.
|
|
363
483
|
*
|
|
364
|
-
*
|
|
365
|
-
*
|
|
366
|
-
* -
|
|
484
|
+
* WHICH build, and why every node downloads the same one instead of using
|
|
485
|
+
* anything the machine already has, is in `ffmpeg-binary-source.ts` and
|
|
486
|
+
* `ffmpeg-artifacts.ts`. This module is the act: resolve, download if needed,
|
|
487
|
+
* probe, and say what it got.
|
|
367
488
|
*/
|
|
368
489
|
/**
|
|
369
|
-
*
|
|
370
|
-
*
|
|
371
|
-
*
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
},
|
|
384
|
-
"darwin-arm64": {
|
|
385
|
-
url: "https://www.osxexperts.net/ffmpeg71arm.zip",
|
|
386
|
-
archiveFormat: "zip",
|
|
387
|
-
expectedHwaccels: ["videotoolbox"]
|
|
388
|
-
},
|
|
389
|
-
"darwin-x64": {
|
|
390
|
-
url: "https://www.osxexperts.net/ffmpeg80intel.zip",
|
|
391
|
-
archiveFormat: "zip",
|
|
392
|
-
expectedHwaccels: ["videotoolbox"]
|
|
393
|
-
}
|
|
394
|
-
};
|
|
395
|
-
/** The artifact for this node, or a refusal naming what was asked for. */
|
|
396
|
-
function getFfmpegArtifact(platform, arch) {
|
|
397
|
-
const artifact = FFMPEG_ARTIFACTS[`${platform}-${arch}`];
|
|
398
|
-
if (!artifact) throw new Error(`Unsupported platform/architecture for ffmpeg: ${platform}-${arch}`);
|
|
399
|
-
return artifact;
|
|
400
|
-
}
|
|
401
|
-
/** The URL alone, for a caller that wants nothing else. */
|
|
402
|
-
function getFfmpegDownloadUrl(platform, arch) {
|
|
403
|
-
return getFfmpegArtifact(platform, arch).url;
|
|
404
|
-
}
|
|
405
|
-
/**
|
|
406
|
-
* Ensure an ffmpeg binary WE provide is available on this node, and report
|
|
407
|
-
* which one and what it can do.
|
|
408
|
-
*
|
|
409
|
-
* Order: the operator's voluntary override → the one our image installed → a
|
|
410
|
-
* copy we already downloaded → download it. The system PATH is not in that
|
|
411
|
-
* list and must never be: see `ffmpeg-binary-source.ts`.
|
|
412
|
-
*
|
|
413
|
-
* The line it logs is the point as much as the path is. "Which ffmpeg am I
|
|
414
|
-
* running, and does it have vaapi" had no answer anywhere in the product, and
|
|
415
|
-
* that is what let a hardware-incapable binary serve every transcode on a hub
|
|
416
|
-
* with a working iGPU for months, silently in software.
|
|
490
|
+
* The ffmpeg this node runs, downloading the pinned build if it is not here
|
|
491
|
+
* yet, and reporting what it got.
|
|
492
|
+
*
|
|
493
|
+
* Order: the operator's `CAMSTACK_FFMPEG_PATH` → the pinned build already on
|
|
494
|
+
* disk → download it. No PATH, no image copy, no per-platform special case —
|
|
495
|
+
* see `ffmpeg-binary-source.ts` for why the image stopped being special after
|
|
496
|
+
* exactly one day.
|
|
497
|
+
*
|
|
498
|
+
* The line it logs is half the point. "Which ffmpeg am I running, and does it
|
|
499
|
+
* have vaapi" had no answer anywhere in the product, and that is what let a
|
|
500
|
+
* hardware-incapable binary serve every transcode on a hub with a working iGPU
|
|
501
|
+
* for months. The other half is the assertion beneath it: a build that probes
|
|
502
|
+
* short of what its artifact claims is a source that changed under us, and it
|
|
503
|
+
* says so with both lists.
|
|
417
504
|
*/
|
|
418
505
|
async function ensureFfmpeg(dataDir, logger) {
|
|
419
506
|
const depsDir = join(dataDir, "deps");
|
|
420
507
|
const platform = process.platform;
|
|
421
508
|
const arch = process.arch;
|
|
422
|
-
const
|
|
423
|
-
const downloadedPath = join(depsDir, `ffmpeg${ext}`);
|
|
509
|
+
const pinnedPath = join(depsDir, ffmpegBinaryName(platform));
|
|
424
510
|
const override = process.env[FFMPEG_PATH_ENV];
|
|
425
511
|
const chosen = chooseFfmpegBinary({
|
|
426
512
|
platform,
|
|
427
|
-
|
|
513
|
+
pinnedPath,
|
|
428
514
|
override,
|
|
429
515
|
exists: existsSync
|
|
430
516
|
});
|
|
431
517
|
if (override !== void 0 && override.trim().length > 0 && chosen?.origin !== "override") logger.error(`${FFMPEG_PATH_ENV} names a binary that does not exist — ignoring it`, { meta: { [FFMPEG_PATH_ENV]: override } });
|
|
432
518
|
const artifact = chosen === null ? getFfmpegArtifact(platform, arch) : null;
|
|
519
|
+
if (artifact !== null) logger.info("ffmpeg is not on this node yet — downloading the pinned build", { meta: {
|
|
520
|
+
release: FFMPEG_RELEASE,
|
|
521
|
+
url: artifact.url,
|
|
522
|
+
sizeMb: Math.round(artifact.sizeBytes / 1e6)
|
|
523
|
+
} });
|
|
433
524
|
const path = chosen?.path ?? await downloadBinary({
|
|
434
525
|
name: "ffmpeg",
|
|
435
526
|
url: artifact?.url ?? getFfmpegDownloadUrl(platform, arch),
|
|
436
527
|
targetDir: depsDir,
|
|
437
|
-
targetName:
|
|
528
|
+
targetName: ffmpegBinaryName(platform),
|
|
438
529
|
logger,
|
|
439
530
|
isArchive: true,
|
|
440
|
-
archiveFormat: artifact?.archiveFormat ?? "tar.xz"
|
|
531
|
+
archiveFormat: artifact?.archiveFormat ?? "tar.xz",
|
|
532
|
+
archiveInnerPath: "ffmpeg",
|
|
533
|
+
...artifact === null ? {} : { sha256: artifact.sha256 }
|
|
441
534
|
});
|
|
442
535
|
const capabilities = await probeFfmpegBinary(path);
|
|
443
536
|
logger.info("ffmpeg binary resolved", { meta: {
|
|
444
537
|
path,
|
|
445
538
|
origin: chosen?.origin ?? "downloaded",
|
|
539
|
+
release: FFMPEG_RELEASE,
|
|
446
540
|
version: capabilities.version,
|
|
447
541
|
hwaccels: [...capabilities.hwaccels].join(",") || "none"
|
|
448
542
|
} });
|
|
449
|
-
if (
|
|
450
|
-
const
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
543
|
+
if (chosen?.origin !== "override") {
|
|
544
|
+
const expected = getFfmpegArtifact(platform, arch).expectedHwaccels;
|
|
545
|
+
const missing = expected.filter((name) => !capabilities.hwaccels.has(name));
|
|
546
|
+
if (missing.length > 0) logger.error("this ffmpeg cannot do what its artifact is supposed to — the source changed under us", { meta: {
|
|
547
|
+
path,
|
|
548
|
+
release: FFMPEG_RELEASE,
|
|
549
|
+
expected: expected.join(","),
|
|
454
550
|
missing: missing.join(","),
|
|
455
551
|
got: [...capabilities.hwaccels].join(",") || "none"
|
|
456
552
|
} });
|
|
@@ -1937,4 +2033,4 @@ function resolveExportFingerprint(input) {
|
|
|
1937
2033
|
return input.persisted ?? input.fresh;
|
|
1938
2034
|
}
|
|
1939
2035
|
//#endregion
|
|
1940
|
-
export { ChildCostRegistry, FfmpegProcess, FilesystemStorageProvider, Fmp4FragmentChild, Fmp4FragmentPlane, NO_COST_CLAIM, PYTHON_VERSION, buildBinaryPath, canonicalDeviceFingerprint, canonicalHash, containsOrEquals, diffExportTargets, downloadBinary, ensureBinary, ensureFfmpeg, ensurePython, findInPath, getFfmpegArtifact, getFfmpegDownloadUrl, getPlatformInfo, getPythonDownloadUrl, installPythonPackages, installPythonRequirements, nodeProcStatReader, parseFfmpegCapabilities, parseProcCpuSeconds, parseProcRssBytes, physicalRootOf, probeFfmpegBinary, readProcessCost, resolveExportFingerprint, signExpiringUrl, verifyExpiringUrl };
|
|
2036
|
+
export { ChildCostRegistry, FFMPEG_RELEASE, FfmpegProcess, FilesystemStorageProvider, Fmp4FragmentChild, Fmp4FragmentPlane, NO_COST_CLAIM, PYTHON_VERSION, buildBinaryPath, canonicalDeviceFingerprint, canonicalHash, containsOrEquals, diffExportTargets, downloadBinary, ensureBinary, ensureFfmpeg, ensurePython, findInPath, getFfmpegArtifact, getFfmpegDownloadUrl, getPlatformInfo, getPythonDownloadUrl, installPythonPackages, installPythonRequirements, nodeProcStatReader, parseFfmpegCapabilities, parseProcCpuSeconds, parseProcRssBytes, physicalRootOf, probeFfmpegBinary, readProcessCost, resolveExportFingerprint, signExpiringUrl, verifyExpiringUrl };
|