homebridge-plugin-utils 1.18.0 → 1.20.0

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.
@@ -69,15 +69,17 @@ export interface FfmpegOptionsConfig {
69
69
  *
70
70
  * These options control output bitrate, framerate, resolution, H.264 profile and level, input framerate, and smart quality optimizations.
71
71
  *
72
- * @property bitrate - Target video bitrate, in kilobits per second.
73
- * @property fps - Target output frames per second.
74
- * @property height - Output video height, in pixels.
75
- * @property idrInterval - Interval (in seconds) between keyframes (IDR frames).
76
- * @property inputFps - Input (source) frames per second.
77
- * @property level - H.264 profile level for output.
78
- * @property profile - H.264 profile for output.
79
- * @property useSmartQuality - Optional. If `true`, enables smart quality and variable bitrate optimizations. Defaults to `true`.
80
- * @property width - Output video width, in pixels.
72
+ * @property bitrate - Target video bitrate, in kilobits per second.
73
+ * @property fps - Target output frames per second.
74
+ * @property hardwareDecoding - Optional. If `true`, encoder options will account for hardware decoding (primarily for Intel QSV scenarios). Defaults to `true`.
75
+ * @property height - Output video height, in pixels.
76
+ * @property idrInterval - Interval (in seconds) between keyframes (IDR frames).
77
+ * @property inputFps - Input (source) frames per second.
78
+ * @property level - H.264 profile level for output.
79
+ * @property profile - H.264 profile for output.
80
+ * @property smartQuality - Optional and applicable only when not using hardware acceleration. If `true`, enables smart quality and variable bitrate optimizations.
81
+ * Defaults to `true`.
82
+ * @property width - Output video width, in pixels.
81
83
  *
82
84
  * @example
83
85
  *
@@ -86,12 +88,14 @@ export interface FfmpegOptionsConfig {
86
88
  *
87
89
  * bitrate: 3000,
88
90
  * fps: 30,
91
+ * hardwareDecoding: true,
92
+ * hardwareTranscoding: true,
89
93
  * height: 1080,
90
94
  * idrInterval: 2,
91
95
  * inputFps: 30,
92
96
  * level: H264Level.LEVEL4_0,
93
97
  * profile: H264Profile.HIGH,
94
- * useSmartQuality: true,
98
+ * smartQuality: true,
95
99
  * width: 1920
96
100
  * };
97
101
  *
@@ -108,12 +112,14 @@ export interface FfmpegOptionsConfig {
108
112
  export interface EncoderOptions {
109
113
  bitrate: number;
110
114
  fps: number;
115
+ hardwareDecoding?: boolean;
116
+ hardwareTranscoding?: boolean;
111
117
  height: number;
112
118
  idrInterval: number;
113
119
  inputFps: number;
114
120
  level: H264Level;
115
121
  profile: H264Profile;
116
- useSmartQuality?: boolean;
122
+ smartQuality?: boolean;
117
123
  width: number;
118
124
  }
119
125
  /**
@@ -131,12 +137,14 @@ export interface EncoderOptions {
131
137
  *
132
138
  * bitrate: 3000,
133
139
  * fps: 30,
140
+ * hardwareDecoding: true,
141
+ * hardwareTranscoding: true,
134
142
  * height: 1080,
135
143
  * idrInterval: 2,
136
144
  * inputFps: 30,
137
145
  * level: H264Level.LEVEL4_0,
138
146
  * profile: H264Profile.HIGH,
139
- * useSmartQuality: true,
147
+ * smartQuality: true,
140
148
  * width: 1920
141
149
  * };
142
150
  * const args = ffmpegOpts.streamEncoder(encoderOptions);
@@ -157,6 +165,10 @@ export declare class FfmpegOptions {
157
165
  *
158
166
  */
159
167
  codecSupport: FfmpegCodecs;
168
+ /**
169
+ * The configuration options used to initialize this instance.
170
+ */
171
+ readonly config: FfmpegOptionsConfig;
160
172
  /**
161
173
  * Indicates if debug logging is enabled.
162
174
  */
@@ -169,10 +181,6 @@ export declare class FfmpegOptions {
169
181
  * Function returning the name for this options instance to be used for logging.
170
182
  */
171
183
  readonly name: () => string;
172
- /**
173
- * The original options used to initialize this instance.
174
- */
175
- readonly options: FfmpegOptionsConfig;
176
184
  private readonly hwPixelFormat;
177
185
  /**
178
186
  * Creates an instance of Homebridge FFmpeg encoding and decoding options.
@@ -227,7 +235,7 @@ export declare class FfmpegOptions {
227
235
  * Returns the video decoder arguments to use for decoding video.
228
236
  *
229
237
  * @param codec - Optional. Codec to decode ("h264" or "hevc").
230
- * @returns Array of FFmpeg command-line arguments for video decoding.
238
+ * @returns Array of FFmpeg command-line arguments for video decoding or an empty array if the codec isn't supported.
231
239
  *
232
240
  * @example
233
241
  *
@@ -264,7 +272,7 @@ export declare class FfmpegOptions {
264
272
  * inputFps: 30,
265
273
  * level: H264Level.LEVEL3_1,
266
274
  * profile: H264Profile.MAIN,
267
- * useSmartQuality: true,
275
+ * smartQuality: true,
268
276
  * width: 1280
269
277
  * };
270
278
  *
@@ -18,12 +18,14 @@ import { HOMEKIT_STREAMING_HEADROOM, RPI_GPU_MINIMUM } from "./settings.js";
18
18
  *
19
19
  * bitrate: 3000,
20
20
  * fps: 30,
21
+ * hardwareDecoding: true,
22
+ * hardwareTranscoding: true,
21
23
  * height: 1080,
22
24
  * idrInterval: 2,
23
25
  * inputFps: 30,
24
26
  * level: H264Level.LEVEL4_0,
25
27
  * profile: H264Profile.HIGH,
26
- * useSmartQuality: true,
28
+ * smartQuality: true,
27
29
  * width: 1920
28
30
  * };
29
31
  * const args = ffmpegOpts.streamEncoder(encoderOptions);
@@ -44,6 +46,10 @@ export class FfmpegOptions {
44
46
  *
45
47
  */
46
48
  codecSupport;
49
+ /**
50
+ * The configuration options used to initialize this instance.
51
+ */
52
+ config;
47
53
  /**
48
54
  * Indicates if debug logging is enabled.
49
55
  */
@@ -56,10 +62,6 @@ export class FfmpegOptions {
56
62
  * Function returning the name for this options instance to be used for logging.
57
63
  */
58
64
  name;
59
- /**
60
- * The original options used to initialize this instance.
61
- */
62
- options;
63
65
  hwPixelFormat;
64
66
  /**
65
67
  * Creates an instance of Homebridge FFmpeg encoding and decoding options.
@@ -74,11 +76,11 @@ export class FfmpegOptions {
74
76
  */
75
77
  constructor(options) {
76
78
  this.codecSupport = options.codecSupport;
79
+ this.config = options;
77
80
  this.debug = options.debug ?? false;
78
81
  this.hwPixelFormat = [];
79
82
  this.log = options.log;
80
83
  this.name = options.name;
81
- this.options = options;
82
84
  // Configure our hardware acceleration support.
83
85
  this.configureHwAccel();
84
86
  }
@@ -111,23 +113,23 @@ export class FfmpegOptions {
111
113
  // Utility to return which hardware acceleration features are currently available to us.
112
114
  const accelCategories = () => {
113
115
  const categories = [];
114
- if (this.options.hardwareDecoding) {
116
+ if (this.config.hardwareDecoding) {
115
117
  categories.push("decoding");
116
118
  }
117
- if (this.options.hardwareTranscoding) {
119
+ if (this.config.hardwareTranscoding) {
118
120
  categories.push("transcoding");
119
121
  }
120
122
  return categories.join(" and ");
121
123
  };
122
124
  // Hardware-accelerated decoding is enabled by default, where supported. Let's select the decoder options accordingly where supported.
123
- if (this.options.hardwareDecoding) {
125
+ if (this.config.hardwareDecoding) {
124
126
  // Utility function to check that we have a specific decoder codec available to us.
125
127
  // eslint-disable-next-line @typescript-eslint/no-unused-vars
126
128
  const validateDecoder = (codec, pixelFormat) => {
127
- if (!this.options.codecSupport.hasDecoder("h264", codec)) {
129
+ if (!this.config.codecSupport.hasDecoder("h264", codec)) {
128
130
  this.log.error("Unable to enable hardware-accelerated decoding. Your video processor does not have support for the " + codec + " decoder. " +
129
131
  "Using software decoding instead.");
130
- this.options.hardwareDecoding = false;
132
+ this.config.hardwareDecoding = false;
131
133
  return false;
132
134
  }
133
135
  this.hwPixelFormat.push(...pixelFormat);
@@ -135,10 +137,10 @@ export class FfmpegOptions {
135
137
  };
136
138
  // Utility function to check that we have a specific decoder codec available to us.
137
139
  const validateHwAccel = (accel, pixelFormat) => {
138
- if (!this.options.codecSupport.hasHwAccel(accel)) {
140
+ if (!this.config.codecSupport.hasHwAccel(accel)) {
139
141
  this.log.error("Unable to enable hardware-accelerated decoding. Your video processor does not have support for the " + accel + " hardware accelerator. " +
140
142
  "Using software decoding instead.");
141
- this.options.hardwareDecoding = false;
143
+ this.config.hardwareDecoding = false;
142
144
  return false;
143
145
  }
144
146
  this.hwPixelFormat.push(...pixelFormat);
@@ -152,31 +154,31 @@ export class FfmpegOptions {
152
154
  break;
153
155
  case "raspbian":
154
156
  // If it's less than the minimum hardware GPU memory we need on an Raspberry Pi, we revert back to our default decoder.
155
- if (this.options.codecSupport.gpuMem < RPI_GPU_MINIMUM) {
157
+ if (this.config.codecSupport.gpuMem < RPI_GPU_MINIMUM) {
156
158
  this.log.info("Disabling hardware-accelerated %s. Adjust the GPU memory configuration on your Raspberry Pi to at least %s MB to enable it.", accelCategories(), RPI_GPU_MINIMUM);
157
- this.options.hardwareDecoding = false;
158
- this.options.hardwareTranscoding = false;
159
+ this.config.hardwareDecoding = false;
160
+ this.config.hardwareTranscoding = false;
159
161
  return false;
160
162
  }
161
163
  // Verify that we have the hardware decoder available to us. Unfortunately, at the moment, it seems that hardware decoding is flaky, at best, on Raspberry Pi.
162
164
  // validateDecoder("h264_mmal", [ "mmal", "yuv420p" ]);
163
165
  // validateDecoder("h264_v4l2m2ml", [ "yuv420p" ]);
164
- this.options.hardwareDecoding = false;
166
+ this.config.hardwareDecoding = false;
165
167
  break;
166
168
  default:
167
169
  // Back to software decoding unless we're on a known system that always supports hardware decoding.
168
- this.options.hardwareDecoding = false;
170
+ this.config.hardwareDecoding = false;
169
171
  break;
170
172
  }
171
173
  }
172
174
  // If we've enabled hardware-accelerated transcoding, let's select the encoder options accordingly where supported.
173
- if (this.options.hardwareTranscoding) {
175
+ if (this.config.hardwareTranscoding) {
174
176
  // Utility function to check that we have a specific encoder codec available to us.
175
177
  const validateEncoder = (codec) => {
176
- if (!this.options.codecSupport.hasEncoder("h264", codec)) {
178
+ if (!this.config.codecSupport.hasEncoder("h264", codec)) {
177
179
  this.log.error("Unable to enable hardware-accelerated transcoding. Your video processor does not have support for the " + codec + " encoder. " +
178
180
  "Using software transcoding instead.");
179
- this.options.hardwareTranscoding = false;
181
+ this.config.hardwareTranscoding = false;
180
182
  return false;
181
183
  }
182
184
  return true;
@@ -187,7 +189,7 @@ export class FfmpegOptions {
187
189
  // Verify that we have the hardware encoder available to us.
188
190
  validateEncoder("h264_videotoolbox");
189
191
  // Validate that we have access to the AudioToolbox AAC encoder.
190
- if (!this.options.codecSupport.hasEncoder("aac", "aac_at")) {
192
+ if (!this.config.codecSupport.hasEncoder("aac", "aac_at")) {
191
193
  this.log.error("Your video processor does not have support for the native macOS AAC encoder, aac_at. Will attempt to use libfdk_aac instead.");
192
194
  }
193
195
  break;
@@ -203,26 +205,26 @@ export class FfmpegOptions {
203
205
  break;
204
206
  default:
205
207
  // Let's see if we have Intel QuickSync hardware decoding available to us.
206
- if (this.options.codecSupport.hasHwAccel("qsv") &&
207
- this.options.codecSupport.hasDecoder("h264", "h264_qsv") && this.options.codecSupport.hasEncoder("h264", "h264_qsv") &&
208
- this.options.codecSupport.hasDecoder("hevc", "hevc_qsv") && this.options.codecSupport.hasEncoder("hevc", "hevc_qsv")) {
209
- this.options.hardwareDecoding = true;
208
+ if (this.config.codecSupport.hasHwAccel("qsv") &&
209
+ this.config.codecSupport.hasDecoder("h264", "h264_qsv") && this.config.codecSupport.hasEncoder("h264", "h264_qsv") &&
210
+ this.config.codecSupport.hasDecoder("hevc", "hevc_qsv") && this.config.codecSupport.hasEncoder("hevc", "hevc_qsv")) {
211
+ this.config.hardwareDecoding = true;
210
212
  this.hwPixelFormat.push("qsv", "yuv420p");
211
213
  logMessage = "Intel Quick Sync Video";
212
214
  }
213
215
  else {
214
216
  // Back to software encoding.
215
- this.options.hardwareDecoding = false;
216
- this.options.hardwareTranscoding = false;
217
+ this.config.hardwareDecoding = false;
218
+ this.config.hardwareTranscoding = false;
217
219
  }
218
220
  break;
219
221
  }
220
222
  }
221
223
  // Inform the user.
222
- if (this.options.hardwareDecoding || this.options.hardwareTranscoding) {
224
+ if (this.config.hardwareDecoding || this.config.hardwareTranscoding) {
223
225
  this.log.info("Hardware-accelerated " + accelCategories() + " enabled" + (logMessage.length ? ": " + logMessage : "") + ".");
224
226
  }
225
- return this.options.hardwareTranscoding;
227
+ return this.config.hardwareTranscoding;
226
228
  }
227
229
  /**
228
230
  * Returns the audio encoder arguments to use when transcoding.
@@ -235,15 +237,15 @@ export class FfmpegOptions {
235
237
  // Utility function to return a default audio encoder codec.
236
238
  const defaultAudioEncoderOptions = () => {
237
239
  const audioOptions = [];
238
- if (this.options.codecSupport.hasEncoder("aac", "libfdk_aac")) {
240
+ if (this.config.codecSupport.hasEncoder("aac", "libfdk_aac")) {
239
241
  // Default to libfdk_aac since FFmpeg doesn't natively support AAC-ELD. We use the following options by default:
240
242
  //
241
- // -acodec libfdk_aac Use the libfdk_aac encoder.
243
+ // -codec:a libfdk_aac Use the libfdk_aac encoder.
242
244
  // -afterburner 1 Increases audio quality at the expense of needing a little bit more computational power in libfdk_aac.
243
245
  // -eld_v2 1 Use the enhanced low delay v2 standard for better audio characteristics.
244
- audioOptions.push("-acodec", "libfdk_aac", "-afterburner", "1", "-eld_v2", "1");
246
+ audioOptions.push("-codec:a", "libfdk_aac", "-afterburner", "1", "-eld_v2", "1");
245
247
  // If we're using Jellyfin's FFmpeg, it's libfdk_aac is broken and crashes when using spectral band replication.
246
- if (!/-Jellyfin$/i.test(this.options.codecSupport.ffmpegVersion)) {
248
+ if (!/-Jellyfin$/.test(this.config.codecSupport.ffmpegVersion)) {
247
249
  // -eld_sbr 1 Use spectral band replication to further enhance audio.
248
250
  audioOptions.push("-eld_sbr", "1");
249
251
  }
@@ -254,16 +256,16 @@ export class FfmpegOptions {
254
256
  case "macOS.Apple":
255
257
  case "macOS.Intel":
256
258
  // If we don't have audiotoolbox available, let's default back to libfdk_aac.
257
- if (!this.options.codecSupport.hasEncoder("aac", "aac_at")) {
259
+ if (!this.config.codecSupport.hasEncoder("aac", "aac_at")) {
258
260
  encoderOptions = defaultAudioEncoderOptions();
259
261
  break;
260
262
  }
261
263
  // aac_at is the macOS audio encoder API. We use the following options:
262
264
  //
263
- // -acodec aac_at Use the aac_at encoder on macOS.
265
+ // -codec:a aac_at Use the aac_at encoder on macOS.
264
266
  // -aac_at_mode cvbr Use the constrained variable bitrate setting to allow the encoder to optimize audio within the requested bitrates.
265
267
  encoderOptions = [
266
- "-acodec", "aac_at",
268
+ "-codec:a", "aac_at",
267
269
  "-aac_at_mode", "cvbr"
268
270
  ];
269
271
  break;
@@ -285,7 +287,7 @@ export class FfmpegOptions {
285
287
  * Returns the video decoder arguments to use for decoding video.
286
288
  *
287
289
  * @param codec - Optional. Codec to decode ("h264" or "hevc").
288
- * @returns Array of FFmpeg command-line arguments for video decoding.
290
+ * @returns Array of FFmpeg command-line arguments for video decoding or an empty array if the codec isn't supported.
289
291
  *
290
292
  * @example
291
293
  *
@@ -294,26 +296,33 @@ export class FfmpegOptions {
294
296
  * ```
295
297
  */
296
298
  videoDecoder(codec = "h264") {
297
- codec = codec.toLowerCase();
298
- switch (codec) {
299
+ switch (codec.toLowerCase()) {
300
+ case "h264":
301
+ codec = "h264";
302
+ break;
299
303
  case "h265":
300
304
  case "hevc":
301
305
  codec = "hevc";
302
306
  break;
303
307
  default:
304
- codec = "h264";
305
- break;
308
+ // If it's unknown to us, we bail out.
309
+ return [];
306
310
  }
311
+ // Intel QSV decoder to codec mapping.
312
+ const QSV_DECODER = {
313
+ "h264": "h264_qsv",
314
+ "hevc": "hevc_qsv"
315
+ };
307
316
  // Default to no special decoder options for inbound streams.
308
317
  let decoderOptions = [];
309
318
  // If we've enabled hardware-accelerated transcoding, let's select decoder options accordingly where supported.
310
- if (this.options.hardwareDecoding) {
319
+ if (this.config.hardwareDecoding) {
311
320
  switch (this.codecSupport.hostSystem) {
312
321
  case "macOS.Apple":
313
322
  case "macOS.Intel":
314
323
  // h264_videotoolbox is the macOS hardware decoder and encoder API. We use the following options for decoding video:
315
324
  //
316
- // -hwaccel videotoolbox Select Video Toolbox for hardware-accelerated H.264 decoding.
325
+ // -hwaccel videotoolbox Select Video Toolbox for hardware-accelerated H.264 decoding.
317
326
  decoderOptions = [
318
327
  "-hwaccel", "videotoolbox"
319
328
  ];
@@ -321,20 +330,20 @@ export class FfmpegOptions {
321
330
  case "raspbian":
322
331
  // h264_mmal is the preferred Raspberry Pi hardware decoder codec. We use the following options for decoding video:
323
332
  //
324
- // -c:v h264_mmal Select the Multimedia Abstraction Layer codec for hardware-accelerated H.264 processing.
333
+ // -codec:v h264_mmal Select the Multimedia Abstraction Layer codec for hardware-accelerated H.264 processing.
325
334
  decoderOptions = [
326
- // "-c:v", "h264_mmal"
335
+ // "-codec:v", "h264_mmal"
327
336
  ];
328
337
  break;
329
338
  default:
330
339
  // h264_qsv is the Intel Quick Sync Video hardware encoder and decoder.
331
340
  //
332
- // -hwaccel qsv Select Quick Sync Video to enable hardware-accelerated H.264 decoding.
333
- // -c:v h264_qsv or hevc_qsv Select the Quick Sync Video codec for hardware-accelerated H.264 or HEVC processing.
341
+ // -hwaccel qsv Select Quick Sync Video to enable hardware-accelerated H.264 decoding.
342
+ // -codec:v h264_qsv or hevc_qsv Select the Quick Sync Video codec for hardware-accelerated H.264 or HEVC processing.
334
343
  decoderOptions = [
335
344
  "-hwaccel", "qsv",
336
345
  "-hwaccel_output_format", "qsv",
337
- "-c:v", (codec === "hevc") ? "hevc_qsv" : "h264_qsv"
346
+ "-codec:v", QSV_DECODER[codec]
338
347
  ];
339
348
  break;
340
349
  }
@@ -348,15 +357,15 @@ export class FfmpegOptions {
348
357
  */
349
358
  get cropFilter() {
350
359
  // If we haven't enabled cropping, tell the crop filter to do nothing.
351
- if (!this.options.crop) {
360
+ if (!this.config.crop) {
352
361
  return "crop=w=iw*100:h=ih*100:x=iw*0:y=ih*0";
353
362
  }
354
363
  // Generate our crop filter based on what the user has configured.
355
364
  return "crop=" + [
356
- "w=iw*" + this.options.crop.width.toString(),
357
- "h=ih*" + this.options.crop.height.toString(),
358
- "x=iw*" + this.options.crop.x.toString(),
359
- "y=ih*" + this.options.crop.y.toString()
365
+ "w=iw*" + this.config.crop.width.toString(),
366
+ "h=ih*" + this.config.crop.height.toString(),
367
+ "x=iw*" + this.config.crop.x.toString(),
368
+ "y=ih*" + this.config.crop.y.toString()
360
369
  ].join(":");
361
370
  }
362
371
  /**
@@ -381,7 +390,7 @@ export class FfmpegOptions {
381
390
  * inputFps: 30,
382
391
  * level: H264Level.LEVEL3_1,
383
392
  * profile: H264Profile.MAIN,
384
- * useSmartQuality: true,
393
+ * smartQuality: true,
385
394
  * width: 1280
386
395
  * };
387
396
  *
@@ -393,7 +402,7 @@ export class FfmpegOptions {
393
402
  defaultVideoEncoderOptions(options) {
394
403
  const videoFilters = [];
395
404
  // Default smart quality to true unless specified.
396
- options = Object.assign({}, { useSmartQuality: true }, options);
405
+ options = Object.assign({}, { smartQuality: true }, options);
397
406
  // Set our FFmpeg video filter options:
398
407
  //
399
408
  // format= Set the pixel formats we want to target for output.
@@ -408,7 +417,7 @@ export class FfmpegOptions {
408
417
  }
409
418
  // Default to the tried-and-true libx264. We use the following options by default:
410
419
  //
411
- // -c:v libx264 Use the excellent libx264 H.264 encoder.
420
+ // -codec:v libx264 Use the excellent libx264 H.264 encoder.
412
421
  // -preset veryfast Use the veryfast encoding preset in libx264, which provides a good balance of encoding speed and quality.
413
422
  // -profile:v Use the H.264 profile that HomeKit is requesting when encoding.
414
423
  // -level:v Use the H.264 profile level that HomeKit is requesting when encoding.
@@ -422,7 +431,7 @@ export class FfmpegOptions {
422
431
  // -maxrate bitrate The maximum bitrate tolerance, used with -bufsize. This provides an upper bound on bitrate, with a little bit extra to
423
432
  // allow encoders some variation in order to maximize quality while honoring bandwidth constraints.
424
433
  const encoderOptions = [
425
- "-c:v", "libx264",
434
+ "-codec:v", "libx264",
426
435
  "-preset", "veryfast",
427
436
  "-profile:v", this.getH264Profile(options.profile),
428
437
  "-level:v", this.getH264Level(options.level),
@@ -431,12 +440,12 @@ export class FfmpegOptions {
431
440
  "-filter:v", videoFilters.join(", "),
432
441
  "-g:v", (options.fps * options.idrInterval).toString(),
433
442
  "-bufsize", (2 * options.bitrate).toString() + "k",
434
- "-maxrate", (options.bitrate + (options.useSmartQuality ? HOMEKIT_STREAMING_HEADROOM : 0)).toString() + "k"
443
+ "-maxrate", (options.bitrate + (options.smartQuality ? HOMEKIT_STREAMING_HEADROOM : 0)).toString() + "k"
435
444
  ];
436
445
  // Using libx264's constant rate factor mode produces generally better results across the board. We use a capped CRF approach, allowing libx264 to
437
446
  // make intelligent choices about how to adjust bitrate to achieve a certain quality level depending on the complexity of the scene being encoded, but
438
447
  // constraining it to a maximum bitrate to stay within the bandwidth constraints HomeKit is requesting.
439
- if (options.useSmartQuality) {
448
+ if (options.smartQuality) {
440
449
  // -crf 20 Use a constant rate factor of 20, to allow libx264 the ability to vary bitrates to achieve the visual quality we
441
450
  // want, constrained by our maximum bitrate.
442
451
  encoderOptions.push("-crf", "20");
@@ -459,7 +468,7 @@ export class FfmpegOptions {
459
468
  */
460
469
  recordEncoder(options) {
461
470
  // We always disable smart quality when recording due to HomeKit's strict requirements here.
462
- options.useSmartQuality = false;
471
+ options.smartQuality = false;
463
472
  // Generaly, we default to using the same encoding options we use to transcode livestreams, unless we have platform-specific quirks we need to address,
464
473
  // such as where we can have hardware-accelerated transcoded livestreaming, but not hardware-accelerated HKSV event recording. The other noteworthy
465
474
  // aspect here is that HKSV is quite specific in what it wants, and isn't vary tolerant of creative license in how you may choose to alter bitrate to
@@ -487,23 +496,21 @@ export class FfmpegOptions {
487
496
  * ```
488
497
  */
489
498
  streamEncoder(options) {
490
- // Default smart quality to true.
491
- if (options.useSmartQuality === undefined) {
492
- options.useSmartQuality = true;
493
- }
499
+ // Default hardware decoding and smart quality to true unless specified.
500
+ options = Object.assign({}, { hardwareDecoding: true, hardwareTranscoding: this.config.hardwareTranscoding, smartQuality: true }, options);
494
501
  // In case we don't have a defined pixel format.
495
502
  if (!this.hwPixelFormat.length) {
496
503
  this.hwPixelFormat.push("yuvj420p");
497
504
  }
498
505
  // If we aren't hardware-accelerated, we default to libx264.
499
- if (!this.options.hardwareTranscoding) {
506
+ if (!this.config.hardwareTranscoding || !options.hardwareTranscoding) {
500
507
  return this.defaultVideoEncoderOptions(options);
501
508
  }
502
509
  // If we've enabled hardware-accelerated transcoding, let's select encoder options accordingly.
503
510
  //
504
511
  // We begin by adjusting the maximum bitrate tolerance used with -bufsize. This provides an upper bound on bitrate, with a little bit extra to allow encoders some
505
512
  // variation in order to maximize quality while honoring bandwidth constraints.
506
- const adjustedMaxBitrate = options.bitrate + (options.useSmartQuality ? HOMEKIT_STREAMING_HEADROOM : 0);
513
+ const adjustedMaxBitrate = options.bitrate + (options.smartQuality ? HOMEKIT_STREAMING_HEADROOM : 0);
507
514
  // Check the input and output frame rates to see if we need to change it.
508
515
  const useFpsFilter = options.fps !== options.inputFps;
509
516
  // Initialize our options.
@@ -517,7 +524,7 @@ export class FfmpegOptions {
517
524
  // a power of two.
518
525
  videoFilters.push("scale=-2:min(ih\\," + options.height.toString() + ")");
519
526
  // Crop the stream, if the user has requested it.
520
- if (this.options.crop) {
527
+ if (this.config.crop) {
521
528
  videoFilters.push(this.cropFilter);
522
529
  }
523
530
  // fps=fps= Use the fps filter to provide the frame rate requested by HomeKit. This has better performance characteristics rather than using
@@ -529,7 +536,7 @@ export class FfmpegOptions {
529
536
  case "macOS.Apple":
530
537
  // h264_videotoolbox is the macOS hardware encoder API. We use the following options on Apple Silicon:
531
538
  //
532
- // -c:v Specify the macOS hardware encoder, h264_videotoolbox.
539
+ // -codec:v Specify the macOS hardware encoder, h264_videotoolbox.
533
540
  // -allow_sw 1 Allow the use of the software encoder if the hardware encoder is occupied or unavailable.
534
541
  // This allows us to scale when we get multiple streaming requests simultaneously and consume all the available encode engines.
535
542
  // -realtime 1 We prefer speed over quality - if the encoder has to make a choice, sacrifice one for the other.
@@ -545,8 +552,8 @@ export class FfmpegOptions {
545
552
  // livestreamng exerience.
546
553
  // -bufsize size This is the decoder buffer size, which drives the variability / quality of the output bitrate.
547
554
  // -maxrate bitrate The maximum bitrate tolerance used in concert with -bufsize to constrain the maximum bitrate permitted.
548
- encoderOptions.push("-c:v", "h264_videotoolbox", "-allow_sw", "1", "-realtime", "1", "-coder", "cabac", "-profile:v", this.getH264Profile(options.profile), "-level:v", "0", "-bf", "0", "-noautoscale", "-filter:v", videoFilters.join(", "), "-g:v", (options.fps * options.idrInterval).toString(), "-bufsize", (2 * options.bitrate).toString() + "k", "-maxrate", adjustedMaxBitrate.toString() + "k");
549
- if (options.useSmartQuality) {
555
+ encoderOptions.push("-codec:v", "h264_videotoolbox", "-allow_sw", "1", "-realtime", "1", "-coder", "cabac", "-profile:v", this.getH264Profile(options.profile), "-level:v", "0", "-bf", "0", "-noautoscale", "-filter:v", videoFilters.join(", "), "-g:v", (options.fps * options.idrInterval).toString(), "-bufsize", (2 * options.bitrate).toString() + "k", "-maxrate", adjustedMaxBitrate.toString() + "k");
556
+ if (options.smartQuality) {
550
557
  // -q:v 90 Use a fixed quality scale of 90, to allow videotoolbox the ability to vary bitrates to achieve the visual quality we want,
551
558
  // constrained by our maximum bitrate. This is an Apple Silicon-specific feature.
552
559
  encoderOptions.push("-q:v", "90");
@@ -559,7 +566,7 @@ export class FfmpegOptions {
559
566
  case "macOS.Intel":
560
567
  // h264_videotoolbox is the macOS hardware encoder API. We use the following options on Intel-based Macs:
561
568
  //
562
- // -c:v Specify the macOS hardware encoder, h264_videotoolbox.
569
+ // -codec:v Specify the macOS hardware encoder, h264_videotoolbox.
563
570
  // -allow_sw 1 Allow the use of the software encoder if the hardware encoder is occupied or unavailable.
564
571
  // This allows us to scale when we get multiple streaming requests simultaneously that can consume all the available encode engines.
565
572
  // -realtime 1 We prefer speed over quality - if the encoder has to make a choice, sacrifice one for the other.
@@ -578,7 +585,7 @@ export class FfmpegOptions {
578
585
  // -bufsize size This is the decoder buffer size, which drives the variability / quality of the output bitrate.
579
586
  // -maxrate bitrate The maximum bitrate tolerance used in concert with -bufsize to constrain the maximum bitrate permitted.
580
587
  return [
581
- "-c:v", "h264_videotoolbox",
588
+ "-codec:v", "h264_videotoolbox",
582
589
  "-allow_sw", "1",
583
590
  "-realtime", "1",
584
591
  "-coder", "cabac",
@@ -595,7 +602,7 @@ export class FfmpegOptions {
595
602
  case "raspbian":
596
603
  // h264_v4l2m2m is the preferred interface to the Raspberry Pi hardware encoder API. We use the following options:
597
604
  //
598
- // -c:v Specify the Raspberry Pi hardware encoder, h264_v4l2m2m.
605
+ // -codec:v Specify the Raspberry Pi hardware encoder, h264_v4l2m2m.
599
606
  // -noautoscale Don't attempt to scale the video stream automatically.
600
607
  // -filter:v Set the pixel format, adjust the frame rate if needed, and scale the video to the size we want while respecting aspect ratios and
601
608
  // ensuring our final dimensions are a power of two.
@@ -606,7 +613,7 @@ export class FfmpegOptions {
606
613
  // -bufsize size This is the decoder buffer size, which drives the variability / quality of the output bitrate.
607
614
  // -maxrate bitrate The maximum bitrate tolerance used in concert with -bufsize to constrain the maximum bitrate permitted.
608
615
  return [
609
- "-c:v", "h264_v4l2m2m",
616
+ "-codec:v", "h264_v4l2m2m",
610
617
  "-profile:v", this.getH264Profile(options.profile, true),
611
618
  "-bf", "0",
612
619
  "-noautoscale",
@@ -622,9 +629,10 @@ export class FfmpegOptions {
622
629
  videoFilters = [];
623
630
  // We execute the following GPU-accelerated operations using the Quick Sync Video post-processing filter:
624
631
  //
632
+ // hwupload If we aren't hardware decoding, we need to upload decoded frames to QSV to process them.
625
633
  // format=same Set the output pixel format to the same as the input, since it's already in the GPU.
626
634
  // w=...:h... Scale the video to the size that's being requested while respecting aspect ratios.
627
- videoFilters.push("vpp_qsv=" + [
635
+ videoFilters.push((options.hardwareDecoding ? "" : "hwupload,") + "vpp_qsv=" + [
628
636
  "format=same",
629
637
  "w=min(iw\\, (iw / ih) * " + options.height.toString() + ")",
630
638
  "h=min(ih\\, " + options.height.toString() + ")"
@@ -636,7 +644,7 @@ export class FfmpegOptions {
636
644
  }
637
645
  // h264_qsv is the Intel Quick Sync Video hardware encoder API. We use the following options:
638
646
  //
639
- // -c:v Specify the Intel Quick Sync Video hardware encoder, h264_qsv.
647
+ // -codec:v Specify the Intel Quick Sync Video hardware encoder, h264_qsv.
640
648
  // -profile:v Use the H.264 profile that HomeKit is requesting when encoding.
641
649
  // -level:v 0 We override what HomeKit requests for the H.264 profile level when we're using hardware-accelerated transcoding because
642
650
  // the hardware encoder will determine which levels to use. Setting it to 0 allows the encoder to decide for itself.
@@ -650,8 +658,8 @@ export class FfmpegOptions {
650
658
  // livestreamng exerience.
651
659
  // -bufsize size This is the decoder buffer size, which drives the variability / quality of the output bitrate.
652
660
  // -maxrate bitrate The maximum bitrate tolerance used in concert with -bufsize to constrain the maximum bitrate permitted.
653
- encoderOptions.push("-c:v", "h264_qsv", "-profile:v", this.getH264Profile(options.profile), "-level:v", "0", "-bf", "0", "-noautoscale", "-init_hw_device", "qsv=hw", "-filter_hw_device", "hw", "-filter:v", videoFilters.join(", "), "-g:v", (options.fps * options.idrInterval).toString(), "-bufsize", (2 * options.bitrate).toString() + "k", "-maxrate", adjustedMaxBitrate.toString() + "k");
654
- if (options.useSmartQuality) {
661
+ encoderOptions.push("-codec:v", "h264_qsv", "-profile:v", this.getH264Profile(options.profile), "-level:v", "0", "-bf", "0", "-noautoscale", "-init_hw_device", "qsv=hw", "-filter_hw_device", "hw", "-filter:v", videoFilters.join(", "), "-g:v", (options.fps * options.idrInterval).toString(), "-bufsize", (2 * options.bitrate).toString() + "k", "-maxrate", adjustedMaxBitrate.toString() + "k");
662
+ if (options.smartQuality) {
655
663
  // -global_quality 20 Use a global quality setting of 20, to allow QSV the ability to vary bitrates to achieve the visual quality we want,
656
664
  // constrained by our maximum bitrate. This leverages a QSV-specific feature known as intelligent constant quality.
657
665
  encoderOptions.push("-global_quality", "20");
@@ -669,7 +677,7 @@ export class FfmpegOptions {
669
677
  * @returns Maximum supported pixel count.
670
678
  */
671
679
  get hostSystemMaxPixels() {
672
- if (this.options.hardwareTranscoding) {
680
+ if (this.config.hardwareTranscoding) {
673
681
  switch (this.codecSupport.hostSystem) {
674
682
  case "raspbian":
675
683
  // For constrained environments like Raspberry Pi, when hardware transcoding has been selected for a camera, we limit the available source streams to no more
@@ -1 +1 @@
1
- {"version":3,"file":"options.js","sourceRoot":"","sources":["../../src/ffmpeg/options.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAsBH,OAAO,EAAE,0BAA0B,EAAE,eAAe,EAAE,MAAM,eAAe,CAAC;AAmG5E;;;;;;;;;;;;;;;;;;;;;;;;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;gBAEpC,KAAK,UAAU;oBAEb,6JAA6J;oBAC7J,wJAAwJ;oBACxJ,4DAA4D;oBAC5D,OAAO,IAAI,GAAG,IAAI,CAAC;gBAErB;oBAEE,MAAM;YACV,CAAC;QACH,CAAC;QAED,OAAO,QAAQ,CAAC;IAClB,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACK,YAAY,CAAC,KAAgB,EAAE,OAAO,GAAG,KAAK;QAEpD,QAAO,KAAK,EAAE,CAAC;YAEb;gBAEE,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;YAEhC;gBAEE,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;YAEhC;gBAEE,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;YAEhC;gBAEE,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,CAAC;QAClC,CAAC;IACH,CAAC;IAED;;;;;;;;;;;;;;;;;;;OAmBG;IACK,cAAc,CAAC,OAAoB,EAAE,OAAO,GAAG,KAAK;QAE1D,QAAO,OAAO,EAAE,CAAC;YAEf;gBAEE,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,UAAU,CAAC;YAErC;gBAEE,OAAO,OAAO,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;YAElC;gBAEE,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;YAEjC;gBAEE,OAAO,OAAO,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC;QACnC,CAAC;IACH,CAAC;CACF"}
@@ -1,23 +1,58 @@
1
- import { type Nullable } from "../util.js";
2
- import type { CameraRecordingConfiguration } from "homebridge";
1
+ /**
2
+ * FFmpeg process management for HomeKit Secure Video (HKSV) events and fMP4 livestreaming.
3
+ *
4
+ * This module defines classes for orchestrating FFmpeg processes that produce fMP4 segments suitable for HomeKit Secure Video and realtime livestreaming scenarios. It
5
+ * handles process lifecycle, segment buffering, initialization segment detection, and streaming event generation, abstracting away the complexity of interacting directly
6
+ * with FFmpeg for these workflows.
7
+ *
8
+ * Key features:
9
+ *
10
+ * - Automated setup and management of FFmpeg processes for HKSV event recording and livestreaming (with support for audio and video).
11
+ * - Parsing and generation of fMP4 boxes/segments for HomeKit, including initialization and media segments.
12
+ * - Async generator APIs for efficient, event-driven segment handling.
13
+ * - Flexible error handling and timeouts for HomeKit’s strict realtime requirements.
14
+ * - Designed for Homebridge plugin authors or advanced users who need robust, platform-aware FFmpeg session control for HomeKit and related integrations.
15
+ *
16
+ * @module
17
+ */
18
+ import { type CameraRecordingConfiguration } from "homebridge";
19
+ import { type Nullable, type PartialWithId } from "../util.js";
3
20
  import type { FfmpegOptions } from "./options.js";
4
21
  import { FfmpegProcess } from "./process.js";
5
22
  /**
6
23
  * Options for configuring an fMP4 recording or livestream session.
7
24
  *
8
- * @property codec - The codec for the input video stream. Valid values are `h264` and `hevc`. Defaults to `h264`.
9
- * @property fps - The video frames per second for the session.
10
- * @property livestream - Indicates if this is a livestream session (`true`) or a recording (`false`).
11
- * @property probesize - Number of bytes to analyze for stream information.
12
- * @property timeshift - Timeshift offset for event-based recording (in milliseconds).
13
- * @property url - Source URL for livestreaming (RTSP).
25
+ * @property audioStream - Audio stream input to use, if the input contains multiple audio streams. Defaults to `0` (the first audio stream).
26
+ * @property codec - The codec for the input video stream. Valid values are `h264` and `hevc`. Defaults to `h264`.
27
+ * @property enableAudio - Indicates whether to enable audio or not.
28
+ * @property hardwareTranscoding - Indicates whether or not to use hardware accelerated transcoding, if available. Defaults to what was specified in ffmpegOptions.
29
+ * @property videoStream - Video stream input to use, if the input contains multiple video streams. Defaults to `0` (the first video stream).
14
30
  */
15
- interface Fmp4OptionsConfig {
31
+ interface Fmp4CommonOptions {
32
+ audioStream: number;
16
33
  codec: string;
34
+ enableAudio: boolean;
35
+ hardwareTranscoding: boolean;
36
+ videoStream: number;
37
+ }
38
+ /**
39
+ * Options for configuring an fMP4 recording or livestream session.
40
+ *
41
+ * @property fps - The video frames per second for the session.
42
+ * @property probesize - Number of bytes to analyze for stream information.
43
+ * @property timeshift - Timeshift offset for event-based recording (in milliseconds).
44
+ */
45
+ export interface Fmp4RecordingOptions extends Fmp4CommonOptions {
17
46
  fps: number;
18
- livestream: boolean;
19
47
  probesize: number;
20
48
  timeshift: number;
49
+ }
50
+ /**
51
+ * Options for configuring an fMP4 recording or livestream session.
52
+ *
53
+ * @property url - Source URL for livestream (RTSP) remuxing to fMP4.
54
+ */
55
+ export interface Fmp4LivestreamOptions extends Fmp4CommonOptions {
21
56
  url: string;
22
57
  }
23
58
  /**
@@ -73,7 +108,7 @@ declare class FfmpegFmp4Process extends FfmpegProcess {
73
108
  * const process = new FfmpegFmp4Process(ffmpegOptions, recordingConfig, true, { fps: 30 });
74
109
  * ```
75
110
  */
76
- constructor(ffmpegOptions: FfmpegOptions, recordingConfig: CameraRecordingConfiguration, isAudioActive: boolean, fmp4Options?: Partial<Fmp4OptionsConfig>, isVerbose?: boolean);
111
+ constructor(ffmpegOptions: FfmpegOptions, recordingConfig: CameraRecordingConfiguration, fmp4Options?: Partial<Fmp4LivestreamOptions & Fmp4RecordingOptions>, isVerbose?: boolean);
77
112
  /**
78
113
  * Prepares and configures the FFmpeg process for reading and parsing output fMP4 data.
79
114
  *
@@ -183,14 +218,10 @@ export declare class FfmpegRecordingProcess extends FfmpegFmp4Process {
183
218
  *
184
219
  * @param options - FFmpeg configuration options.
185
220
  * @param recordingConfig - HomeKit recording configuration for the session.
186
- * @param fps - Video frames per second.
187
- * @param processAudio - If `true`, enables audio stream processing.
188
- * @param probesize - Stream analysis size, in bytes.
189
- * @param timeshift - Timeshift offset for event-based recording, in milliseconds.
190
- * @param codec - Codec for the video stream input. Valid values are: `h264` and `hevc`. Defaults to `h264`.
221
+ * @param fmp4Options - fMP4 recording options.
191
222
  * @param isVerbose - If `true`, enables more verbose logging for debugging purposes. Defaults to `false`.
192
223
  */
193
- constructor(options: FfmpegOptions, recordingConfig: CameraRecordingConfiguration, fps: number, processAudio: boolean, probesize: number, timeshift: number, codec?: string, isVerbose?: boolean);
224
+ constructor(options: FfmpegOptions, recordingConfig: CameraRecordingConfiguration, fmp4Options?: Partial<Fmp4RecordingOptions>, isVerbose?: boolean);
194
225
  }
195
226
  /**
196
227
  * Manages a HomeKit livestream FFmpeg process for generating fMP4 segments.
@@ -212,15 +243,12 @@ export declare class FfmpegLivestreamProcess extends FfmpegFmp4Process {
212
243
  /**
213
244
  * Constructs a new FFmpeg livestream process.
214
245
  *
215
- * @param options - FFmpeg configuration options.
216
- * @param recordingConfig - HomeKit recording configuration for the session.
217
- * @param url - Source RTSP or livestream URL.
218
- * @param fps - Video frames per second.
219
- * @param processAudio - If `true`, enables audio stream processing. Defaults to `true`.
220
- * @param codec - Codec for the video stream input. Valid values are: `h264` and `hevc`. Defaults to `h264`.
221
- * @param isVerbose - If `true`, enables more verbose logging for debugging purposes. Defaults to `false`.
246
+ * @param options - FFmpeg configuration options.
247
+ * @param recordingConfig - HomeKit recording configuration for the session.
248
+ * @param livestreamOptions - livestream segmenting options.
249
+ * @param isVerbose - If `true`, enables more verbose logging for debugging purposes. Defaults to `false`.
222
250
  */
223
- constructor(options: FfmpegOptions, recordingConfig: CameraRecordingConfiguration, url: string, fps: number, processAudio?: boolean, codec?: string, isVerbose?: boolean);
251
+ constructor(options: FfmpegOptions, recordingConfig: CameraRecordingConfiguration, livestreamOptions: PartialWithId<Fmp4LivestreamOptions, "url">, isVerbose?: boolean);
224
252
  /**
225
253
  * Gets the fMP4 initialization segment generated by FFmpeg for the livestream.
226
254
  *
@@ -1,30 +1,21 @@
1
1
  /* Copyright(C) 2017-2025, HJD (https://github.com/hjdhjd). All rights reserved.
2
2
  *
3
3
  * ffmpeg/record.ts: Provide FFmpeg process control to support livestreaming and HomeKit Secure Video.
4
- *
5
- */
6
- /**
7
- * FFmpeg process management for HomeKit Secure Video (HKSV) events and fMP4 livestreaming.
8
- *
9
- * This module defines classes for orchestrating FFmpeg processes that produce fMP4 segments suitable for HomeKit Secure Video and realtime livestreaming scenarios. It
10
- * handles process lifecycle, segment buffering, initialization segment detection, and streaming event generation, abstracting away the complexity of interacting directly
11
- * with FFmpeg for these workflows.
12
- *
13
- * Key features:
14
- *
15
- * - Automated setup and management of FFmpeg processes for HKSV event recording and livestreaming (with support for audio and video).
16
- * - Parsing and generation of fMP4 boxes/segments for HomeKit, including initialization and media segments.
17
- * - Async generator APIs for efficient, event-driven segment handling.
18
- * - Flexible error handling and timeouts for HomeKit’s strict realtime requirements.
19
- * - Designed for Homebridge plugin authors or advanced users who need robust, platform-aware FFmpeg session control for HomeKit and related integrations.
20
- *
21
- * @module
22
4
  */
23
5
  import { HKSV_IDR_INTERVAL, HKSV_TIMEOUT } from "./settings.js";
24
6
  import { runWithTimeout } from "../util.js";
25
7
  import { FfmpegProcess } from "./process.js";
26
8
  import events from "node:events";
27
9
  import { once } from "node:events";
10
+ // Utility to map audio sample rates to strings. We also use satisfies here to ensure we account for any future changes that would require updating this mapping.
11
+ const translateAudioSampleRate = {
12
+ [0 /* AudioRecordingSamplerate.KHZ_8 */]: "8",
13
+ [1 /* AudioRecordingSamplerate.KHZ_16 */]: "16",
14
+ [2 /* AudioRecordingSamplerate.KHZ_24 */]: "24",
15
+ [3 /* AudioRecordingSamplerate.KHZ_32 */]: "32",
16
+ [4 /* AudioRecordingSamplerate.KHZ_44_1 */]: "44.1",
17
+ [5 /* AudioRecordingSamplerate.KHZ_48 */]: "48"
18
+ };
28
19
  /**
29
20
  * FFmpeg process controller for HomeKit Secure Video (HKSV) and fMP4 livestreaming and recording.
30
21
  *
@@ -78,7 +69,7 @@ class FfmpegFmp4Process extends FfmpegProcess {
78
69
  * const process = new FfmpegFmp4Process(ffmpegOptions, recordingConfig, true, { fps: 30 });
79
70
  * ```
80
71
  */
81
- constructor(ffmpegOptions, recordingConfig, isAudioActive, fmp4Options = {}, isVerbose = false) {
72
+ constructor(ffmpegOptions, recordingConfig, fmp4Options = {}, isVerbose = false) {
82
73
  // Initialize our parent.
83
74
  super(ffmpegOptions);
84
75
  // We want to log errors when they occur.
@@ -88,43 +79,53 @@ class FfmpegFmp4Process extends FfmpegProcess {
88
79
  this._initSegment = Buffer.alloc(0);
89
80
  this.recordingBuffer = [];
90
81
  // Initialize our state.
91
- this.isLivestream = fmp4Options.livestream ?? false;
82
+ this.isLivestream = !!fmp4Options.url;
92
83
  this.isTimedOut = false;
84
+ fmp4Options.audioStream ??= 0;
93
85
  fmp4Options.codec ??= "h264";
86
+ fmp4Options.enableAudio ??= true;
94
87
  fmp4Options.fps ??= 30;
95
- fmp4Options.url ??= "";
88
+ fmp4Options.hardwareTranscoding ??= this.options.config.hardwareTranscoding;
89
+ fmp4Options.videoStream ??= 0;
96
90
  // Save our recording configuration.
97
91
  this.recordingConfig = recordingConfig;
98
92
  // Configure our video parameters for our input:
99
93
  //
100
94
  // -hide_banner Suppress printing the startup banner in FFmpeg.
101
95
  // -nostats Suppress printing progress reports while encoding in FFmpeg.
102
- // -fflags flags Set the format flags to generate a presentation timestamp if it's missing and discard any corrupt packets rather than exit.
96
+ // -fflags flags Set the format flags to discard any corrupt packets rather than exit, generate a presentation timestamp if it's missing, and ignore
97
+ // the decoding timestamp.
103
98
  // -err_detect ignore_err Ignore decoding errors and continue rather than exit.
104
- // -probesize number How many bytes should be analyzed for stream information. Use the size of the timeshift buffer or our configured defaults.
105
- // -r fps Set the input frame rate for the video stream.
106
- // -f mp4 Tell FFmpeg that it should expect an MP4-encoded input stream.
107
- // -i pipe:0 Use standard input to get video data.
108
- // -ss Fast forward to where HKSV is expecting us to be for a recording event.
99
+ // -max_delay 500000 Set an upper limit on how much time FFmpeg can take in demuxing packets, in microseconds.
109
100
  this.commandLineArgs = [
110
101
  "-hide_banner",
111
102
  "-nostats",
112
- "-fflags", "+discardcorrupt",
103
+ "-fflags", "+discardcorrupt+genpts+igndts",
113
104
  "-err_detect", "ignore_err",
114
- ...this.options.videoDecoder(fmp4Options.codec)
105
+ "-max_delay", "500000"
115
106
  ];
116
- if (this.isLivestream) {
107
+ if (this.isLivestream && fmp4Options.url) {
108
+ // -avioflags direct Tell FFmpeg to minimize buffering to reduce latency for more realtime processing.
109
+ // -rtsp_transport tcp Tell the RTSP stream handler that we're looking for a TCP connection.
110
+ // -i url RTSPS URL to get our input stream from.
117
111
  this.commandLineArgs.push("-avioflags", "direct", "-rtsp_transport", "tcp", "-i", fmp4Options.url);
118
112
  }
119
113
  else {
114
+ // -probesize number How many bytes should be analyzed for stream information.
115
+ // -r fps Set the input frame rate for the video stream.
116
+ // -f mp4 Tell FFmpeg that it should expect an MP4-encoded input stream.
117
+ // -i pipe:0 Use standard input to get video data.
118
+ // -ss Fast forward to where HKSV is expecting us to be for a recording event.
120
119
  this.commandLineArgs.push("-probesize", (fmp4Options.probesize ?? 5000000).toString(), "-r", fmp4Options.fps.toString(), "-f", "mp4", "-i", "pipe:0", "-ss", (fmp4Options.timeshift ?? 0).toString() + "ms");
121
120
  }
122
121
  // Configure our recording options for the video stream:
123
122
  //
124
- // -map 0:v:0 Selects the first available video track from the stream.
125
- this.commandLineArgs.push("-map", "0:v:0", ...(this.isLivestream ? ["-vcodec", "copy"] : this.options.recordEncoder({
123
+ // -map 0:v:X Selects the video track from the input.
124
+ this.commandLineArgs.push("-map", "0:v:" + fmp4Options.videoStream.toString(), ...(this.isLivestream ? ["-codec:v", "copy"] : this.options.recordEncoder({
126
125
  bitrate: recordingConfig.videoCodec.parameters.bitRate,
127
126
  fps: recordingConfig.videoCodec.resolution[2],
127
+ hardwareDecoding: false,
128
+ hardwareTranscoding: fmp4Options.hardwareTranscoding,
128
129
  height: recordingConfig.videoCodec.resolution[1],
129
130
  idrInterval: HKSV_IDR_INTERVAL,
130
131
  inputFps: fmp4Options.fps,
@@ -134,6 +135,7 @@ class FfmpegFmp4Process extends FfmpegProcess {
134
135
  })));
135
136
  // If we're livestreaming, emit fragments at one-second intervals.
136
137
  if (this.isLivestream) {
138
+ // -frag_duration number Length of each fMP4 fragment, in microseconds.
137
139
  this.commandLineArgs.push("-frag_duration", "1000000");
138
140
  }
139
141
  // -movflags flags In the generated fMP4 stream: set the default-base-is-moof flag in the header, write an initial empty MOOV box, start a new fragment
@@ -141,17 +143,23 @@ class FfmpegFmp4Process extends FfmpegProcess {
141
143
  // -reset_timestamps Reset timestamps at the beginning of each segment.
142
144
  // -metadata Set the metadata to the name of the camera to distinguish between FFmpeg sessions.
143
145
  this.commandLineArgs.push("-movflags", "default_base_moof+empty_moov+frag_keyframe+skip_sidx+skip_trailer", "-reset_timestamps", "1", "-metadata", "comment=" + this.options.name() + " " + (this.isLivestream ? "Livestream Buffer" : "HKSV Event"));
144
- if (isAudioActive) {
146
+ if (fmp4Options.enableAudio) {
145
147
  // Configure the audio portion of the command line. Options we use are:
146
148
  //
147
- // -map 0:a:0? Selects the first available audio track from the stream, if it exists.
148
- // -acodec copy Copy the stream without reencoding it.
149
- this.commandLineArgs.push("-map", "0:a:0?", "-acodec", "copy");
149
+ // -map 0:a:X? Selects the audio stream from the input, if it exists.
150
+ // -codec:a Encode using the codecs available to us on given platforms.
151
+ // -profile:a Specify either low-complexity AAC or enhanced low-delay AAC for HKSV events.
152
+ // -ar samplerate Sample rate to use for this audio. This is specified by HKSV.
153
+ // -b:a bitrate Bitrate to use for this audio stream. This is specified by HKSV.
154
+ // -bufsize size This is the decoder buffer size, which drives the variability / quality of the output bitrate.
155
+ // -ac number Set the number of audio channels.
156
+ this.commandLineArgs.push("-map", "0:a:" + fmp4Options.audioStream.toString() + "?", ...this.options.audioEncoder, "-profile:a", (recordingConfig.audioCodec.type === 0 /* AudioRecordingCodecType.AAC_LC */) ? "22" : "38", "-ar", translateAudioSampleRate[recordingConfig.audioCodec.samplerate] + "k", "-b:a", recordingConfig.audioCodec.bitrate.toString() + "k", "-bufsize", (2 * recordingConfig.audioCodec.bitrate).toString() + "k", "-ac", (recordingConfig.audioCodec.audioChannels ?? 1).toString());
150
157
  }
151
158
  // Configure our video parameters for outputting our final stream:
152
159
  //
153
- // -f mp4 Tell ffmpeg that it should create an MP4-encoded output stream.
154
- // pipe:1 Output the stream to standard output.
160
+ // -f mp4 Tell ffmpeg that it should create an MP4-encoded output stream.
161
+ // -avioflags direct Tell FFmpeg to minimize buffering to reduce latency for more realtime processing.
162
+ // pipe:1 Output the stream to standard output.
155
163
  this.commandLineArgs.push("-f", "mp4", "-avioflags", "direct", "pipe:1");
156
164
  // Additional logging, but only if we're debugging.
157
165
  if (isVerbose || this.isVerbose) {
@@ -452,15 +460,11 @@ export class FfmpegRecordingProcess extends FfmpegFmp4Process {
452
460
  *
453
461
  * @param options - FFmpeg configuration options.
454
462
  * @param recordingConfig - HomeKit recording configuration for the session.
455
- * @param fps - Video frames per second.
456
- * @param processAudio - If `true`, enables audio stream processing.
457
- * @param probesize - Stream analysis size, in bytes.
458
- * @param timeshift - Timeshift offset for event-based recording, in milliseconds.
459
- * @param codec - Codec for the video stream input. Valid values are: `h264` and `hevc`. Defaults to `h264`.
463
+ * @param fmp4Options - fMP4 recording options.
460
464
  * @param isVerbose - If `true`, enables more verbose logging for debugging purposes. Defaults to `false`.
461
465
  */
462
- constructor(options, recordingConfig, fps, processAudio, probesize, timeshift, codec = "h264", isVerbose = false) {
463
- super(options, recordingConfig, processAudio, { codec: codec, fps: fps, probesize: probesize, timeshift: timeshift }, isVerbose);
466
+ constructor(options, recordingConfig, fmp4Options = {}, isVerbose = false) {
467
+ super(options, recordingConfig, fmp4Options, isVerbose);
464
468
  }
465
469
  }
466
470
  /**
@@ -483,16 +487,13 @@ export class FfmpegLivestreamProcess extends FfmpegFmp4Process {
483
487
  /**
484
488
  * Constructs a new FFmpeg livestream process.
485
489
  *
486
- * @param options - FFmpeg configuration options.
487
- * @param recordingConfig - HomeKit recording configuration for the session.
488
- * @param url - Source RTSP or livestream URL.
489
- * @param fps - Video frames per second.
490
- * @param processAudio - If `true`, enables audio stream processing. Defaults to `true`.
491
- * @param codec - Codec for the video stream input. Valid values are: `h264` and `hevc`. Defaults to `h264`.
492
- * @param isVerbose - If `true`, enables more verbose logging for debugging purposes. Defaults to `false`.
490
+ * @param options - FFmpeg configuration options.
491
+ * @param recordingConfig - HomeKit recording configuration for the session.
492
+ * @param livestreamOptions - livestream segmenting options.
493
+ * @param isVerbose - If `true`, enables more verbose logging for debugging purposes. Defaults to `false`.
493
494
  */
494
- constructor(options, recordingConfig, url, fps, processAudio = true, codec = "h264", isVerbose = false) {
495
- super(options, recordingConfig, processAudio, { codec: codec, fps: fps, livestream: true, url: url }, isVerbose);
495
+ constructor(options, recordingConfig, livestreamOptions, isVerbose = false) {
496
+ super(options, recordingConfig, livestreamOptions, isVerbose);
496
497
  }
497
498
  /**
498
499
  * Gets the fMP4 initialization segment generated by FFmpeg for the livestream.
@@ -1 +1 @@
1
- {"version":3,"file":"record.js","sourceRoot":"","sources":["../../src/ffmpeg/record.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAiB,cAAc,EAAE,MAAM,YAAY,CAAC;AAG3D,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAC;AAC7C,OAAO,MAAM,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,IAAI,EAAE,MAAM,aAAa,CAAC;AAsBnC;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,MAAM,iBAAkB,SAAQ,aAAa;IAEnC,cAAc,CAAU;IACxB,YAAY,CAAS;IACrB,YAAY,CAAU;IACtB,eAAe,CAAU;IAC1B,UAAU,CAAU;IACnB,eAAe,CAAmE;IAClF,eAAe,CAA+B;IAC/C,aAAa,CAAU;IAE9B;;;;;;;;;;;;;;OAcG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F;AAED;;;;;;;;;;;;;GAaG;AACH,MAAM,OAAO,sBAAuB,SAAQ,iBAAiB;IAE3D;;;;;;;OAOG;IACH,YAAY,OAAsB,EAAE,eAA6C,EAAE,cAA6C,EAAE,EAAE,SAAS,GAAG,KAAK;QAEnJ,KAAK,CAAC,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,SAAS,CAAC,CAAC;IAC1D,CAAC;CACF;AAED;;;;;;;;;;;;;;;GAeG;AACH,MAAM,OAAO,uBAAwB,SAAQ,iBAAiB;IAE5D;;;;;;;OAOG;IACH,YAAY,OAAsB,EAAE,eAA6C,EAAE,iBAA8D,EAAE,SAAS,GAAG,KAAK;QAElK,KAAK,CAAC,OAAO,EAAE,eAAe,EAAE,iBAAiB,EAAE,SAAS,CAAC,CAAC;IAChE,CAAC;IAED;;;;;;;;;;OAUG;IACI,KAAK,CAAC,cAAc;QAEzB,OAAO,KAAK,CAAC,cAAc,EAAE,CAAC;IAChC,CAAC;CACF"}
package/dist/util.d.ts CHANGED
@@ -80,6 +80,36 @@ export type DeepReadonly<T> = {
80
80
  * @category Utilities
81
81
  */
82
82
  export type Nullable<T> = T | null;
83
+ /**
84
+ * Makes all properties in `T` optional except for `id`, which remains required.
85
+ *
86
+ * @template T - The base interface or type.
87
+ *
88
+ * @example
89
+ *
90
+ * ```ts
91
+ * interface Device {
92
+ *
93
+ * id: string;
94
+ * name: string;
95
+ * mac: string;
96
+ * }
97
+ *
98
+ * type UserUpdate = PartialWithId<User>;
99
+ *
100
+ * // Valid: Only 'id' is required, others are optional.
101
+ * const update: DeviceUpdate = { id: "123" };
102
+ *
103
+ * // Valid: Extra properties can be provided.
104
+ * const another: DeviceUpdate = { id: "456", name: "SomeDevice" };
105
+ *
106
+ * // Error: 'id' is missing.
107
+ * const error: DeviceUpdate = { name: "SomeOtherDevice" }; // TypeScript error
108
+ * ```
109
+ *
110
+ * @category Utilities
111
+ */
112
+ export type PartialWithId<T, K extends keyof T> = Partial<T> & Pick<T, K>;
83
113
  /**
84
114
  * Logging interface for Homebridge plugins.
85
115
  *
package/dist/util.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAiJH;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,SAAS,CAAC,KAAa;IAErC,4BAA4B;IAC5B,IAAG,KAAK,GAAG,IAAI,EAAE,CAAC;QAEhB,OAAO,KAAK,CAAC,QAAQ,EAAE,GAAG,MAAM,CAAC;IACnC,CAAC;IAED,kCAAkC;IAClC,IAAG,KAAK,GAAG,OAAO,EAAE,CAAC;QAEnB,MAAM,IAAI,GAAG,KAAK,GAAG,IAAI,CAAC;QAE1B,OAAO,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;IAC1E,CAAC;IAED,kCAAkC;IAClC,MAAM,IAAI,GAAG,KAAK,GAAG,OAAO,CAAC;IAE7B,OAAO,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC;AAC1E,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;GA2BG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,SAAiC,EAAE,aAAqB,EAAE,YAAqB;IAEzG,IAAG,CAAC,YAAY,KAAK,SAAS,CAAC,IAAI,CAAC,YAAY,IAAI,CAAC,CAAC,EAAE,CAAC;QAEvD,OAAO,KAAK,CAAC;IACf,CAAC;IAED,wCAAwC;IACxC,IAAG,CAAC,CAAC,MAAM,SAAS,EAAE,CAAC,E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ebridge Plugin Utilities",
5
5
  "description": "Opinionated utilities to provide common capabilities and create rich configuration webUI experiences for Homebridge plugins.",
6
6
  "author": {
@@ -41,15 +41,15 @@
41
41
  "main": "dist/index.js",
42
42
  "devDependencies": {
43
43
  "@stylistic/eslint-plugin": "4.4.0",
44
- "@types/node": "22.15.21",
44
+ "@types/node": "22.15.29",
45
45
  "@types/ws": "^8.18.1",
46
- "eslint": "^9.27.0",
46
+ "eslint": "^9.28.0",
47
47
  "homebridge": "1.9.0",
48
48
  "shx": "0.4.0",
49
49
  "typedoc": "0.28.5",
50
50
  "typedoc-plugin-markdown": "4.6.3",
51
51
  "typescript": "5.8.3",
52
- "typescript-eslint": "^8.32.1"
52
+ "typescript-eslint": "^8.33.0"
53
53
  },
54
54
  "dependencies": {
55
55
  "mqtt": "5.13.0"