@trillboards/edge-platform-rtsp 0.2.23 → 0.2.25

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.
@@ -0,0 +1,94 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
3
+ /// <reference types="node" />
4
+ import { EventEmitter } from 'events';
5
+ import type { MainStreamOutput, MainStreamOutputContext, MainStreamSessionEnd } from './MainStreamSession';
6
+ /**
7
+ * FaceZoneOutput — the face watchlist's capture (plan v7 T1): one output of the camera's MAIN-stream session
8
+ * (`MainStreamSession`), decoding the main stream and handing out only the face zone (the doorway the owner drew),
9
+ * at its native resolution, as JPEG frames at `fps` on the session's stdout.
10
+ *
11
+ * Why the main stream: on Texas cam 1's 800x448 substream a face has 2-9 px between the eyes (median 5.6), and the
12
+ * embedder confirms 45.7% of true matches at 6 px against 94.7% at 12 px (plan-v7 face research). The main stream
13
+ * projects ~21 px at 1920 wide, ~27 at 2560, ~41 at 3840.
14
+ *
15
+ * Why an output and not a session: a recorder admits a bounded number of concurrent main-stream pulls, so the
16
+ * camera has ONE main-stream session (its probe, its ring recording and this output share it; the session owns
17
+ * the process, the credentials file, admission, restarts and stderr). This output owns only its ffmpeg output
18
+ * arguments (`buildFaceZoneOutputArgs`) and what it writes: the session's stdout, which at most one output may
19
+ * claim. The look session keeps reading the substream exactly as before. Frames are SELECTED before the crop, so
20
+ * the decoder's work is the only per-frame cost of a frame nobody keeps.
21
+ */
22
+ export interface FaceZone {
23
+ x: number;
24
+ y: number;
25
+ width: number;
26
+ height: number;
27
+ }
28
+ export interface FaceZoneFrame {
29
+ jpeg: Buffer;
30
+ atMs: number;
31
+ seq: number;
32
+ }
33
+ /** What the output captures; null sits it out of the session. */
34
+ export interface FaceZoneCapture {
35
+ /** Normalised to the frame; null = the whole frame. */
36
+ zone: FaceZone | null;
37
+ fps: number;
38
+ /** JPEG quality 1-100; faces need detail. Default 90. */
39
+ jpegQuality?: number;
40
+ }
41
+ export interface FaceZoneOutputStats {
42
+ capturing: boolean;
43
+ /** Sessions this output joined (a zone or fps change, or a restart, is a new one). */
44
+ sessions: number;
45
+ frames: number;
46
+ lastFrameAtMs: number | null;
47
+ /** Frames over the size ceiling, dropped. */
48
+ oversizeFrames: number;
49
+ lastEnd: {
50
+ atMs: number;
51
+ exitCode: number | null;
52
+ progressed: boolean;
53
+ stopped: boolean;
54
+ } | null;
55
+ }
56
+ /**
57
+ * The face output of an ffmpeg session whose input `inputIndex` is the camera's main stream: `fps` frames selected
58
+ * first, then the zone cropped (even sizes, at native resolution), as MJPEG to `target`.
59
+ */
60
+ export declare function buildFaceZoneOutputArgs(o: {
61
+ inputIndex: number;
62
+ zone: FaceZone | null;
63
+ fps: number;
64
+ jpegQuality: number;
65
+ target: string;
66
+ ffmpegMajorVersion?: number;
67
+ }): string[];
68
+ export declare class FaceZoneOutput extends EventEmitter implements MainStreamOutput {
69
+ readonly name = "face";
70
+ readonly writesStdout = true;
71
+ /** It filters and encodes the main stream: the session decodes on the GPU where this host's probe says it can. */
72
+ readonly decodes = true;
73
+ private capture;
74
+ private readonly splitter;
75
+ private readonly now;
76
+ private seq;
77
+ private readonly stats;
78
+ constructor(options?: {
79
+ maxFrameBytes?: number;
80
+ now?: () => number;
81
+ });
82
+ /**
83
+ * Change what to capture (null: sit the session out). The session's `refresh` restarts it once when the
84
+ * arguments change; the caller asks for that (the camera's main stream owner does on every attach).
85
+ */
86
+ setCapture(next: FaceZoneCapture | null): void;
87
+ getCapture(): FaceZoneCapture | null;
88
+ getStats(): FaceZoneOutputStats;
89
+ plan(_ctx: MainStreamOutputContext): string | null;
90
+ outputArgs(ctx: MainStreamOutputContext): string[] | null;
91
+ onStdout(chunk: Buffer): void;
92
+ onSessionEnd(_ctx: MainStreamOutputContext, end: MainStreamSessionEnd): void;
93
+ }
94
+ //# sourceMappingURL=FaceZoneOutput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FaceZoneOutput.d.ts","sourceRoot":"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WAAW,EAAE,MAAM,CAAC;IACvH,MAAM,EAAE,MAAM,CAAC;IAAC,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,MAAM,EAAE,CAiBzD;AAED,qBAAa,cAAe,SAAQ,YAAa,YAAW,gBAAgB;IAC1E,QAAQ,CAAC,IAAI,UAAU;IACvB,QAAQ,CAAC,YAAY,QAAQ;IAC7B,kHAAkH;IAClH,QAAQ,CAAC,OAAO,QAAQ;IACxB,OAAO,CAAC,OAAO,CAA0C;IACzD,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAqB;IAC9C,OAAO,CAAC,QAAQ,CAAC,GAAG,CAAe;IACnC,OAAO,CAAC,GAAG,CAAK;IAChB,OAAO,CAAC,QAAQ,CAAC,KAAK,CACe;gBAEzB,OAAO,GAAE;QAAE,aAAa,CAAC,EAAE,MAAM,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAA;KAAO;IAMxE;;;OAGG;IACH,UAAU,CAAC,IAAI,EAAE,eAAe,GAAG,IAAI,GAAG,IAAI;IAO9C,UAAU,IAAI,eAAe,GAAG,IAAI;IAIpC,QAAQ,IAAI,mBAAmB;IAI/B,IAAI,CAAC,IAAI,EAAE,uBAAuB,GAAG,MAAM,GAAG,IAAI;IAKlD,UAAU,CAAC,GAAG,EAAE,uBAAuB,GAAG,MAAM,EAAE,GAAG,IAAI;IAUzD,QAAQ,CAAC,KAAK,EAAE,MAAM,GAAG,IAAI;IAW7B,YAAY,CAAC,IAAI,EAAE,uBAAuB,EAAE,GAAG,EAAE,oBAAoB,GAAG,IAAI;CAI7E"}
@@ -0,0 +1,91 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.FaceZoneOutput = exports.buildFaceZoneOutputArgs = void 0;
4
+ const events_1 = require("events");
5
+ const RTSPCameraProvider_1 = require("./RTSPCameraProvider");
6
+ const RTSPStreamCameraProvider_1 = require("./RTSPStreamCameraProvider");
7
+ /**
8
+ * The face output of an ffmpeg session whose input `inputIndex` is the camera's main stream: `fps` frames selected
9
+ * first, then the zone cropped (even sizes, at native resolution), as MJPEG to `target`.
10
+ */
11
+ function buildFaceZoneOutputArgs(o) {
12
+ const z = o.zone;
13
+ const crop = z
14
+ ? `,crop=floor(iw*${z.width}/2)*2:floor(ih*${z.height}/2)*2:floor(iw*${z.x}/2)*2:floor(ih*${z.y}/2)*2`
15
+ : '';
16
+ return [
17
+ '-map', `${o.inputIndex}:v:0`,
18
+ '-vf', `select='isnan(prev_selected_t)+gte(t-prev_selected_t,${1 / o.fps}-0.000001)'${crop}`,
19
+ // Every selected frame is written as it is (no duplication to a constant rate): the same split the frame
20
+ // path's own MJPEG output makes for ffmpeg before 5.
21
+ ...((o.ffmpegMajorVersion ?? 6) >= 5 ? ['-fps_mode', 'passthrough'] : ['-vsync', '0']),
22
+ '-f', 'mjpeg',
23
+ '-q:v', String((0, RTSPCameraProvider_1.mjpegQv)(o.jpegQuality)),
24
+ // One encoder thread: the session already binds one decoder thread before its input.
25
+ '-threads', '1',
26
+ o.target,
27
+ ];
28
+ }
29
+ exports.buildFaceZoneOutputArgs = buildFaceZoneOutputArgs;
30
+ class FaceZoneOutput extends events_1.EventEmitter {
31
+ constructor(options = {}) {
32
+ super();
33
+ this.name = 'face';
34
+ this.writesStdout = true;
35
+ /** It filters and encodes the main stream: the session decodes on the GPU where this host's probe says it can. */
36
+ this.decodes = true;
37
+ this.capture = null;
38
+ this.seq = 0;
39
+ this.stats = { capturing: false, sessions: 0, frames: 0, lastFrameAtMs: null,
40
+ oversizeFrames: 0, lastEnd: null };
41
+ this.splitter = new RTSPStreamCameraProvider_1.MjpegFrameSplitter(options.maxFrameBytes ?? 4 * 1024 * 1024);
42
+ this.now = options.now ?? Date.now;
43
+ }
44
+ /**
45
+ * Change what to capture (null: sit the session out). The session's `refresh` restarts it once when the
46
+ * arguments change; the caller asks for that (the camera's main stream owner does on every attach).
47
+ */
48
+ setCapture(next) {
49
+ this.capture = next && Number.isFinite(next.fps) && next.fps > 0
50
+ ? { zone: next.zone ? { ...next.zone } : null, fps: next.fps, jpegQuality: next.jpegQuality ?? 90 }
51
+ : null;
52
+ this.stats.capturing = this.capture !== null;
53
+ }
54
+ getCapture() {
55
+ return this.capture ? { ...this.capture, zone: this.capture.zone ? { ...this.capture.zone } : null } : null;
56
+ }
57
+ getStats() {
58
+ return { ...this.stats, oversizeFrames: this.splitter.getOversizeFrames() };
59
+ }
60
+ plan(_ctx) {
61
+ const c = this.capture;
62
+ return c ? JSON.stringify([c.zone, c.fps, c.jpegQuality]) : null;
63
+ }
64
+ outputArgs(ctx) {
65
+ const c = this.capture;
66
+ if (!c)
67
+ return null;
68
+ // A new session: whatever the last one left half-written is not a frame.
69
+ this.splitter.reset();
70
+ this.stats.sessions += 1;
71
+ return buildFaceZoneOutputArgs({ inputIndex: 0, zone: c.zone, fps: c.fps, jpegQuality: c.jpegQuality, target: 'pipe:1',
72
+ ffmpegMajorVersion: ctx.ffmpegMajorVersion });
73
+ }
74
+ onStdout(chunk) {
75
+ if (!this.capture)
76
+ return;
77
+ for (const jpeg of this.splitter.push(chunk)) {
78
+ const atMs = this.now();
79
+ this.stats.frames += 1;
80
+ this.stats.lastFrameAtMs = atMs;
81
+ const frame = { jpeg, atMs, seq: ++this.seq };
82
+ this.emit('frame', frame);
83
+ }
84
+ }
85
+ onSessionEnd(_ctx, end) {
86
+ this.splitter.reset();
87
+ this.stats.lastEnd = { atMs: this.now(), exitCode: end.exitCode, progressed: end.progressed, stopped: end.stopped };
88
+ }
89
+ }
90
+ exports.FaceZoneOutput = FaceZoneOutput;
91
+ //# sourceMappingURL=FaceZoneOutput.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"FaceZoneOutput.js","sourceRoot":"","sources":["../src/FaceZoneOutput.ts"],"names":[],"mappings":";;;AAAA,mCAAsC;AACtC,6DAA+C;AAC/C,yEAAgE;AA4ChE;;;GAGG;AACH,SAAgB,uBAAuB,CAAC,CACO;IAC7C,M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AI,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,GAAG,EAAE,EAAE,QAAQ,EAAE,GAAG,CAAC,QAAQ,EAAE,UAAU,EAAE,GAAG,CAAC,UAAU,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC;IACtH,CAAC;CACF;AAnED,wCAmEC"}
@@ -14,7 +14,9 @@ export declare class H264AccessUnits {
14
14
  push(chunk: Buffer): H264AccessUnit[];
15
15
  private scan;
16
16
  }
17
- export declare function liveViewRtspInput(rtspUrl: string): {
17
+ /** `copy` passes a camera's H.264 through; `transcode` makes H.264 from any other video codec (HEVC). */
18
+ export type LiveViewCaptureMode = 'copy' | 'transcode';
19
+ export declare function liveViewRtspInput(rtspUrl: string, mode?: LiveViewCaptureMode): {
18
20
  args: string[];
19
21
  input: string;
20
22
  };
@@ -28,7 +30,17 @@ export interface LiveViewCaptureDiagnostic {
28
30
  exitCode: number | null;
29
31
  rtspStatus: number | null;
30
32
  }
31
- /** Run in the owned media worker, inside its kill-on-close Windows job. */
33
+ /**
34
+ * Below the detector: a live view's ffmpeg never takes CPU from the computer's alert looks.
35
+ * The owned worker already runs below normal and Windows gives its children that class; this
36
+ * keeps it true for the transcode and for any other caller. A refusal never fails the view.
37
+ */
38
+ export declare function lowerLiveViewProcessPriority(pid: number | undefined): boolean;
39
+ /**
40
+ * Run in the owned media worker, inside its kill-on-close Windows job. Starts by copying the
41
+ * camera's stream; when ffmpeg's input description names another codec (HEVC), that copy
42
+ * cannot start, and the capture switches once to the transcode before any unit is sent.
43
+ */
32
44
  export declare function runLiveViewH264Capture({ ffmpegPath, rtspUrl, signal, onAccessUnit, onDiagnostic, }: {
33
45
  ffmpegPath: string;
34
46
  rtspUrl: string;
@@ -1 +1 @@
1
- {"version":3,"file":"LiveViewH264Capture.d.ts","sourceRoot":"","sources":["../src/LiveViewH264Capture.ts"],"names":[],"mappings":";;;AASA,MAAM,WAAW,cAAc;IAC7B,KAAK,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AAM,GAAG,SAAS,GAAG,OAAO,CAG7E;AAED;;;;GAIG;AACH,wBAAsB,sBAAsB,CAAC,EAC3C,UAAU,EAAE,OAAO,EAAE,MAAM,EAAE,YAAY,EAAE,YAAY,GACxD,EAAE;IACD,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,WAAW,CAAC;IACpB,YAAY,CAAC,KAAK,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACrE,YAAY,CAAC,CAAC,KAAK,EAAE,QAAQ,CAAC,yBAAyB,CAAC,GAAG,IAAI,CAAC;CACjE,GAAG,OAAO,CAAC,IAAI,CAAC,CA6GhB"}
@@ -1,13 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.runLiveViewH264Capture = exports.liveViewRtspInput = exports.H264AccessUnits = void 0;
3
+ exports.runLiveViewH264Capture = exports.lowerLiveViewProcessPriority = exports.liveViewRtspInput = exports.H264AccessUnits = void 0;
4
4
  const node_child_process_1 = require("node:child_process");
5
+ const node_os_1 = require("node:os");
5
6
  const RTSPCameraProvider_1 = require("./RTSPCameraProvider");
7
+ const RTSPStreamCameraProvider_1 = require("./RTSPStreamCameraProvider");
6
8
  const startCode = Buffer.of(0, 0, 1);
7
9
  const maxUnitBytes = 256 * 1024;
8
10
  const maxInputBlock = 64 * 1024;
9
11
  const cameraTimeoutMs = 4000;
10
- const firstUnitTimeoutMs = 10000;
12
+ // Bounds the camera's own keyframe wait (8 s GOPs exist in the field) plus one switch to
13
+ // the transcode. The capture starts after the relay connects; the viewer gives up 30 s
14
+ // after opening.
15
+ const firstUnitTimeoutMs = 20000;
11
16
  /** FFmpeg inserts AUD delimiters. Hold at most one incomplete unit. */
12
17
  class H264AccessUnits {
13
18
  constructor() {
@@ -69,7 +74,27 @@ function independentlyDecodable(bytes) {
69
74
  const required = (1 << 5) | (1 << 7) | (1 << 8);
70
75
  return (mask & required) === required;
71
76
  }
72
- function liveViewRtspInput(rtspUrl) {
77
+ // On the RTSP input (ffconcat options) and on the concat wrapper: open on the first packets
78
+ // instead of buffering ~3 s of video to estimate a frame rate nothing here uses. Measured on
79
+ // a 2 s-GOP camera: first keyframe out 3.3-4.0 s -> 0.4-1.4 s, the start burst 30 -> 3 frames.
80
+ const probeOptions = [
81
+ ['probesize', '32'], ['fflags', 'nobuffer'], ['analyzeduration', '100000'],
82
+ ];
83
+ // The decoder emits gray frames built on missing references until the camera's first
84
+ // keyframe; drop them so the first picture is a real one. Then at most 720p (H.264 level 3.1).
85
+ const transcodeFilter = 'select=st(0\\,max(ld(0)\\,key)),' +
86
+ 'scale=w=min(iw\\,1280):h=min(ih\\,720):force_original_aspect_ratio=decrease:force_divisible_by=2';
87
+ // One thread each way, <=800 kb/s: ~12% of one core for an 800x448 20 fps HEVC camera. Fixed
88
+ // parameter sets before every 2 s IDR keep the sender's guard (constant SPS, SPS first) and
89
+ // let a browser join or recover on any keyframe.
90
+ const transcodeOutput = [
91
+ '-vf', transcodeFilter, '-fps_mode', 'passthrough',
92
+ '-c:v', 'libx264', '-preset', 'ultrafast', '-tune', 'zerolatency', '-profile:v', 'high', '-level:v', '3.1',
93
+ '-pix_fmt', 'yuv420p', '-force_key_frames', 'expr:gte(t,n_forced*2)', '-bf', '0',
94
+ '-crf', '28', '-maxrate', '800k', '-bufsize', '400k', '-threads', '1', '-x264-params', 'repeat-headers=1',
95
+ '-an', '-sn', '-dn', '-bsf:v', 'h264_metadata=aud=insert',
96
+ ];
97
+ function liveViewRtspInput(rtspUrl, mode = 'copy') {
73
98
  if (!/^rtsps?:\/\//i.test(rtspUrl) || /[\x00-\x20\x7f]/.test(rtspUrl) || rtspUrl.length > 4096) {
74
99
  throw new Error('Invalid live-view RTSP feed.');
75
100
  }
@@ -78,55 +103,85 @@ function liveViewRtspInput(rtspUrl) {
78
103
  throw new Error('Invalid live-view RTSP feed.');
79
104
  return {
80
105
  args: [
81
- '-hide_banner', '-nostdin', '-loglevel', 'error', '-protocol_whitelist', 'pipe,crypto,tcp,tls,rtp,rtsp,udp',
82
- '-safe', '0', '-f', 'concat', '-i', 'pipe:0', '-map', '0:v:0', '-c:v', 'copy',
83
- // RTSP cameras can advertise SPS/PPS out of band in the SDP. Attach
84
- // that extradata to keyframes before inserting the framing delimiter.
85
- '-an', '-sn', '-dn', '-bsf:v', 'h264_mp4toannexb,dump_extra=freq=keyframe,h264_metadata=aud=insert',
106
+ // Info level prints the input description, which names the camera's codec.
107
+ '-hide_banner', '-nostdin', '-nostats', '-loglevel', 'info', '-protocol_whitelist', 'pipe,crypto,tcp,tls,rtp,rtsp,udp',
108
+ ...probeOptions.flatMap(([name, value]) => ['-' + name, value]),
109
+ ...(mode === 'transcode' ? ['-threads', '1'] : []),
110
+ '-safe', '0', '-f', 'concat', '-i', 'pipe:0', '-map', '0:v:0',
111
+ ...(mode === 'transcode' ? transcodeOutput : [
112
+ '-c:v', 'copy',
113
+ // RTSP cameras can advertise SPS/PPS out of band in the SDP. Attach
114
+ // that extradata to keyframes before inserting the framing delimiter.
115
+ '-an', '-sn', '-dn', '-bsf:v', 'h264_mp4toannexb,dump_extra=freq=keyframe,h264_metadata=aud=insert',
116
+ ]),
86
117
  '-f', 'h264', 'pipe:1',
87
118
  ],
88
119
  input: [
89
120
  'ffconcat version 1.0', "file '" + (0, RTSPCameraProvider_1.escapeFfconcatValue)(url.href) + "'",
90
- 'option rtsp_transport tcp', 'option timeout ' + cameraTimeoutMs * 1000, '',
121
+ 'option rtsp_transport tcp', 'option timeout ' + cameraTimeoutMs * 1000,
122
+ ...probeOptions.map(([name, value]) => 'option ' + name + ' ' + value), '',
91
123
  ].join('\n'),
92
124
  };
93
125
  }
94
126
  exports.liveViewRtspInput = liveViewRtspInput;
95
- /** Run in the owned media worker, inside its kill-on-close Windows job. */
127
+ /**
128
+ * Below the detector: a live view's ffmpeg never takes CPU from the computer's alert looks.
129
+ * The owned worker already runs below normal and Windows gives its children that class; this
130
+ * keeps it true for the transcode and for any other caller. A refusal never fails the view.
131
+ */
132
+ function lowerLiveViewProcessPriority(pid) {
133
+ if (!pid)
134
+ return false;
135
+ try {
136
+ (0, node_os_1.setPriority)(pid, node_os_1.constants.priority.PRIORITY_BELOW_NORMAL);
137
+ return true;
138
+ }
139
+ catch {
140
+ return false;
141
+ }
142
+ }
143
+ exports.lowerLiveViewProcessPriority = lowerLiveViewProcessPriority;
144
+ /**
145
+ * Run in the owned media worker, inside its kill-on-close Windows job. Starts by copying the
146
+ * camera's stream; when ffmpeg's input description names another codec (HEVC), that copy
147
+ * cannot start, and the capture switches once to the transcode before any unit is sent.
148
+ */
96
149
  async function runLiveViewH264Capture({ ffmpegPath, rtspUrl, signal, onAccessUnit, onDiagnostic, }) {
97
150
  if (signal.aborted)
98
151
  return;
99
- const { args, input } = liveViewRtspInput(rtspUrl);
100
- const parser = new H264AccessUnits();
152
+ liveViewRtspInput(rtspUrl);
153
+ let parser = new H264AccessUnits();
101
154
  const startedAt = performance.now();
102
155
  let reason = 'none';
103
156
  let inputBytes = 0, parsedUnits = 0, submittedUnits = 0;
104
157
  let rtspStatus = null;
105
158
  let stderrTail = '';
106
- const proc = (0, node_child_process_1.spawn)(ffmpegPath, args, { stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });
159
+ let proc = null;
160
+ let closed = Promise.resolve();
107
161
  const diagnostic = (stage) => {
108
162
  // Closed, bounded fields only: never include URLs, stderr or exception text.
163
+ const exitCode = proc && Number.isInteger(proc.exitCode) ? proc.exitCode : null;
109
164
  try {
110
165
  onDiagnostic?.(Object.freeze({ stage, reason, elapsedMs: Math.max(0, Math.floor(performance.now() - startedAt)),
111
- inputBytes, parsedUnits, submittedUnits, exitCode: Number.isInteger(proc.exitCode) ? proc.exitCode : null, rtspStatus }));
166
+ inputBytes, parsedUnits, submittedUnits, exitCode, rtspStatus }));
112
167
  }
113
168
  catch { /* A full disk or broken observer cannot interfere with cleanup. */ }
114
169
  };
115
- const closed = new Promise(resolve => proc.once('close', () => resolve()));
116
170
  let finishStop = () => undefined;
117
171
  const stopped = new Promise(resolve => { finishStop = resolve; });
118
172
  let stopping = false;
119
173
  let timer;
120
174
  let qualified = false;
121
175
  let timestamp = 0;
176
+ const kill = () => { if (proc && proc.exitCode === null && proc.signalCode === null)
177
+ proc.kill(); };
122
178
  const stop = () => {
123
179
  if (stopping)
124
180
  return;
125
181
  stopping = true;
126
182
  clearTimeout(timer);
127
183
  finishStop();
128
- if (proc.exitCode === null && proc.signalCode === null)
129
- proc.kill();
184
+ kill();
130
185
  };
131
186
  const fail = (next) => { if (reason === 'none')
132
187
  reason = next; stop(); };
@@ -136,53 +191,77 @@ async function runLiveViewH264Capture({ ffmpegPath, rtspUrl, signal, onAccessUni
136
191
  timer = setTimeout(() => fail(qualified ? 'frame_stall' : 'first_unit_timeout'), qualified ? cameraTimeoutMs : firstUnitTimeoutMs);
137
192
  timer.unref?.();
138
193
  };
139
- const stderr = (chunk) => {
140
- // Retain at most a tiny in-memory tail to handle status lines split across chunks.
141
- stderrTail = (stderrTail + chunk.toString('utf8')).slice(-512);
142
- const status = /(?:method [A-Z_]+ failed:|Server returned|returned)\s*(401|403|404|453|454)\b/i.exec(stderrTail);
143
- if (status)
144
- rtspStatus = Number(status[1]);
145
- };
146
194
  signal.addEventListener('abort', abort, { once: true });
147
- proc.on('error', () => fail('spawn_failed'));
148
- proc.stdin.on('error', () => fail('input_failed'));
149
- proc.stderr.on('data', stderr);
150
- proc.stderr.on('error', () => { });
151
195
  diagnostic('started');
152
196
  try {
153
197
  if (signal.aborted)
154
198
  abort();
155
199
  else {
156
200
  watch();
157
- proc.stdin.end(input);
158
- for await (const chunk of proc.stdout) {
159
- if (stopping || signal.aborted)
160
- break;
161
- inputBytes = Math.min(Number.MAX_SAFE_INTEGER, inputBytes + chunk.length);
162
- for (const unit of parser.push(chunk)) {
201
+ let mode = 'copy';
202
+ for (;;) {
203
+ const { args, input } = liveViewRtspInput(rtspUrl, mode);
204
+ const probe = new RTSPStreamCameraProvider_1.InputStreamProbe();
205
+ let codec = null;
206
+ const child = (0, node_child_process_1.spawn)(ffmpegPath, args, { stdio: ['pipe', 'pipe', 'pipe'], windowsHide: true });
207
+ lowerLiveViewProcessPriority(child.pid);
208
+ proc = child;
209
+ closed = new Promise(resolve => child.once('close', () => resolve()));
210
+ const stderr = (chunk) => {
211
+ const text = chunk.toString('utf8');
212
+ // Retain at most a tiny in-memory tail to handle status lines split across chunks.
213
+ stderrTail = (stderrTail + text).slice(-512);
214
+ const status = /(?:method [A-Z_]+ failed:|Server returned|returned)\s*(401|403|404|453|454)\b/i.exec(stderrTail);
215
+ if (status)
216
+ rtspStatus = Number(status[1]);
217
+ if (!probe.done)
218
+ codec = probe.push(text)?.codec ?? codec;
219
+ // Not H.264: this copy cannot start. End it; the loop below starts the transcode.
220
+ if (mode === 'copy' && codec !== null && codec !== 'h264' && !qualified &&
221
+ child.exitCode === null && child.signalCode === null)
222
+ child.kill();
223
+ };
224
+ child.on('error', () => fail('spawn_failed'));
225
+ child.stdin.on('error', () => fail('input_failed'));
226
+ child.stderr.on('data', stderr);
227
+ child.stderr.on('error', () => { });
228
+ child.stdin.end(input);
229
+ for await (const chunk of child.stdout) {
163
230
  if (stopping || signal.aborted)
164
231
  break;
165
- parsedUnits = Math.min(Number.MAX_SAFE_INTEGER, parsedUnits + 1);
166
- if (!qualified && !unit.randomAccess)
167
- continue;
168
- if (!qualified) {
169
- qualified = true;
170
- diagnostic('first_access_unit');
171
- }
172
- watch();
173
- timestamp = Math.max(timestamp + 1, Math.floor(performance.now() * 90));
174
- try {
175
- // Count only resolved submissions; a watchdog/abort winning the race is not a send.
176
- const sent = await Promise.race([Promise.resolve(onAccessUnit(unit.bytes, timestamp >>> 0)).then(() => true), stopped.then(() => false)]);
177
- if (sent)
178
- submittedUnits = Math.min(Number.MAX_SAFE_INTEGER, submittedUnits + 1);
179
- }
180
- catch (error) {
181
- if (reason === 'none')
182
- reason = 'submission_failed';
183
- throw error;
232
+ inputBytes = Math.min(Number.MAX_SAFE_INTEGER, inputBytes + chunk.length);
233
+ for (const unit of parser.push(chunk)) {
234
+ if (stopping || signal.aborted)
235
+ break;
236
+ parsedUnits = Math.min(Number.MAX_SAFE_INTEGER, parsedUnits + 1);
237
+ if (!qualified && !unit.randomAccess)
238
+ continue;
239
+ if (!qualified) {
240
+ qualified = true;
241
+ diagnostic('first_access_unit');
242
+ }
243
+ watch();
244
+ timestamp = Math.max(timestamp + 1, Math.floor(performance.now() * 90));
245
+ try {
246
+ // Count only resolved submissions; a watchdog/abort winning the race is not a send.
247
+ const sent = await Promise.race([Promise.resolve(onAccessUnit(unit.bytes, timestamp >>> 0)).then(() => true), stopped.then(() => false)]);
248
+ if (sent)
249
+ submittedUnits = Math.min(Number.MAX_SAFE_INTEGER, submittedUnits + 1);
250
+ }
251
+ catch (error) {
252
+ if (reason === 'none')
253
+ reason = 'submission_failed';
254
+ throw error;
255
+ }
184
256
  }
185
257
  }
258
+ // Every stderr byte has arrived once the process has closed.
259
+ await closed;
260
+ child.stderr.removeListener('data', stderr);
261
+ if (stopping || signal.aborted || mode !== 'copy' || qualified || codec === null || codec === 'h264')
262
+ break;
263
+ mode = 'transcode';
264
+ parser = new H264AccessUnits();
186
265
  }
187
266
  }
188
267
  if (!signal.aborted) {
@@ -202,7 +281,6 @@ async function runLiveViewH264Capture({ ffmpegPath, rtspUrl, signal, onAccessUni
202
281
  stop();
203
282
  signal.removeEventListener('abort', abort);
204
283
  await closed;
205
- proc.stderr.removeListener('data', stderr);
206
284
  stderrTail = '';
207
285
  diagnostic('ended');
208
286
  }
@@ -1 +1 @@
1
- {"version":3,"file":"LiveViewH264Capture.js","sourceRoot":"","sources":["../src/LiveViewH264Capture.ts"],"names":[],"mappings":";;;AAAA,2DAA2C;AAC3C,6DAA2D;AAE3D,MAAM,SAAS,GAAG,MAAM,CAAC,EAAE,CAAC,CAAC,EAAE,CAAC,EAA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