@camstack/addon-pipeline 1.2.268 → 1.2.269

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.
Files changed (35) hide show
  1. package/dist/audio-analyzer/index.js +2 -2
  2. package/dist/audio-analyzer/index.mjs +2 -2
  3. package/dist/{default-detection-model-CKNqjjRy.js → default-detection-model-BfMsW_XK.js} +1 -1
  4. package/dist/{default-detection-model--x95ODoz.mjs → default-detection-model-pXamampo.mjs} +1 -1
  5. package/dist/detection-pipeline/index.js +4 -4
  6. package/dist/detection-pipeline/index.mjs +4 -4
  7. package/dist/{dist-C7CvyImc.js → dist-CkNVb7Zh.js} +187 -11
  8. package/dist/{dist-Dm1V0nJX.mjs → dist-Cqf-U6EN.mjs} +187 -11
  9. package/dist/motion-wasm/index.js +1 -1
  10. package/dist/motion-wasm/index.mjs +1 -1
  11. package/dist/{node-CjN6Vze9.js → node-CqC8R84-.js} +116 -2
  12. package/dist/{node-B5haKIVa.mjs → node-jLmcbaar.mjs} +111 -3
  13. package/dist/pipeline-runner/index.js +3 -3
  14. package/dist/pipeline-runner/index.mjs +3 -3
  15. package/dist/{process-memory-BMCVwJcT.mjs → process-memory-B1YHg1_g.mjs} +1 -1
  16. package/dist/{process-memory-CaFOThD9.js → process-memory-D7LlWXty.js} +1 -1
  17. package/dist/recorder/index.js +2 -2
  18. package/dist/recorder/index.mjs +2 -2
  19. package/dist/{segment-demux-js-BaWzAeJu.mjs → segment-demux-js-B2TLcR_g.mjs} +1 -1
  20. package/dist/{segment-demux-js-bfaGjVqq.js → segment-demux-js-Bu-_Q7Um.js} +1 -1
  21. package/dist/stream-broker/_stub.js +2 -2
  22. package/dist/stream-broker/{_virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-6gUUOaeo.mjs → _virtual_mf-localSharedImportMap___mfe_internal__addon_stream_broker_widgets-CbUvu4Jn.mjs} +2 -2
  23. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-DJVznXRG.mjs +26 -0
  24. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-CeR_IxxU.mjs +26 -0
  25. package/dist/stream-broker/demux-worker-child.js +1 -1
  26. package/dist/stream-broker/demux-worker-child.mjs +1 -1
  27. package/dist/stream-broker/{hostInit-DBu-k8Ps.mjs → hostInit-9ZN1ghaZ.mjs} +2 -2
  28. package/dist/stream-broker/index.js +397 -60
  29. package/dist/stream-broker/index.mjs +397 -60
  30. package/dist/stream-broker/remoteEntry.js +1 -1
  31. package/package.json +1 -1
  32. package/python/inference_pool.py +84 -2
  33. package/python/test_inference_pool_ov_threads.py +112 -0
  34. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_types__loadShare__.js-B5hze8qG.mjs +0 -26
  35. package/dist/stream-broker/_virtual_mf___mfe_internal__addon_stream_broker_widgets__loadShare___mf_0_camstack_mf_1_ui_mf_2_library__loadShare__.js-DTzfOQZq.mjs +0 -26
@@ -5360,7 +5360,7 @@ var ZodIssueCode = {
5360
5360
  var ZodFirstPartyTypeKind;
5361
5361
  ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {});
5362
5362
  //#endregion
5363
- //#region ../types/dist/sleep-GU_us3DG.mjs
5363
+ //#region ../types/dist/sleep-CiR4z7r9.mjs
5364
5364
  /**
5365
5365
  * The audio chunk plane's byte format, and the ONE expansion from a coded
5366
5366
  * window to float samples (D455).
@@ -6556,6 +6556,17 @@ var CAM_PROFILE_ORDER = [
6556
6556
  "mid",
6557
6557
  "low"
6558
6558
  ];
6559
+ /**
6560
+ * Which rung a per-camera consumer listens on: an explicit profile, or `auto`.
6561
+ *
6562
+ * `auto` is a REAL value, not an absent one — it means "resolve it by the rule
6563
+ * that consumer owns". It lives beside `CamProfile` because a rung is the only
6564
+ * operator-facing way to name a stream: a cam-stream id is broker-internal and
6565
+ * moves when a slot is reassigned, so a stored id silently stops meaning what
6566
+ * the operator picked. Today's one user is the audio analyser, whose rule is
6567
+ * "the lowest AVAILABLE native rung" (D537).
6568
+ */
6569
+ var AudioStreamPickSchema = union([CamProfileSchema, literal("auto")]);
6559
6570
  var CamStreamKindSchema = _enum([
6560
6571
  "pull-rtsp",
6561
6572
  "pull-rtmp",
@@ -7577,7 +7588,7 @@ function sleep(ms) {
7577
7588
  return new Promise((resolve) => setTimeout(resolve, Math.max(0, ms)));
7578
7589
  }
7579
7590
  //#endregion
7580
- //#region ../types/dist/canonical-hash-CvL03d3i.mjs
7591
+ //#region ../types/dist/canonical-hash-CPK2Dy60.mjs
7581
7592
  var AUDIO_ENCODER_BY_CODEC = {
7582
7593
  opus: "libopus",
7583
7594
  aac: "aac",
@@ -7678,16 +7689,29 @@ function resolveStreamMaps(selection) {
7678
7689
  };
7679
7690
  }
7680
7691
  /** The `-vf` filter args, or `[]` when a consumer `-vf` already claims the slot. */
7681
- function buildVideoFilterArgs(scale, outputArgs, filterGraph) {
7692
+ function buildVideoFilterArgs(scale, outputArgs, filterGraph, hwUpload) {
7682
7693
  if (filterGraph) {
7683
7694
  if (scale) throw new Error("FfmpegInvocation: video.scale cannot be combined with a filter graph — scale inside the graph instead (the -vf would feed an output the graph already feeds)");
7684
7695
  if (outputArgs.some((a) => a === "-vf")) throw new Error("FfmpegInvocation: outputArgs carries a -vf while a filter graph feeds the same output — fold the filter into the graph");
7685
7696
  return [];
7686
7697
  }
7687
- if (!scale) return [];
7688
7698
  if (outputArgs.some((a) => a === "-vf")) return [];
7689
- if (scale.mode === "exact") return ["-vf", `scale=${scale.width}:${scale.height}`];
7690
- return ["-vf", `scale='min(${scale.width},iw)':'min(${scale.height},ih)':force_original_aspect_ratio=decrease:force_divisible_by=2`];
7699
+ if (!scale) return hwUpload.length > 0 ? ["-vf", hwUpload] : [];
7700
+ const suffix = hwUpload.length > 0 ? `,${hwUpload}` : "";
7701
+ if (scale.mode === "exact") return ["-vf", `scale=${scale.width}:${scale.height}${suffix}`];
7702
+ return ["-vf", `scale='min(${scale.width},iw)':'min(${scale.height},ih)':force_original_aspect_ratio=decrease:force_divisible_by=2${suffix}`];
7703
+ }
7704
+ /**
7705
+ * The upload filter a hardware encode needs, or `''`.
7706
+ *
7707
+ * Nothing is uploaded when the DECODE already left the frames on the GPU
7708
+ * (`-hwaccel vaapi`): they are surfaces already, and uploading a surface is an
7709
+ * error rather than a no-op.
7710
+ */
7711
+ function resolveHwUpload(device, decodeHwAccel) {
7712
+ if (device === void 0) return "";
7713
+ if (!isSoftwareDecode(decodeHwAccel)) return "";
7714
+ return "format=nv12,hwupload";
7691
7715
  }
7692
7716
  /** Rate-control args for an encode plan. */
7693
7717
  function buildRateControlArgs(video) {
@@ -7707,7 +7731,7 @@ function buildRateControlArgs(video) {
7707
7731
  ];
7708
7732
  }
7709
7733
  /** The whole video block (`-vf` … `-c:v` … knobs), after `-i`. */
7710
- function buildVideoArgs(video, outputArgs, filterGraph) {
7734
+ function buildVideoArgs(video, outputArgs, filterGraph, hwEncode) {
7711
7735
  if (video.kind === "raw") {
7712
7736
  if (filterGraph && video.filter !== void 0) throw new Error("FfmpegInvocation: video.filter cannot be combined with a filter graph — fold the filter into the graph");
7713
7737
  return [
@@ -7727,8 +7751,10 @@ function buildVideoArgs(video, outputArgs, filterGraph) {
7727
7751
  ...video.bitstreamFilter ? ["-bsf:v", video.bitstreamFilter] : []
7728
7752
  ];
7729
7753
  }
7754
+ const hwUpload = hwEncode === void 0 ? "" : resolveHwUpload(hwEncode.device, hwEncode.decodeHwAccel);
7755
+ if (hwEncode !== void 0 && filterGraph) throw new Error("FfmpegInvocation: a hardware encode fed by a filter graph must upload INSIDE the graph — hwEncodeDevice cannot be combined with filterGraph");
7730
7756
  const args = [
7731
- ...buildVideoFilterArgs(video.scale, outputArgs, filterGraph),
7757
+ ...buildVideoFilterArgs(video.scale, outputArgs, filterGraph, hwUpload),
7732
7758
  "-c:v",
7733
7759
  video.encoder
7734
7760
  ];
@@ -7898,10 +7924,18 @@ function buildAudioSidecarArgs(sidecar) {
7898
7924
  * (`0:a:0?`): the sidecar is defined as the SOURCE's microphone on its own RTP
7899
7925
  * output, not as whatever the main output happens to carry.
7900
7926
  */
7927
+ /** The hardware-encode context for this invocation, or `undefined`. */
7928
+ function hwEncodeFor(inv) {
7929
+ return inv.hwEncodeDevice === void 0 ? void 0 : {
7930
+ device: inv.hwEncodeDevice,
7931
+ decodeHwAccel: inv.decodeHwAccel
7932
+ };
7933
+ }
7901
7934
  function buildFfmpegArgs(inv) {
7902
7935
  const graph = inv.filterGraph ?? null;
7903
7936
  const head = [
7904
7937
  ...logBannerArgs(inv.logLevel),
7938
+ ...inv.hwEncodeDevice !== void 0 ? ["-vaapi_device", inv.hwEncodeDevice.renderNode] : [],
7905
7939
  ...buildInputArgs(inv.input, inv.decodeHwAccel),
7906
7940
  ...(inv.extraInputs ?? []).flatMap((extra) => buildInputArgs(extra, inv.decodeHwAccel)),
7907
7941
  ...graph ? ["-filter_complex", graph.graph] : []
@@ -7915,7 +7949,7 @@ function buildFfmpegArgs(inv) {
7915
7949
  "-an",
7916
7950
  "-map",
7917
7951
  maps.video ?? "0:v:0",
7918
- ...buildVideoArgs(inv.video, inv.outputArgs, graph),
7952
+ ...buildVideoArgs(inv.video, inv.outputArgs, graph, hwEncodeFor(inv)),
7919
7953
  ...threadArgs,
7920
7954
  ...inv.outputArgs,
7921
7955
  ...buildRtpOutputArgs(inv.sink.video)
@@ -7938,7 +7972,7 @@ function buildFfmpegArgs(inv) {
7938
7972
  return [
7939
7973
  ...head,
7940
7974
  ...videoMapArgs,
7941
- ...buildVideoArgs(inv.video, inv.outputArgs, graph),
7975
+ ...buildVideoArgs(inv.video, inv.outputArgs, graph, hwEncodeFor(inv)),
7942
7976
  ...threadArgs,
7943
7977
  ...mutedAudio ? [] : audioMapArgs,
7944
7978
  ...audioArgs,
@@ -22792,6 +22826,7 @@ var MediaFileKindEnum = _enum([
22792
22826
  "keyFrameSmall",
22793
22827
  "thumbnailSmall",
22794
22828
  "confirmationCrop",
22829
+ "debugCrop",
22795
22830
  "sceneFrame"
22796
22831
  ]);
22797
22832
  /**
@@ -24456,6 +24491,18 @@ var RunnerCameraConfigSchema = object({
24456
24491
  motionStreamId: string(),
24457
24492
  detectionStreamId: string(),
24458
24493
  /**
24494
+ * Which rung this camera's audio analysis listens on — `auto` (the lowest
24495
+ * AVAILABLE native rung) or an explicit one.
24496
+ *
24497
+ * Not consumed by the runner: carried here so it travels with the camera's
24498
+ * config the way `audioMotionWindowMs` does, and so the orchestrator's
24499
+ * watchdog resolves the same stream the audio subscription did. OPTIONAL
24500
+ * with no default — absent means `auto`, which is what every camera written
24501
+ * before this field had, and an absent optional adds nothing to the
24502
+ * generated cap-input defaults (D537).
24503
+ */
24504
+ audioStreamPick: AudioStreamPickSchema.optional(),
24505
+ /**
24459
24506
  * Motion sources that can activate the pipeline. At least one must
24460
24507
  * be present. Multiple sources OR-ed: any one firing arms the
24461
24508
  * cooldown timer and transitions watching → active. The same
@@ -27182,6 +27229,104 @@ var WebrtcStreamChoiceSchema = object({
27182
27229
  bitrateKbps: number().nullable()
27183
27230
  });
27184
27231
  /**
27232
+ * The last move the adaptive ladder made on this session, and the numbers it
27233
+ * rested on. Mirrors `LadderDecision` in the stream-broker's
27234
+ * `adaptive-controller.ts` — the log line's evidence, made readable.
27235
+ *
27236
+ * Nullability is load-bearing: `lossRatio: null` means the loss tracker had
27237
+ * no window to report, which is NOT a link with zero loss.
27238
+ */
27239
+ var WebrtcLadderDecisionSchema = object({
27240
+ /** `loss` — RTCP / client-reported packet loss; `stall` — the picture
27241
+ * stopped moving; `healthy` — a promotion. */
27242
+ cause: _enum([
27243
+ "loss",
27244
+ "stall",
27245
+ "healthy"
27246
+ ]),
27247
+ /** The rung the ladder moved TO. Null for a move that changed no rung
27248
+ * (an MTU reduction, a forced transcode-down at the bottom). */
27249
+ tier: CamProfileSchema.nullable(),
27250
+ /** Whether that move forced the egress transcode-down rung. */
27251
+ forcedTranscodeDown: boolean(),
27252
+ /** Loss ratio over the tracker's window at the moment of the decision. */
27253
+ lossRatio: number().nullable(),
27254
+ /** The client's reported downlink at that moment, in kbps. */
27255
+ clientKbps: number().nullable(),
27256
+ /** How long the stall detector had been seeing nothing arrive. */
27257
+ stalledForMs: number().nullable(),
27258
+ /** Whether the broker WAS sending while that was measured — the half that
27259
+ * separates "the camera stopped" from "the link stopped". */
27260
+ serverSending: boolean().nullable(),
27261
+ /** Epoch ms. The overlay prints its age; a decision from 40 minutes ago
27262
+ * must not read like one from this second. */
27263
+ at: number()
27264
+ });
27265
+ /** Per-tier count of MEASURED downgrades this viewer session has suffered. */
27266
+ var WebrtcTierFailureSchema = object({
27267
+ tier: CamProfileSchema,
27268
+ failures: number().int().nonnegative()
27269
+ });
27270
+ /**
27271
+ * What the SERVER decided for one WebRTC session — the half the client cannot
27272
+ * measure. See `getSessionDebug`.
27273
+ */
27274
+ var WebrtcSessionDebugSchema = object({
27275
+ sessionId: string(),
27276
+ /** Whether the session still exists here. Everything below is null when
27277
+ * it does not — a dead session has no measurements, not zero ones. */
27278
+ alive: boolean(),
27279
+ /** Epoch ms this snapshot was taken, so the overlay can show its age. */
27280
+ observedAt: number(),
27281
+ /** The broker actually feeding this session (`<deviceId>/<camStreamId>`). */
27282
+ brokerId: string().nullable(),
27283
+ camStreamId: string().nullable(),
27284
+ /** `derived` = this hub BUILT the rung being served (a transcode/scale of
27285
+ * another stream); `native` = the camera's own encode. */
27286
+ sourceKind: _enum([
27287
+ "native",
27288
+ "derived",
27289
+ "unknown"
27290
+ ]),
27291
+ /** Whether the ladder is running at all (an `adaptive` target). */
27292
+ adaptive: boolean(),
27293
+ /** The rung `auto` ACTUALLY resolved to right now. Null when the broker
27294
+ * is bound to no profile slot (a manually-activated stream). */
27295
+ servedTier: CamProfileSchema.nullable(),
27296
+ /** Which node ingests the source. Null when unresolved. */
27297
+ ingestNodeId: string().nullable(),
27298
+ /** Whether that node is a remote one (the media crosses a node boundary
27299
+ * before it reaches this session). Null when unresolved. */
27300
+ ingestIsRemote: boolean().nullable(),
27301
+ /** Codec off the source, and the one negotiated with this client. */
27302
+ sourceCodec: string().nullable(),
27303
+ negotiatedCodec: string().nullable(),
27304
+ /** Whether the EGRESS leg re-encodes for this client or forwards the
27305
+ * source bytes untouched. */
27306
+ egressLeg: _enum([
27307
+ "copy",
27308
+ "transcode",
27309
+ "unknown"
27310
+ ]),
27311
+ /** What the broker itself reports about the rung it is serving. */
27312
+ brokerStatus: string().nullable(),
27313
+ brokerCodec: string().nullable(),
27314
+ brokerBitrateKbps: number().nullable(),
27315
+ brokerInputFps: number().nullable(),
27316
+ brokerUptimeMs: number().nullable(),
27317
+ /** RTP packets this session has sent — the server's own "am I sending?". */
27318
+ rtpPacketsSent: number().nullable(),
27319
+ /** D42: the track may be carrying the recorded feeder, not live. The ladder
27320
+ * is suspended there, so a frozen picture in `recorded` mode means
27321
+ * something entirely different. */
27322
+ trackMode: _enum(["live", "recorded"]).nullable(),
27323
+ lastDecision: WebrtcLadderDecisionSchema.nullable(),
27324
+ tierFailures: array(WebrtcTierFailureSchema),
27325
+ /** Successful promotions in this viewer session (drives the progressive
27326
+ * healthy timer). Null when no ladder is running. */
27327
+ upgradeCount: number().nullable()
27328
+ });
27329
+ /**
27185
27330
  * WebRTC session — device-scoped facade over the system `webrtc` cap.
27186
27331
  *
27187
27332
  * Exposes per-device signaling (`createSession`, `handleAnswer`,
@@ -27421,7 +27566,27 @@ var webrtcSessionCapability = {
27421
27566
  * the same answer as "it ended": either way nothing is holding it up.
27422
27567
  */
27423
27568
  alive: boolean()
27424
- }))
27569
+ })),
27570
+ /**
27571
+ * The SERVER's half of the stream-debug overlay, for one live session.
27572
+ *
27573
+ * The client can measure its own transport (`getStats()`); it cannot see
27574
+ * which rung `auto` actually resolved to, why the ladder last moved, or
27575
+ * whether the rung it is being served is the camera's own encode or
27576
+ * something this hub built. That asymmetry is why "quality is stuck on
27577
+ * low" reports have historically been unanswerable from the viewer alone.
27578
+ *
27579
+ * EVERY measurement here is nullable and `null` means UNKNOWN, never zero
27580
+ * (D393): a session whose ladder has never moved reports
27581
+ * `lastDecision: null`, which is a different fact from a ladder that moved
27582
+ * for `healthy` with a 0 loss ratio.
27583
+ *
27584
+ * Read-only, ~1 Hz, polled by the overlay only while it is visible.
27585
+ */
27586
+ getSessionDebug: method(object({
27587
+ deviceId: number().int().nonnegative(),
27588
+ sessionId: string()
27589
+ }), WebrtcSessionDebugSchema, { kind: "query" })
27425
27590
  },
27426
27591
  /** BIG PLAN 2: declarative mount hint — read by `@camstack/system` `buildCapRouters`. */
27427
27592
  mount: { kind: "server-provided" }
@@ -41619,6 +41784,12 @@ Object.freeze({
41619
41784
  addonId: null,
41620
41785
  access: "view"
41621
41786
  },
41787
+ "webrtcSession.getSessionDebug": {
41788
+ capName: "webrtc-session",
41789
+ capScope: "device",
41790
+ addonId: null,
41791
+ access: "view"
41792
+ },
41622
41793
  "webrtcSession.getSessionState": {
41623
41794
  capName: "webrtc-session",
41624
41795
  capScope: "device",
@@ -43602,6 +43773,11 @@ Object.freeze({
43602
43773
  form: "single",
43603
43774
  optional: false
43604
43775
  }],
43776
+ "webrtcSession.getSessionDebug": [{
43777
+ name: "deviceId",
43778
+ form: "single",
43779
+ optional: false
43780
+ }],
43605
43781
  "webrtcSession.getSessionState": [{
43606
43782
  name: "deviceId",
43607
43783
  form: "single",
@@ -2,7 +2,7 @@ Object.defineProperties(exports, {
2
2
  __esModule: { value: true },
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
- const require_dist = require("../dist-C7CvyImc.js");
5
+ const require_dist = require("../dist-CkNVb7Zh.js");
6
6
  const require_lazy_sharp = require("../lazy-sharp-BuwKlQLR.js");
7
7
  let node_fs = require("node:fs");
8
8
  let node_path = require("node:path");
@@ -1,4 +1,4 @@
1
- import { $t as hydrateSchema, Wt as BaseAddon, X as evaluateZoneRules, ft as motionDetectionCapability, qt as DeviceType } from "../dist-Dm1V0nJX.mjs";
1
+ import { $t as hydrateSchema, Wt as BaseAddon, X as evaluateZoneRules, ft as motionDetectionCapability, qt as DeviceType } from "../dist-Cqf-U6EN.mjs";
2
2
  import { t as getSharp } from "../lazy-sharp-DXsqwpph.mjs";
3
3
  import { readFileSync } from "node:fs";
4
4
  import { join } from "node:path";
@@ -1,12 +1,120 @@
1
1
  const require_chunk = require("./chunk-emK7D4bc.js");
2
- const require_dist = require("./dist-C7CvyImc.js");
2
+ const require_dist = require("./dist-CkNVb7Zh.js");
3
3
  let node_crypto = require("node:crypto");
4
4
  let node_fs = require("node:fs");
5
5
  node_fs = require_chunk.__toESM(node_fs, 1);
6
6
  let node_path = require("node:path");
7
7
  node_path = require_chunk.__toESM(node_path, 1);
8
- require("node:child_process");
8
+ let node_child_process = require("node:child_process");
9
9
  let node_fs_promises = require("node:fs/promises");
10
+ //#region ../types/dist/node.mjs
11
+ /**
12
+ * What an ffmpeg binary can actually DO, asked of the binary itself.
13
+ *
14
+ * ## The failure this exists to end
15
+ *
16
+ * `ensureFfmpeg` prefers a downloaded STATIC build over the system one, and a
17
+ * static build is compiled for portability: no vendor libraries, no VAAPI, no
18
+ * QSV. On a machine with a working Intel iGPU that is precisely backwards, and
19
+ * the symptom does not say so. Measured on the hub, 2026-09-18:
20
+ *
21
+ * ```
22
+ * /data/deps/ffmpeg 7.0.2 johnvansickle static hwaccels: vdpau
23
+ * /usr/bin/ffmpeg 6.1.1 Ubuntu, in the image hwaccels: vdpau cuda vaapi qsv drm opencl vulkan
24
+ * ```
25
+ *
26
+ * Every consumer that went through `ensureFfmpeg` — the broker's egress and
27
+ * derived transcodes, the WebRTC transcode leg, the camera grid — asked for
28
+ * `-hwaccel vaapi`, got `Device creation failed: -12`, and fell back to
29
+ * software. `-12` is what fftools prints when `av_hwdevice_ctx_alloc` returns
30
+ * NULL because the type is not in the build: the NAME parses, so the request
31
+ * looks valid and the device simply cannot exist. It reads as a resource
32
+ * problem and is a build property.
33
+ *
34
+ * ## Why asking the kernel was not enough
35
+ *
36
+ * The existing hardware resolver answers from `/dev/dri` presence. That is a
37
+ * correct description of the NODE, and it is what `node-av` needs — the
38
+ * detection workers were on VAAPI the whole time. It says nothing about the
39
+ * separate binary a child will be spawned with, and it was being read as
40
+ * though it did.
41
+ *
42
+ * So: two questions, two answers. What does this node HAVE (the resolver), and
43
+ * what can this BINARY use (here). A backend needs both.
44
+ */
45
+ /** How long a probe may take before the binary counts as unusable. */
46
+ var PROBE_TIMEOUT_MS = 5e3;
47
+ function run(path, args) {
48
+ return new Promise((resolve) => {
49
+ (0, node_child_process.execFile)(path, [...args], { timeout: PROBE_TIMEOUT_MS }, (error, stdout) => {
50
+ resolve(error ? "" : stdout);
51
+ });
52
+ });
53
+ }
54
+ /**
55
+ * `-hwaccels` prints a header line and then one name per line. Anything with a
56
+ * space in it is prose, not a name.
57
+ */
58
+ function parseNames(output) {
59
+ const names = /* @__PURE__ */ new Set();
60
+ for (const raw of output.split("\n")) {
61
+ const line = raw.trim();
62
+ if (line.length === 0 || line.includes(" ")) continue;
63
+ names.add(line);
64
+ }
65
+ return names;
66
+ }
67
+ /**
68
+ * `-encoders` prints a LEGEND and then a table, separated by a dashed line:
69
+ *
70
+ * ```
71
+ * Encoders:
72
+ * V..... = Video
73
+ * .F.... = Frame-level multithreading
74
+ * ------
75
+ * V....D h264_vaapi H.264/AVC (VAAPI) (codec h264)
76
+ * ```
77
+ *
78
+ * The legend rows have the SAME leading flag shape as the table rows, so a
79
+ * pattern alone matches ` V..... = Video` and yields `=` as an encoder name.
80
+ * Verified against the hub's own output on 2026-09-18, which is how that was
81
+ * caught. So the separator is the parser's state: nothing counts before it.
82
+ */
83
+ function parseEncoders(output) {
84
+ const names = /* @__PURE__ */ new Set();
85
+ let inTable = false;
86
+ for (const raw of output.split("\n")) {
87
+ if (!inTable) {
88
+ if (raw.trim().startsWith("---")) inTable = true;
89
+ continue;
90
+ }
91
+ const match = /^\s[VAS][.F][.S][.X][.B][.D]\s+(\S+)/.exec(raw);
92
+ if (match?.[1] !== void 0) names.add(match[1]);
93
+ }
94
+ return names;
95
+ }
96
+ /**
97
+ * Turn three raw outputs into capabilities. Separated from the spawning so the
98
+ * parsers can be held against what ffmpeg REALLY prints — which is how the
99
+ * legend rows were caught being read as encoder names.
100
+ */
101
+ function parseFfmpegCapabilities(path, versionOut, hwaccelOut, encoderOut) {
102
+ return {
103
+ path,
104
+ version: versionOut.split("\n")[0]?.trim() ?? "",
105
+ hwaccels: parseNames(hwaccelOut),
106
+ encoders: parseEncoders(encoderOut)
107
+ };
108
+ }
109
+ /** Ask one binary what it can do. Never throws — an unusable binary answers empty. */
110
+ async function probeFfmpegBinary(path) {
111
+ const [versionOut, hwaccelOut, encoderOut] = await Promise.all([
112
+ run(path, ["-hide_banner", "-version"]),
113
+ run(path, ["-hide_banner", "-hwaccels"]),
114
+ run(path, ["-hide_banner", "-encoders"])
115
+ ]);
116
+ return parseFfmpegCapabilities(path, versionOut, hwaccelOut, encoderOut);
117
+ }
10
118
  var DEFAULT_FIRST_UNIT_TIMEOUT_MS = 12e3;
11
119
  /** Heartbeat cadence — ~2 minutes of 4 s fragments. */
12
120
  var FRAGMENT_LOG_EVERY = 30;
@@ -759,6 +867,12 @@ Object.defineProperty(exports, "physicalRootOf", {
759
867
  return physicalRootOf;
760
868
  }
761
869
  });
870
+ Object.defineProperty(exports, "probeFfmpegBinary", {
871
+ enumerable: true,
872
+ get: function() {
873
+ return probeFfmpegBinary;
874
+ }
875
+ });
762
876
  Object.defineProperty(exports, "readProcessCost", {
763
877
  enumerable: true,
764
878
  get: function() {
@@ -1,9 +1,117 @@
1
- import { Bt as buildFfmpegArgs, Ht as isSoftwareDecode, Lt as errMsg, zt as Fmp4BoxSplitter } from "./dist-Dm1V0nJX.mjs";
1
+ import { Bt as buildFfmpegArgs, Ht as isSoftwareDecode, Lt as errMsg, zt as Fmp4BoxSplitter } from "./dist-Cqf-U6EN.mjs";
2
2
  import { randomUUID } from "node:crypto";
3
3
  import { realpathSync } from "node:fs";
4
4
  import path from "node:path";
5
- import "node:child_process";
5
+ import { execFile } from "node:child_process";
6
6
  import { readFile } from "node:fs/promises";
7
+ //#region ../types/dist/node.mjs
8
+ /**
9
+ * What an ffmpeg binary can actually DO, asked of the binary itself.
10
+ *
11
+ * ## The failure this exists to end
12
+ *
13
+ * `ensureFfmpeg` prefers a downloaded STATIC build over the system one, and a
14
+ * static build is compiled for portability: no vendor libraries, no VAAPI, no
15
+ * QSV. On a machine with a working Intel iGPU that is precisely backwards, and
16
+ * the symptom does not say so. Measured on the hub, 2026-09-18:
17
+ *
18
+ * ```
19
+ * /data/deps/ffmpeg 7.0.2 johnvansickle static hwaccels: vdpau
20
+ * /usr/bin/ffmpeg 6.1.1 Ubuntu, in the image hwaccels: vdpau cuda vaapi qsv drm opencl vulkan
21
+ * ```
22
+ *
23
+ * Every consumer that went through `ensureFfmpeg` — the broker's egress and
24
+ * derived transcodes, the WebRTC transcode leg, the camera grid — asked for
25
+ * `-hwaccel vaapi`, got `Device creation failed: -12`, and fell back to
26
+ * software. `-12` is what fftools prints when `av_hwdevice_ctx_alloc` returns
27
+ * NULL because the type is not in the build: the NAME parses, so the request
28
+ * looks valid and the device simply cannot exist. It reads as a resource
29
+ * problem and is a build property.
30
+ *
31
+ * ## Why asking the kernel was not enough
32
+ *
33
+ * The existing hardware resolver answers from `/dev/dri` presence. That is a
34
+ * correct description of the NODE, and it is what `node-av` needs — the
35
+ * detection workers were on VAAPI the whole time. It says nothing about the
36
+ * separate binary a child will be spawned with, and it was being read as
37
+ * though it did.
38
+ *
39
+ * So: two questions, two answers. What does this node HAVE (the resolver), and
40
+ * what can this BINARY use (here). A backend needs both.
41
+ */
42
+ /** How long a probe may take before the binary counts as unusable. */
43
+ var PROBE_TIMEOUT_MS = 5e3;
44
+ function run(path, args) {
45
+ return new Promise((resolve) => {
46
+ execFile(path, [...args], { timeout: PROBE_TIMEOUT_MS }, (error, stdout) => {
47
+ resolve(error ? "" : stdout);
48
+ });
49
+ });
50
+ }
51
+ /**
52
+ * `-hwaccels` prints a header line and then one name per line. Anything with a
53
+ * space in it is prose, not a name.
54
+ */
55
+ function parseNames(output) {
56
+ const names = /* @__PURE__ */ new Set();
57
+ for (const raw of output.split("\n")) {
58
+ const line = raw.trim();
59
+ if (line.length === 0 || line.includes(" ")) continue;
60
+ names.add(line);
61
+ }
62
+ return names;
63
+ }
64
+ /**
65
+ * `-encoders` prints a LEGEND and then a table, separated by a dashed line:
66
+ *
67
+ * ```
68
+ * Encoders:
69
+ * V..... = Video
70
+ * .F.... = Frame-level multithreading
71
+ * ------
72
+ * V....D h264_vaapi H.264/AVC (VAAPI) (codec h264)
73
+ * ```
74
+ *
75
+ * The legend rows have the SAME leading flag shape as the table rows, so a
76
+ * pattern alone matches ` V..... = Video` and yields `=` as an encoder name.
77
+ * Verified against the hub's own output on 2026-09-18, which is how that was
78
+ * caught. So the separator is the parser's state: nothing counts before it.
79
+ */
80
+ function parseEncoders(output) {
81
+ const names = /* @__PURE__ */ new Set();
82
+ let inTable = false;
83
+ for (const raw of output.split("\n")) {
84
+ if (!inTable) {
85
+ if (raw.trim().startsWith("---")) inTable = true;
86
+ continue;
87
+ }
88
+ const match = /^\s[VAS][.F][.S][.X][.B][.D]\s+(\S+)/.exec(raw);
89
+ if (match?.[1] !== void 0) names.add(match[1]);
90
+ }
91
+ return names;
92
+ }
93
+ /**
94
+ * Turn three raw outputs into capabilities. Separated from the spawning so the
95
+ * parsers can be held against what ffmpeg REALLY prints — which is how the
96
+ * legend rows were caught being read as encoder names.
97
+ */
98
+ function parseFfmpegCapabilities(path, versionOut, hwaccelOut, encoderOut) {
99
+ return {
100
+ path,
101
+ version: versionOut.split("\n")[0]?.trim() ?? "",
102
+ hwaccels: parseNames(hwaccelOut),
103
+ encoders: parseEncoders(encoderOut)
104
+ };
105
+ }
106
+ /** Ask one binary what it can do. Never throws — an unusable binary answers empty. */
107
+ async function probeFfmpegBinary(path) {
108
+ const [versionOut, hwaccelOut, encoderOut] = await Promise.all([
109
+ run(path, ["-hide_banner", "-version"]),
110
+ run(path, ["-hide_banner", "-hwaccels"]),
111
+ run(path, ["-hide_banner", "-encoders"])
112
+ ]);
113
+ return parseFfmpegCapabilities(path, versionOut, hwaccelOut, encoderOut);
114
+ }
7
115
  var DEFAULT_FIRST_UNIT_TIMEOUT_MS = 12e3;
8
116
  /** Heartbeat cadence — ~2 minutes of 4 s fragments. */
9
117
  var FRAGMENT_LOG_EVERY = 30;
@@ -726,4 +834,4 @@ function physicalRootOf(root, realpath = realpathSync) {
726
834
  }
727
835
  }
728
836
  //#endregion
729
- export { physicalRootOf as a, NO_COST_CLAIM as i, Fmp4FragmentChild as n, readProcessCost as o, Fmp4FragmentPlane as r, ChildCostRegistry as t };
837
+ export { physicalRootOf as a, NO_COST_CLAIM as i, Fmp4FragmentChild as n, probeFfmpegBinary as o, Fmp4FragmentPlane as r, readProcessCost as s, ChildCostRegistry as t };
@@ -3,9 +3,9 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../chunk-emK7D4bc.js");
6
- const require_dist = require("../dist-C7CvyImc.js");
7
- const require_node = require("../node-CjN6Vze9.js");
8
- const require_default_detection_model = require("../default-detection-model-CKNqjjRy.js");
6
+ const require_dist = require("../dist-CkNVb7Zh.js");
7
+ const require_node = require("../node-CqC8R84-.js");
8
+ const require_default_detection_model = require("../default-detection-model-BfMsW_XK.js");
9
9
  const require_worker_protocol = require("../worker-protocol-B2MfQLlu.js");
10
10
  const require_hub_hostname = require("../hub-hostname-DAJXlOgV.js");
11
11
  const require_lazy_sharp = require("../lazy-sharp-BuwKlQLR.js");
@@ -1,6 +1,6 @@
1
- import { $ as failureContributionCapability, Lt as errMsg, S as NativeLeaseSettingsSchema, U as deriveDetailCropRect, Wt as BaseAddon, Xt as customAction, Yt as createEvent, Zt as defineCustomActions, _ as FailureCounters, _t as pickDetailCropConvention, b as MOTION_CLOSE_AFTER_MS, bn as EventCategory, bt as pipelineRunnerCapability, cn as _enum, fn as lazy, hn as object, it as loadContributionCapability, ln as array, m as DEVICE_BACKEND_TO_FORMAT, mn as number, p as DEFAULT_NATIVE_LEASE_SETTINGS, pn as literal, rn as nodePin, u as DEFAULT_DETAIL_CROP_CONVENTION, un as boolean, vn as string, vt as pickNativeLeaseOverride, x as NativeLeaseAdmissionSchema } from "../dist-Dm1V0nJX.mjs";
2
- import { i as NO_COST_CLAIM, t as ChildCostRegistry } from "../node-B5haKIVa.mjs";
3
- import { a as localFrameRegistry, d as getStepDefinition, i as rootObjectGate, o as resolveFrameViewGeometry, r as macroGateVerdict } from "../default-detection-model--x95ODoz.mjs";
1
+ import { $ as failureContributionCapability, Lt as errMsg, S as NativeLeaseSettingsSchema, U as deriveDetailCropRect, Wt as BaseAddon, Xt as customAction, Yt as createEvent, Zt as defineCustomActions, _ as FailureCounters, _t as pickDetailCropConvention, b as MOTION_CLOSE_AFTER_MS, bn as EventCategory, bt as pipelineRunnerCapability, cn as _enum, fn as lazy, hn as object, it as loadContributionCapability, ln as array, m as DEVICE_BACKEND_TO_FORMAT, mn as number, p as DEFAULT_NATIVE_LEASE_SETTINGS, pn as literal, rn as nodePin, u as DEFAULT_DETAIL_CROP_CONVENTION, un as boolean, vn as string, vt as pickNativeLeaseOverride, x as NativeLeaseAdmissionSchema } from "../dist-Cqf-U6EN.mjs";
2
+ import { i as NO_COST_CLAIM, t as ChildCostRegistry } from "../node-jLmcbaar.mjs";
3
+ import { a as localFrameRegistry, d as getStepDefinition, i as rootObjectGate, o as resolveFrameViewGeometry, r as macroGateVerdict } from "../default-detection-model-pXamampo.mjs";
4
4
  import { t as isWorkerReply } from "../worker-protocol-C_W-P_g-.mjs";
5
5
  import { t as resolveHubHostname } from "../hub-hostname-cCknRYKj.mjs";
6
6
  import { t as getSharp } from "../lazy-sharp-DXsqwpph.mjs";
@@ -1,4 +1,4 @@
1
- import { mt as parseProcStatus } from "./dist-Dm1V0nJX.mjs";
1
+ import { mt as parseProcStatus } from "./dist-Cqf-U6EN.mjs";
2
2
  import * as fs from "node:fs";
3
3
  import { execFile } from "node:child_process";
4
4
  //#region src/shared/node-topology-platform.ts
@@ -1,5 +1,5 @@
1
1
  const require_chunk = require("./chunk-emK7D4bc.js");
2
- const require_dist = require("./dist-C7CvyImc.js");
2
+ const require_dist = require("./dist-CkNVb7Zh.js");
3
3
  let node_fs = require("node:fs");
4
4
  node_fs = require_chunk.__toESM(node_fs);
5
5
  let node_child_process = require("node:child_process");
@@ -3,8 +3,8 @@ Object.defineProperties(exports, {
3
3
  [Symbol.toStringTag]: { value: "Module" }
4
4
  });
5
5
  const require_chunk = require("../chunk-emK7D4bc.js");
6
- const require_dist = require("../dist-C7CvyImc.js");
7
- const require_node = require("../node-CjN6Vze9.js");
6
+ const require_dist = require("../dist-CkNVb7Zh.js");
7
+ const require_node = require("../node-CqC8R84-.js");
8
8
  const require_hub_hostname = require("../hub-hostname-DAJXlOgV.js");
9
9
  const require_restream_intent = require("../restream-intent-7uDNqMKs.js");
10
10
  const require_retire_root_keys = require("../retire-root-keys-Csb8z2f3.js");
@@ -1,5 +1,5 @@
1
- import { $t as hydrateSchema, C as OpsLogEntrySchema, Ct as recordingExportCapability, D as RECORDING_EXPORT_MAX_READ_BYTES, Dt as resolveLocationMode, H as deriveBatteryPresence, I as batteryCapability, Kt as DeviceFeature, Lt as errMsg, Mt as storageOccupancyCapability, O as RecordingConfigSchema, Pt as stripRetiredBandPreBufferSec, Q as evictionPolicyOfLocation, St as recordingCapability, W as deriveRecordingMode, Wt as BaseAddon, Xt as customAction, Y as evaluateSensorEdge, Z as evictionPolicyForMode, Zt as defineCustomActions, _n as record, bn as EventCategory, cn as _enum, ct as mayReadLocation, d as DEFAULT_EVENTS_BAND_BUFFER_SEC, dt as modeMayWrite, et as gbToBytes, g as ExportRecordSchema, gn as preprocess, hn as object, i as BatteryStatusSchema, it as loadContributionCapability, jt as storageEvictableCapability, k as RecordingSignalStatusSchema, kt as resolveRecordingProfiles, ln as array, lt as mayWriteToLocation, mn as number, on as selectAssignedProfileSlots, qt as DeviceType, rn as nodePin, rt as isFirstLevelMacroClass, sn as sleep$1, un as boolean, ut as migrateLegacyDeviceSignalConfig, vn as string, wt as recordingSignalCapability } from "../dist-Dm1V0nJX.mjs";
2
- import { a as physicalRootOf, i as NO_COST_CLAIM, t as ChildCostRegistry } from "../node-B5haKIVa.mjs";
1
+ import { $t as hydrateSchema, C as OpsLogEntrySchema, Ct as recordingExportCapability, D as RECORDING_EXPORT_MAX_READ_BYTES, Dt as resolveLocationMode, H as deriveBatteryPresence, I as batteryCapability, Kt as DeviceFeature, Lt as errMsg, Mt as storageOccupancyCapability, O as RecordingConfigSchema, Pt as stripRetiredBandPreBufferSec, Q as evictionPolicyOfLocation, St as recordingCapability, W as deriveRecordingMode, Wt as BaseAddon, Xt as customAction, Y as evaluateSensorEdge, Z as evictionPolicyForMode, Zt as defineCustomActions, _n as record, bn as EventCategory, cn as _enum, ct as mayReadLocation, d as DEFAULT_EVENTS_BAND_BUFFER_SEC, dt as modeMayWrite, et as gbToBytes, g as ExportRecordSchema, gn as preprocess, hn as object, i as BatteryStatusSchema, it as loadContributionCapability, jt as storageEvictableCapability, k as RecordingSignalStatusSchema, kt as resolveRecordingProfiles, ln as array, lt as mayWriteToLocation, mn as number, on as selectAssignedProfileSlots, qt as DeviceType, rn as nodePin, rt as isFirstLevelMacroClass, sn as sleep$1, un as boolean, ut as migrateLegacyDeviceSignalConfig, vn as string, wt as recordingSignalCapability } from "../dist-Cqf-U6EN.mjs";
2
+ import { a as physicalRootOf, i as NO_COST_CLAIM, t as ChildCostRegistry } from "../node-jLmcbaar.mjs";
3
3
  import { t as resolveHubHostname } from "../hub-hostname-cCknRYKj.mjs";
4
4
  import { d as PREBUFFER_MAX_MS, l as withRecordingIntent, r as RECORDING_PRE_ROLL_REQUEST_MS } from "../restream-intent-DyGmLAU9.mjs";
5
5
  import { n as RowMapStore, t as retireRootKeys } from "../retire-root-keys-DZvlso2l.mjs";
@@ -1,5 +1,5 @@
1
1
  import { r as __toESM, t as __commonJSMin } from "./chunk-DnnnRqeS.mjs";
2
- import { Lt as errMsg } from "./dist-Dm1V0nJX.mjs";
2
+ import { Lt as errMsg } from "./dist-Cqf-U6EN.mjs";
3
3
  import { spawn } from "node:child_process";
4
4
  //#region ../../node_modules/mp4box/dist/mp4box.all.js
5
5
  var require_mp4box_all = /* @__PURE__ */ __commonJSMin(((exports) => {