node-av 1.2.0 → 1.3.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.
- package/README.md +0 -21
- package/dist/api/bitstream-filter.d.ts +3 -0
- package/dist/api/bitstream-filter.js +5 -2
- package/dist/api/bitstream-filter.js.map +1 -1
- package/dist/api/decoder.d.ts +5 -0
- package/dist/api/decoder.js +7 -2
- package/dist/api/decoder.js.map +1 -1
- package/dist/api/encoder.d.ts +11 -6
- package/dist/api/encoder.js +13 -8
- package/dist/api/encoder.js.map +1 -1
- package/dist/api/filter-presets.d.ts +1267 -15
- package/dist/api/filter-presets.js +1387 -17
- package/dist/api/filter-presets.js.map +1 -1
- package/dist/api/filter.d.ts +28 -0
- package/dist/api/filter.js +30 -2
- package/dist/api/filter.js.map +1 -1
- package/dist/api/hardware.d.ts +24 -2
- package/dist/api/hardware.js +65 -8
- package/dist/api/hardware.js.map +1 -1
- package/dist/api/io-stream.d.ts +6 -0
- package/dist/api/io-stream.js +6 -0
- package/dist/api/io-stream.js.map +1 -1
- package/dist/api/media-input.d.ts +1 -0
- package/dist/api/media-input.js.map +1 -1
- package/dist/api/media-output.d.ts +4 -0
- package/dist/api/media-output.js +4 -0
- package/dist/api/media-output.js.map +1 -1
- package/dist/api/pipeline.d.ts +193 -0
- package/dist/api/pipeline.js +17 -0
- package/dist/api/pipeline.js.map +1 -1
- package/dist/api/types.d.ts +5 -0
- package/dist/api/utilities/audio-sample.d.ts +0 -8
- package/dist/api/utilities/audio-sample.js +0 -8
- package/dist/api/utilities/audio-sample.js.map +1 -1
- package/dist/api/utilities/channel-layout.d.ts +0 -8
- package/dist/api/utilities/channel-layout.js +0 -8
- package/dist/api/utilities/channel-layout.js.map +1 -1
- package/dist/api/utilities/image.d.ts +0 -8
- package/dist/api/utilities/image.js +0 -8
- package/dist/api/utilities/image.js.map +1 -1
- package/dist/api/utilities/index.d.ts +3 -3
- package/dist/api/utilities/index.js +3 -3
- package/dist/api/utilities/index.js.map +1 -1
- package/dist/api/utilities/media-type.d.ts +1 -9
- package/dist/api/utilities/media-type.js +1 -9
- package/dist/api/utilities/media-type.js.map +1 -1
- package/dist/api/utilities/pixel-format.d.ts +1 -9
- package/dist/api/utilities/pixel-format.js +1 -9
- package/dist/api/utilities/pixel-format.js.map +1 -1
- package/dist/api/utilities/sample-format.d.ts +1 -9
- package/dist/api/utilities/sample-format.js +1 -9
- package/dist/api/utilities/sample-format.js.map +1 -1
- package/dist/api/utilities/streaming.d.ts +0 -8
- package/dist/api/utilities/streaming.js +0 -8
- package/dist/api/utilities/streaming.js.map +1 -1
- package/dist/api/utilities/timestamp.d.ts +0 -8
- package/dist/api/utilities/timestamp.js +0 -8
- package/dist/api/utilities/timestamp.js.map +1 -1
- package/dist/api/utils.js +2 -0
- package/dist/api/utils.js.map +1 -1
- package/dist/constants/constants.d.ts +1 -1
- package/dist/constants/constants.js +2 -0
- package/dist/constants/constants.js.map +1 -1
- package/dist/lib/binding.d.ts +1 -0
- package/dist/lib/binding.js +2 -0
- package/dist/lib/binding.js.map +1 -1
- package/dist/lib/codec.d.ts +4 -4
- package/dist/lib/codec.js +4 -4
- package/dist/lib/error.d.ts +1 -1
- package/dist/lib/error.js +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/native-types.d.ts +1 -0
- package/dist/lib/option.d.ts +176 -0
- package/dist/lib/option.js +176 -0
- package/dist/lib/option.js.map +1 -1
- package/dist/lib/utilities.d.ts +64 -1
- package/dist/lib/utilities.js +65 -0
- package/dist/lib/utilities.js.map +1 -1
- package/install/ffmpeg.js +0 -11
- package/package.json +12 -14
- package/release_notes.md +24 -43
package/dist/lib/option.d.ts
CHANGED
|
@@ -225,6 +225,13 @@ export declare class Option {
|
|
|
225
225
|
* @param name - Option name
|
|
226
226
|
* @param searchFlags - Search flags
|
|
227
227
|
* @returns Option value as string, or null
|
|
228
|
+
*
|
|
229
|
+
* @example
|
|
230
|
+
* ```typescript
|
|
231
|
+
* // Get codec preset option
|
|
232
|
+
* const preset = Option.get(codecContext, 'preset', AV_OPT_SEARCH_CHILDREN);
|
|
233
|
+
* console.log('Codec preset:', preset); // 'medium', 'fast', etc.
|
|
234
|
+
* ```
|
|
228
235
|
*/
|
|
229
236
|
static get(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): string | null;
|
|
230
237
|
/**
|
|
@@ -236,6 +243,13 @@ export declare class Option {
|
|
|
236
243
|
* @param name - Option name
|
|
237
244
|
* @param searchFlags - Search flags
|
|
238
245
|
* @returns Option value as integer, or null
|
|
246
|
+
*
|
|
247
|
+
* @example
|
|
248
|
+
* ```typescript
|
|
249
|
+
* // Get codec GOP size
|
|
250
|
+
* const gopSize = Option.getInt(codecContext, 'g', AV_OPT_SEARCH_CHILDREN);
|
|
251
|
+
* console.log('GOP size:', gopSize); // 60, 120, etc.
|
|
252
|
+
* ```
|
|
239
253
|
*/
|
|
240
254
|
static getInt(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): number | null;
|
|
241
255
|
/**
|
|
@@ -247,6 +261,13 @@ export declare class Option {
|
|
|
247
261
|
* @param name - Option name
|
|
248
262
|
* @param searchFlags - Search flags
|
|
249
263
|
* @returns Option value as double, or null
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* ```typescript
|
|
267
|
+
* // Get codec quality scale
|
|
268
|
+
* const crf = Option.getDouble(codecContext, 'crf', AV_OPT_SEARCH_CHILDREN);
|
|
269
|
+
* console.log('CRF value:', crf); // 23.0, 18.0, etc.
|
|
270
|
+
* ```
|
|
250
271
|
*/
|
|
251
272
|
static getDouble(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): number | null;
|
|
252
273
|
/**
|
|
@@ -258,6 +279,13 @@ export declare class Option {
|
|
|
258
279
|
* @param name - Option name
|
|
259
280
|
* @param searchFlags - Search flags
|
|
260
281
|
* @returns Option value as rational, or null
|
|
282
|
+
*
|
|
283
|
+
* @example
|
|
284
|
+
* ```typescript
|
|
285
|
+
* // Get codec time base
|
|
286
|
+
* const timeBase = Option.getRational(codecContext, 'time_base', AV_OPT_SEARCH_CHILDREN);
|
|
287
|
+
* console.log('Time base:', timeBase); // { num: 1, den: 30 }
|
|
288
|
+
* ```
|
|
261
289
|
*/
|
|
262
290
|
static getRational(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): IRational | null;
|
|
263
291
|
/**
|
|
@@ -269,6 +297,13 @@ export declare class Option {
|
|
|
269
297
|
* @param name - Option name
|
|
270
298
|
* @param searchFlags - Search flags
|
|
271
299
|
* @returns Pixel format value, or null
|
|
300
|
+
*
|
|
301
|
+
* @example
|
|
302
|
+
* ```typescript
|
|
303
|
+
* // Get filter pixel format
|
|
304
|
+
* const pixFmt = Option.getPixelFormat(filterContext, 'pix_fmt', AV_OPT_SEARCH_CHILDREN);
|
|
305
|
+
* console.log('Pixel format:', pixFmt); // AV_PIX_FMT_YUV420P, etc.
|
|
306
|
+
* ```
|
|
272
307
|
*/
|
|
273
308
|
static getPixelFormat(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): AVPixelFormat | null;
|
|
274
309
|
/**
|
|
@@ -280,6 +315,13 @@ export declare class Option {
|
|
|
280
315
|
* @param name - Option name
|
|
281
316
|
* @param searchFlags - Search flags
|
|
282
317
|
* @returns Sample format value, or null
|
|
318
|
+
*
|
|
319
|
+
* @example
|
|
320
|
+
* ```typescript
|
|
321
|
+
* // Get audio codec sample format
|
|
322
|
+
* const sampleFmt = Option.getSampleFormat(codecContext, 'sample_fmt', AV_OPT_SEARCH_CHILDREN);
|
|
323
|
+
* console.log('Sample format:', sampleFmt); // AV_SAMPLE_FMT_FLTP, etc.
|
|
324
|
+
* ```
|
|
283
325
|
*/
|
|
284
326
|
static getSampleFormat(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): AVSampleFormat | null;
|
|
285
327
|
/**
|
|
@@ -291,6 +333,13 @@ export declare class Option {
|
|
|
291
333
|
* @param name - Option name
|
|
292
334
|
* @param searchFlags - Search flags
|
|
293
335
|
* @returns Width and height, or null
|
|
336
|
+
*
|
|
337
|
+
* @example
|
|
338
|
+
* ```typescript
|
|
339
|
+
* // Get filter output size
|
|
340
|
+
* const size = Option.getImageSize(filterContext, 'size', AV_OPT_SEARCH_CHILDREN);
|
|
341
|
+
* console.log('Output size:', size); // { width: 1920, height: 1080 }
|
|
342
|
+
* ```
|
|
294
343
|
*/
|
|
295
344
|
static getImageSize(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): {
|
|
296
345
|
width: number;
|
|
@@ -305,6 +354,13 @@ export declare class Option {
|
|
|
305
354
|
* @param name - Option name
|
|
306
355
|
* @param searchFlags - Search flags
|
|
307
356
|
* @returns Channel layout, or null
|
|
357
|
+
*
|
|
358
|
+
* @example
|
|
359
|
+
* ```typescript
|
|
360
|
+
* // Get audio channel layout
|
|
361
|
+
* const layout = Option.getChannelLayout(codecContext, 'channel_layout', AV_OPT_SEARCH_CHILDREN);
|
|
362
|
+
* console.log('Channel layout:', layout); // stereo, 5.1, etc.
|
|
363
|
+
* ```
|
|
308
364
|
*/
|
|
309
365
|
static getChannelLayout(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): ChannelLayout | null;
|
|
310
366
|
/**
|
|
@@ -316,6 +372,13 @@ export declare class Option {
|
|
|
316
372
|
* @param name - Option name
|
|
317
373
|
* @param searchFlags - Search flags
|
|
318
374
|
* @returns Dictionary value, or null
|
|
375
|
+
*
|
|
376
|
+
* @example
|
|
377
|
+
* ```typescript
|
|
378
|
+
* // Get metadata dictionary
|
|
379
|
+
* const metadata = Option.getDict(formatContext, 'metadata', AV_OPT_SEARCH_CHILDREN);
|
|
380
|
+
* console.log('Metadata:', metadata?.get('title'));
|
|
381
|
+
* ```
|
|
319
382
|
*/
|
|
320
383
|
static getDict(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): Dictionary | null;
|
|
321
384
|
/**
|
|
@@ -328,6 +391,13 @@ export declare class Option {
|
|
|
328
391
|
* @param value - String value
|
|
329
392
|
* @param searchFlags - Search flags
|
|
330
393
|
* @returns 0 on success, negative AVERROR on error
|
|
394
|
+
*
|
|
395
|
+
* @example
|
|
396
|
+
* ```typescript
|
|
397
|
+
* // Set codec preset
|
|
398
|
+
* const ret = Option.set(codecContext, 'preset', 'fast', AV_OPT_SEARCH_CHILDREN);
|
|
399
|
+
* FFmpegError.throwIfError(ret, 'Failed to set preset');
|
|
400
|
+
* ```
|
|
331
401
|
*/
|
|
332
402
|
static set(obj: OptionCapableObject, name: string, value: string, searchFlags?: AVOptionSearchFlags): number;
|
|
333
403
|
/**
|
|
@@ -340,6 +410,13 @@ export declare class Option {
|
|
|
340
410
|
* @param value - Integer value
|
|
341
411
|
* @param searchFlags - Search flags
|
|
342
412
|
* @returns 0 on success, negative AVERROR on error
|
|
413
|
+
*
|
|
414
|
+
* @example
|
|
415
|
+
* ```typescript
|
|
416
|
+
* // Set codec bitrate
|
|
417
|
+
* const ret = Option.setInt(codecContext, 'b', 2000000, AV_OPT_SEARCH_CHILDREN);
|
|
418
|
+
* FFmpegError.throwIfError(ret, 'Failed to set bitrate');
|
|
419
|
+
* ```
|
|
343
420
|
*/
|
|
344
421
|
static setInt(obj: OptionCapableObject, name: string, value: number | bigint, searchFlags?: AVOptionSearchFlags): number;
|
|
345
422
|
/**
|
|
@@ -352,6 +429,13 @@ export declare class Option {
|
|
|
352
429
|
* @param value - Double value
|
|
353
430
|
* @param searchFlags - Search flags
|
|
354
431
|
* @returns 0 on success, negative AVERROR on error
|
|
432
|
+
*
|
|
433
|
+
* @example
|
|
434
|
+
* ```typescript
|
|
435
|
+
* // Set codec CRF value
|
|
436
|
+
* const ret = Option.setDouble(codecContext, 'crf', 23.0, AV_OPT_SEARCH_CHILDREN);
|
|
437
|
+
* FFmpegError.throwIfError(ret, 'Failed to set CRF');
|
|
438
|
+
* ```
|
|
355
439
|
*/
|
|
356
440
|
static setDouble(obj: OptionCapableObject, name: string, value: number, searchFlags?: AVOptionSearchFlags): number;
|
|
357
441
|
/**
|
|
@@ -364,6 +448,13 @@ export declare class Option {
|
|
|
364
448
|
* @param value - Rational value
|
|
365
449
|
* @param searchFlags - Search flags
|
|
366
450
|
* @returns 0 on success, negative AVERROR on error
|
|
451
|
+
*
|
|
452
|
+
* @example
|
|
453
|
+
* ```typescript
|
|
454
|
+
* // Set codec frame rate
|
|
455
|
+
* const ret = Option.setRational(codecContext, 'framerate', { num: 30, den: 1 }, AV_OPT_SEARCH_CHILDREN);
|
|
456
|
+
* FFmpegError.throwIfError(ret, 'Failed to set framerate');
|
|
457
|
+
* ```
|
|
367
458
|
*/
|
|
368
459
|
static setRational(obj: OptionCapableObject, name: string, value: IRational, searchFlags?: AVOptionSearchFlags): number;
|
|
369
460
|
/**
|
|
@@ -376,6 +467,13 @@ export declare class Option {
|
|
|
376
467
|
* @param value - Pixel format
|
|
377
468
|
* @param searchFlags - Search flags
|
|
378
469
|
* @returns 0 on success, negative AVERROR on error
|
|
470
|
+
*
|
|
471
|
+
* @example
|
|
472
|
+
* ```typescript
|
|
473
|
+
* // Set filter pixel format
|
|
474
|
+
* const ret = Option.setPixelFormat(filterContext, 'pix_fmt', AV_PIX_FMT_YUV420P, AV_OPT_SEARCH_CHILDREN);
|
|
475
|
+
* FFmpegError.throwIfError(ret, 'Failed to set pixel format');
|
|
476
|
+
* ```
|
|
379
477
|
*/
|
|
380
478
|
static setPixelFormat(obj: OptionCapableObject, name: string, value: AVPixelFormat, searchFlags?: AVOptionSearchFlags): number;
|
|
381
479
|
/**
|
|
@@ -388,6 +486,13 @@ export declare class Option {
|
|
|
388
486
|
* @param value - Sample format
|
|
389
487
|
* @param searchFlags - Search flags
|
|
390
488
|
* @returns 0 on success, negative AVERROR on error
|
|
489
|
+
*
|
|
490
|
+
* @example
|
|
491
|
+
* ```typescript
|
|
492
|
+
* // Set audio codec sample format
|
|
493
|
+
* const ret = Option.setSampleFormat(codecContext, 'sample_fmt', AV_SAMPLE_FMT_FLTP, AV_OPT_SEARCH_CHILDREN);
|
|
494
|
+
* FFmpegError.throwIfError(ret, 'Failed to set sample format');
|
|
495
|
+
* ```
|
|
391
496
|
*/
|
|
392
497
|
static setSampleFormat(obj: OptionCapableObject, name: string, value: AVSampleFormat, searchFlags?: AVOptionSearchFlags): number;
|
|
393
498
|
/**
|
|
@@ -401,6 +506,13 @@ export declare class Option {
|
|
|
401
506
|
* @param height - Image height
|
|
402
507
|
* @param searchFlags - Search flags
|
|
403
508
|
* @returns 0 on success, negative AVERROR on error
|
|
509
|
+
*
|
|
510
|
+
* @example
|
|
511
|
+
* ```typescript
|
|
512
|
+
* // Set filter output size
|
|
513
|
+
* const ret = Option.setImageSize(filterContext, 'size', 1920, 1080, AV_OPT_SEARCH_CHILDREN);
|
|
514
|
+
* FFmpegError.throwIfError(ret, 'Failed to set image size');
|
|
515
|
+
* ```
|
|
404
516
|
*/
|
|
405
517
|
static setImageSize(obj: OptionCapableObject, name: string, width: number, height: number, searchFlags?: AVOptionSearchFlags): number;
|
|
406
518
|
/**
|
|
@@ -413,6 +525,13 @@ export declare class Option {
|
|
|
413
525
|
* @param value - Channel layout
|
|
414
526
|
* @param searchFlags - Search flags
|
|
415
527
|
* @returns 0 on success, negative AVERROR on error
|
|
528
|
+
*
|
|
529
|
+
* @example
|
|
530
|
+
* ```typescript
|
|
531
|
+
* // Set audio channel layout to stereo
|
|
532
|
+
* const ret = Option.setChannelLayout(codecContext, 'channel_layout', AV_CHANNEL_LAYOUT_STEREO, AV_OPT_SEARCH_CHILDREN);
|
|
533
|
+
* FFmpegError.throwIfError(ret, 'Failed to set channel layout');
|
|
534
|
+
* ```
|
|
416
535
|
*/
|
|
417
536
|
static setChannelLayout(obj: OptionCapableObject, name: string, value: number, searchFlags?: AVOptionSearchFlags): number;
|
|
418
537
|
/**
|
|
@@ -425,6 +544,15 @@ export declare class Option {
|
|
|
425
544
|
* @param value - Dictionary value
|
|
426
545
|
* @param searchFlags - Search flags
|
|
427
546
|
* @returns 0 on success, negative AVERROR on error
|
|
547
|
+
*
|
|
548
|
+
* @example
|
|
549
|
+
* ```typescript
|
|
550
|
+
* // Set metadata dictionary
|
|
551
|
+
* const dict = new Dictionary();
|
|
552
|
+
* dict.set('title', 'My Video');
|
|
553
|
+
* const ret = Option.setDict(formatContext, 'metadata', dict, AV_OPT_SEARCH_CHILDREN);
|
|
554
|
+
* FFmpegError.throwIfError(ret, 'Failed to set metadata');
|
|
555
|
+
* ```
|
|
428
556
|
*/
|
|
429
557
|
static setDict(obj: OptionCapableObject, name: string, value: Dictionary, searchFlags?: AVOptionSearchFlags): number;
|
|
430
558
|
/**
|
|
@@ -437,6 +565,14 @@ export declare class Option {
|
|
|
437
565
|
* @param value - Binary data
|
|
438
566
|
* @param searchFlags - Search flags
|
|
439
567
|
* @returns 0 on success, negative AVERROR on error
|
|
568
|
+
*
|
|
569
|
+
* @example
|
|
570
|
+
* ```typescript
|
|
571
|
+
* // Set binary extradata
|
|
572
|
+
* const extradata = Buffer.from([0x00, 0x01, 0x02, 0x03]);
|
|
573
|
+
* const ret = Option.setBin(codecContext, 'extradata', extradata, AV_OPT_SEARCH_CHILDREN);
|
|
574
|
+
* FFmpegError.throwIfError(ret, 'Failed to set extradata');
|
|
575
|
+
* ```
|
|
440
576
|
*/
|
|
441
577
|
static setBin(obj: OptionCapableObject, name: string, value: Buffer, searchFlags?: AVOptionSearchFlags): number;
|
|
442
578
|
/**
|
|
@@ -447,6 +583,12 @@ export declare class Option {
|
|
|
447
583
|
* Direct mapping to av_opt_set_defaults().
|
|
448
584
|
*
|
|
449
585
|
* @param obj - Object to reset
|
|
586
|
+
*
|
|
587
|
+
* @example
|
|
588
|
+
* ```typescript
|
|
589
|
+
* // Reset all codec options to defaults
|
|
590
|
+
* Option.setDefaults(codecContext);
|
|
591
|
+
* ```
|
|
450
592
|
*/
|
|
451
593
|
static setDefaults(obj: OptionCapableObject): void;
|
|
452
594
|
/**
|
|
@@ -459,6 +601,13 @@ export declare class Option {
|
|
|
459
601
|
* @param dest - Destination object
|
|
460
602
|
* @param src - Source object
|
|
461
603
|
* @returns 0 on success, negative AVERROR on error
|
|
604
|
+
*
|
|
605
|
+
* @example
|
|
606
|
+
* ```typescript
|
|
607
|
+
* // Copy options from one codec context to another
|
|
608
|
+
* const ret = Option.copy(destCodecContext, srcCodecContext);
|
|
609
|
+
* FFmpegError.throwIfError(ret, 'Failed to copy options');
|
|
610
|
+
* ```
|
|
462
611
|
*/
|
|
463
612
|
static copy(dest: OptionCapableObject, src: OptionCapableObject): number;
|
|
464
613
|
/**
|
|
@@ -470,6 +619,13 @@ export declare class Option {
|
|
|
470
619
|
* @param name - Option name
|
|
471
620
|
* @param searchFlags - Search flags
|
|
472
621
|
* @returns True if default, false if modified, null if not found
|
|
622
|
+
*
|
|
623
|
+
* @example
|
|
624
|
+
* ```typescript
|
|
625
|
+
* // Check if bitrate is at default value
|
|
626
|
+
* const isDefault = Option.isSetToDefault(codecContext, 'b', AV_OPT_SEARCH_CHILDREN);
|
|
627
|
+
* console.log('Bitrate is default:', isDefault);
|
|
628
|
+
* ```
|
|
473
629
|
*/
|
|
474
630
|
static isSetToDefault(obj: OptionCapableObject, name: string, searchFlags?: AVOptionSearchFlags): boolean | null;
|
|
475
631
|
/**
|
|
@@ -483,6 +639,13 @@ export declare class Option {
|
|
|
483
639
|
* @param keyValSep - Key-value separator
|
|
484
640
|
* @param pairsSep - Pairs separator
|
|
485
641
|
* @returns Serialized string, or null on error
|
|
642
|
+
*
|
|
643
|
+
* @example
|
|
644
|
+
* ```typescript
|
|
645
|
+
* // Serialize codec options to string
|
|
646
|
+
* const serialized = Option.serialize(codecContext, 0, 0, '=', ':');
|
|
647
|
+
* console.log('Options:', serialized); // 'bitrate=2000000:preset=fast'
|
|
648
|
+
* ```
|
|
486
649
|
*/
|
|
487
650
|
static serialize(obj: OptionCapableObject, optFlags?: number, flags?: number, keyValSep?: string, pairsSep?: string): string | null;
|
|
488
651
|
/**
|
|
@@ -491,6 +654,12 @@ export declare class Option {
|
|
|
491
654
|
* Direct mapping to av_opt_free().
|
|
492
655
|
*
|
|
493
656
|
* @param obj - Object to free options from
|
|
657
|
+
*
|
|
658
|
+
* @example
|
|
659
|
+
* ```typescript
|
|
660
|
+
* // Free codec context options
|
|
661
|
+
* Option.free(codecContext);
|
|
662
|
+
* ```
|
|
494
663
|
*/
|
|
495
664
|
static free(obj: OptionCapableObject): void;
|
|
496
665
|
/**
|
|
@@ -502,6 +671,13 @@ export declare class Option {
|
|
|
502
671
|
* @param reqFlags - Required flags
|
|
503
672
|
* @param rejFlags - Rejected flags
|
|
504
673
|
* @returns 0 on success, negative AVERROR on error
|
|
674
|
+
*
|
|
675
|
+
* @example
|
|
676
|
+
* ```typescript
|
|
677
|
+
* // Show all codec options for debugging
|
|
678
|
+
* const ret = Option.show(codecContext, 0, 0);
|
|
679
|
+
* FFmpegError.throwIfError(ret, 'Failed to show options');
|
|
680
|
+
* ```
|
|
505
681
|
*/
|
|
506
682
|
static show(obj: OptionCapableObject, reqFlags?: number, rejFlags?: number): number;
|
|
507
683
|
}
|
package/dist/lib/option.js
CHANGED
|
@@ -255,6 +255,13 @@ export class Option {
|
|
|
255
255
|
* @param name - Option name
|
|
256
256
|
* @param searchFlags - Search flags
|
|
257
257
|
* @returns Option value as string, or null
|
|
258
|
+
*
|
|
259
|
+
* @example
|
|
260
|
+
* ```typescript
|
|
261
|
+
* // Get codec preset option
|
|
262
|
+
* const preset = Option.get(codecContext, 'preset', AV_OPT_SEARCH_CHILDREN);
|
|
263
|
+
* console.log('Codec preset:', preset); // 'medium', 'fast', etc.
|
|
264
|
+
* ```
|
|
258
265
|
*/
|
|
259
266
|
static get(obj, name, searchFlags = AVFLAG_NONE) {
|
|
260
267
|
return bindings.Option.get(obj, name, searchFlags);
|
|
@@ -268,6 +275,13 @@ export class Option {
|
|
|
268
275
|
* @param name - Option name
|
|
269
276
|
* @param searchFlags - Search flags
|
|
270
277
|
* @returns Option value as integer, or null
|
|
278
|
+
*
|
|
279
|
+
* @example
|
|
280
|
+
* ```typescript
|
|
281
|
+
* // Get codec GOP size
|
|
282
|
+
* const gopSize = Option.getInt(codecContext, 'g', AV_OPT_SEARCH_CHILDREN);
|
|
283
|
+
* console.log('GOP size:', gopSize); // 60, 120, etc.
|
|
284
|
+
* ```
|
|
271
285
|
*/
|
|
272
286
|
static getInt(obj, name, searchFlags = AVFLAG_NONE) {
|
|
273
287
|
return bindings.Option.getInt(obj, name, searchFlags);
|
|
@@ -281,6 +295,13 @@ export class Option {
|
|
|
281
295
|
* @param name - Option name
|
|
282
296
|
* @param searchFlags - Search flags
|
|
283
297
|
* @returns Option value as double, or null
|
|
298
|
+
*
|
|
299
|
+
* @example
|
|
300
|
+
* ```typescript
|
|
301
|
+
* // Get codec quality scale
|
|
302
|
+
* const crf = Option.getDouble(codecContext, 'crf', AV_OPT_SEARCH_CHILDREN);
|
|
303
|
+
* console.log('CRF value:', crf); // 23.0, 18.0, etc.
|
|
304
|
+
* ```
|
|
284
305
|
*/
|
|
285
306
|
static getDouble(obj, name, searchFlags = AVFLAG_NONE) {
|
|
286
307
|
return bindings.Option.getDouble(obj, name, searchFlags);
|
|
@@ -294,6 +315,13 @@ export class Option {
|
|
|
294
315
|
* @param name - Option name
|
|
295
316
|
* @param searchFlags - Search flags
|
|
296
317
|
* @returns Option value as rational, or null
|
|
318
|
+
*
|
|
319
|
+
* @example
|
|
320
|
+
* ```typescript
|
|
321
|
+
* // Get codec time base
|
|
322
|
+
* const timeBase = Option.getRational(codecContext, 'time_base', AV_OPT_SEARCH_CHILDREN);
|
|
323
|
+
* console.log('Time base:', timeBase); // { num: 1, den: 30 }
|
|
324
|
+
* ```
|
|
297
325
|
*/
|
|
298
326
|
static getRational(obj, name, searchFlags = AVFLAG_NONE) {
|
|
299
327
|
return bindings.Option.getRational(obj, name, searchFlags);
|
|
@@ -307,6 +335,13 @@ export class Option {
|
|
|
307
335
|
* @param name - Option name
|
|
308
336
|
* @param searchFlags - Search flags
|
|
309
337
|
* @returns Pixel format value, or null
|
|
338
|
+
*
|
|
339
|
+
* @example
|
|
340
|
+
* ```typescript
|
|
341
|
+
* // Get filter pixel format
|
|
342
|
+
* const pixFmt = Option.getPixelFormat(filterContext, 'pix_fmt', AV_OPT_SEARCH_CHILDREN);
|
|
343
|
+
* console.log('Pixel format:', pixFmt); // AV_PIX_FMT_YUV420P, etc.
|
|
344
|
+
* ```
|
|
310
345
|
*/
|
|
311
346
|
static getPixelFormat(obj, name, searchFlags = AVFLAG_NONE) {
|
|
312
347
|
return bindings.Option.getPixelFormat(obj, name, searchFlags);
|
|
@@ -320,6 +355,13 @@ export class Option {
|
|
|
320
355
|
* @param name - Option name
|
|
321
356
|
* @param searchFlags - Search flags
|
|
322
357
|
* @returns Sample format value, or null
|
|
358
|
+
*
|
|
359
|
+
* @example
|
|
360
|
+
* ```typescript
|
|
361
|
+
* // Get audio codec sample format
|
|
362
|
+
* const sampleFmt = Option.getSampleFormat(codecContext, 'sample_fmt', AV_OPT_SEARCH_CHILDREN);
|
|
363
|
+
* console.log('Sample format:', sampleFmt); // AV_SAMPLE_FMT_FLTP, etc.
|
|
364
|
+
* ```
|
|
323
365
|
*/
|
|
324
366
|
static getSampleFormat(obj, name, searchFlags = AVFLAG_NONE) {
|
|
325
367
|
return bindings.Option.getSampleFormat(obj, name, searchFlags);
|
|
@@ -333,6 +375,13 @@ export class Option {
|
|
|
333
375
|
* @param name - Option name
|
|
334
376
|
* @param searchFlags - Search flags
|
|
335
377
|
* @returns Width and height, or null
|
|
378
|
+
*
|
|
379
|
+
* @example
|
|
380
|
+
* ```typescript
|
|
381
|
+
* // Get filter output size
|
|
382
|
+
* const size = Option.getImageSize(filterContext, 'size', AV_OPT_SEARCH_CHILDREN);
|
|
383
|
+
* console.log('Output size:', size); // { width: 1920, height: 1080 }
|
|
384
|
+
* ```
|
|
336
385
|
*/
|
|
337
386
|
static getImageSize(obj, name, searchFlags = AVFLAG_NONE) {
|
|
338
387
|
return bindings.Option.getImageSize(obj, name, searchFlags);
|
|
@@ -346,6 +395,13 @@ export class Option {
|
|
|
346
395
|
* @param name - Option name
|
|
347
396
|
* @param searchFlags - Search flags
|
|
348
397
|
* @returns Channel layout, or null
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
* ```typescript
|
|
401
|
+
* // Get audio channel layout
|
|
402
|
+
* const layout = Option.getChannelLayout(codecContext, 'channel_layout', AV_OPT_SEARCH_CHILDREN);
|
|
403
|
+
* console.log('Channel layout:', layout); // stereo, 5.1, etc.
|
|
404
|
+
* ```
|
|
349
405
|
*/
|
|
350
406
|
static getChannelLayout(obj, name, searchFlags = AVFLAG_NONE) {
|
|
351
407
|
return bindings.Option.getChannelLayout(obj, name, searchFlags);
|
|
@@ -359,6 +415,13 @@ export class Option {
|
|
|
359
415
|
* @param name - Option name
|
|
360
416
|
* @param searchFlags - Search flags
|
|
361
417
|
* @returns Dictionary value, or null
|
|
418
|
+
*
|
|
419
|
+
* @example
|
|
420
|
+
* ```typescript
|
|
421
|
+
* // Get metadata dictionary
|
|
422
|
+
* const metadata = Option.getDict(formatContext, 'metadata', AV_OPT_SEARCH_CHILDREN);
|
|
423
|
+
* console.log('Metadata:', metadata?.get('title'));
|
|
424
|
+
* ```
|
|
362
425
|
*/
|
|
363
426
|
static getDict(obj, name, searchFlags = AVFLAG_NONE) {
|
|
364
427
|
const native = bindings.Option.getDict(obj, name, searchFlags);
|
|
@@ -374,6 +437,13 @@ export class Option {
|
|
|
374
437
|
* @param value - String value
|
|
375
438
|
* @param searchFlags - Search flags
|
|
376
439
|
* @returns 0 on success, negative AVERROR on error
|
|
440
|
+
*
|
|
441
|
+
* @example
|
|
442
|
+
* ```typescript
|
|
443
|
+
* // Set codec preset
|
|
444
|
+
* const ret = Option.set(codecContext, 'preset', 'fast', AV_OPT_SEARCH_CHILDREN);
|
|
445
|
+
* FFmpegError.throwIfError(ret, 'Failed to set preset');
|
|
446
|
+
* ```
|
|
377
447
|
*/
|
|
378
448
|
static set(obj, name, value, searchFlags = AVFLAG_NONE) {
|
|
379
449
|
return bindings.Option.set(obj, name, value, searchFlags);
|
|
@@ -388,6 +458,13 @@ export class Option {
|
|
|
388
458
|
* @param value - Integer value
|
|
389
459
|
* @param searchFlags - Search flags
|
|
390
460
|
* @returns 0 on success, negative AVERROR on error
|
|
461
|
+
*
|
|
462
|
+
* @example
|
|
463
|
+
* ```typescript
|
|
464
|
+
* // Set codec bitrate
|
|
465
|
+
* const ret = Option.setInt(codecContext, 'b', 2000000, AV_OPT_SEARCH_CHILDREN);
|
|
466
|
+
* FFmpegError.throwIfError(ret, 'Failed to set bitrate');
|
|
467
|
+
* ```
|
|
391
468
|
*/
|
|
392
469
|
static setInt(obj, name, value, searchFlags = AVFLAG_NONE) {
|
|
393
470
|
return bindings.Option.setInt(obj, name, value, searchFlags);
|
|
@@ -402,6 +479,13 @@ export class Option {
|
|
|
402
479
|
* @param value - Double value
|
|
403
480
|
* @param searchFlags - Search flags
|
|
404
481
|
* @returns 0 on success, negative AVERROR on error
|
|
482
|
+
*
|
|
483
|
+
* @example
|
|
484
|
+
* ```typescript
|
|
485
|
+
* // Set codec CRF value
|
|
486
|
+
* const ret = Option.setDouble(codecContext, 'crf', 23.0, AV_OPT_SEARCH_CHILDREN);
|
|
487
|
+
* FFmpegError.throwIfError(ret, 'Failed to set CRF');
|
|
488
|
+
* ```
|
|
405
489
|
*/
|
|
406
490
|
static setDouble(obj, name, value, searchFlags = AVFLAG_NONE) {
|
|
407
491
|
return bindings.Option.setDouble(obj, name, value, searchFlags);
|
|
@@ -416,6 +500,13 @@ export class Option {
|
|
|
416
500
|
* @param value - Rational value
|
|
417
501
|
* @param searchFlags - Search flags
|
|
418
502
|
* @returns 0 on success, negative AVERROR on error
|
|
503
|
+
*
|
|
504
|
+
* @example
|
|
505
|
+
* ```typescript
|
|
506
|
+
* // Set codec frame rate
|
|
507
|
+
* const ret = Option.setRational(codecContext, 'framerate', { num: 30, den: 1 }, AV_OPT_SEARCH_CHILDREN);
|
|
508
|
+
* FFmpegError.throwIfError(ret, 'Failed to set framerate');
|
|
509
|
+
* ```
|
|
419
510
|
*/
|
|
420
511
|
static setRational(obj, name, value, searchFlags = AVFLAG_NONE) {
|
|
421
512
|
return bindings.Option.setRational(obj, name, value, searchFlags);
|
|
@@ -430,6 +521,13 @@ export class Option {
|
|
|
430
521
|
* @param value - Pixel format
|
|
431
522
|
* @param searchFlags - Search flags
|
|
432
523
|
* @returns 0 on success, negative AVERROR on error
|
|
524
|
+
*
|
|
525
|
+
* @example
|
|
526
|
+
* ```typescript
|
|
527
|
+
* // Set filter pixel format
|
|
528
|
+
* const ret = Option.setPixelFormat(filterContext, 'pix_fmt', AV_PIX_FMT_YUV420P, AV_OPT_SEARCH_CHILDREN);
|
|
529
|
+
* FFmpegError.throwIfError(ret, 'Failed to set pixel format');
|
|
530
|
+
* ```
|
|
433
531
|
*/
|
|
434
532
|
static setPixelFormat(obj, name, value, searchFlags = AVFLAG_NONE) {
|
|
435
533
|
return bindings.Option.setPixelFormat(obj, name, value, searchFlags);
|
|
@@ -444,6 +542,13 @@ export class Option {
|
|
|
444
542
|
* @param value - Sample format
|
|
445
543
|
* @param searchFlags - Search flags
|
|
446
544
|
* @returns 0 on success, negative AVERROR on error
|
|
545
|
+
*
|
|
546
|
+
* @example
|
|
547
|
+
* ```typescript
|
|
548
|
+
* // Set audio codec sample format
|
|
549
|
+
* const ret = Option.setSampleFormat(codecContext, 'sample_fmt', AV_SAMPLE_FMT_FLTP, AV_OPT_SEARCH_CHILDREN);
|
|
550
|
+
* FFmpegError.throwIfError(ret, 'Failed to set sample format');
|
|
551
|
+
* ```
|
|
447
552
|
*/
|
|
448
553
|
static setSampleFormat(obj, name, value, searchFlags = AVFLAG_NONE) {
|
|
449
554
|
return bindings.Option.setSampleFormat(obj, name, value, searchFlags);
|
|
@@ -459,6 +564,13 @@ export class Option {
|
|
|
459
564
|
* @param height - Image height
|
|
460
565
|
* @param searchFlags - Search flags
|
|
461
566
|
* @returns 0 on success, negative AVERROR on error
|
|
567
|
+
*
|
|
568
|
+
* @example
|
|
569
|
+
* ```typescript
|
|
570
|
+
* // Set filter output size
|
|
571
|
+
* const ret = Option.setImageSize(filterContext, 'size', 1920, 1080, AV_OPT_SEARCH_CHILDREN);
|
|
572
|
+
* FFmpegError.throwIfError(ret, 'Failed to set image size');
|
|
573
|
+
* ```
|
|
462
574
|
*/
|
|
463
575
|
static setImageSize(obj, name, width, height, searchFlags = AVFLAG_NONE) {
|
|
464
576
|
return bindings.Option.setImageSize(obj, name, width, height, searchFlags);
|
|
@@ -473,6 +585,13 @@ export class Option {
|
|
|
473
585
|
* @param value - Channel layout
|
|
474
586
|
* @param searchFlags - Search flags
|
|
475
587
|
* @returns 0 on success, negative AVERROR on error
|
|
588
|
+
*
|
|
589
|
+
* @example
|
|
590
|
+
* ```typescript
|
|
591
|
+
* // Set audio channel layout to stereo
|
|
592
|
+
* const ret = Option.setChannelLayout(codecContext, 'channel_layout', AV_CHANNEL_LAYOUT_STEREO, AV_OPT_SEARCH_CHILDREN);
|
|
593
|
+
* FFmpegError.throwIfError(ret, 'Failed to set channel layout');
|
|
594
|
+
* ```
|
|
476
595
|
*/
|
|
477
596
|
static setChannelLayout(obj, name, value, searchFlags = AVFLAG_NONE) {
|
|
478
597
|
return bindings.Option.setChannelLayout(obj, name, value, searchFlags);
|
|
@@ -487,6 +606,15 @@ export class Option {
|
|
|
487
606
|
* @param value - Dictionary value
|
|
488
607
|
* @param searchFlags - Search flags
|
|
489
608
|
* @returns 0 on success, negative AVERROR on error
|
|
609
|
+
*
|
|
610
|
+
* @example
|
|
611
|
+
* ```typescript
|
|
612
|
+
* // Set metadata dictionary
|
|
613
|
+
* const dict = new Dictionary();
|
|
614
|
+
* dict.set('title', 'My Video');
|
|
615
|
+
* const ret = Option.setDict(formatContext, 'metadata', dict, AV_OPT_SEARCH_CHILDREN);
|
|
616
|
+
* FFmpegError.throwIfError(ret, 'Failed to set metadata');
|
|
617
|
+
* ```
|
|
490
618
|
*/
|
|
491
619
|
static setDict(obj, name, value, searchFlags = AVFLAG_NONE) {
|
|
492
620
|
return bindings.Option.setDict(obj, name, value.getNative(), searchFlags);
|
|
@@ -501,6 +629,14 @@ export class Option {
|
|
|
501
629
|
* @param value - Binary data
|
|
502
630
|
* @param searchFlags - Search flags
|
|
503
631
|
* @returns 0 on success, negative AVERROR on error
|
|
632
|
+
*
|
|
633
|
+
* @example
|
|
634
|
+
* ```typescript
|
|
635
|
+
* // Set binary extradata
|
|
636
|
+
* const extradata = Buffer.from([0x00, 0x01, 0x02, 0x03]);
|
|
637
|
+
* const ret = Option.setBin(codecContext, 'extradata', extradata, AV_OPT_SEARCH_CHILDREN);
|
|
638
|
+
* FFmpegError.throwIfError(ret, 'Failed to set extradata');
|
|
639
|
+
* ```
|
|
504
640
|
*/
|
|
505
641
|
static setBin(obj, name, value, searchFlags = AVFLAG_NONE) {
|
|
506
642
|
return bindings.Option.setBin(obj, name, value, searchFlags);
|
|
@@ -513,6 +649,12 @@ export class Option {
|
|
|
513
649
|
* Direct mapping to av_opt_set_defaults().
|
|
514
650
|
*
|
|
515
651
|
* @param obj - Object to reset
|
|
652
|
+
*
|
|
653
|
+
* @example
|
|
654
|
+
* ```typescript
|
|
655
|
+
* // Reset all codec options to defaults
|
|
656
|
+
* Option.setDefaults(codecContext);
|
|
657
|
+
* ```
|
|
516
658
|
*/
|
|
517
659
|
static setDefaults(obj) {
|
|
518
660
|
bindings.Option.setDefaults(obj);
|
|
@@ -527,6 +669,13 @@ export class Option {
|
|
|
527
669
|
* @param dest - Destination object
|
|
528
670
|
* @param src - Source object
|
|
529
671
|
* @returns 0 on success, negative AVERROR on error
|
|
672
|
+
*
|
|
673
|
+
* @example
|
|
674
|
+
* ```typescript
|
|
675
|
+
* // Copy options from one codec context to another
|
|
676
|
+
* const ret = Option.copy(destCodecContext, srcCodecContext);
|
|
677
|
+
* FFmpegError.throwIfError(ret, 'Failed to copy options');
|
|
678
|
+
* ```
|
|
530
679
|
*/
|
|
531
680
|
static copy(dest, src) {
|
|
532
681
|
return bindings.Option.copy(dest, src);
|
|
@@ -540,6 +689,13 @@ export class Option {
|
|
|
540
689
|
* @param name - Option name
|
|
541
690
|
* @param searchFlags - Search flags
|
|
542
691
|
* @returns True if default, false if modified, null if not found
|
|
692
|
+
*
|
|
693
|
+
* @example
|
|
694
|
+
* ```typescript
|
|
695
|
+
* // Check if bitrate is at default value
|
|
696
|
+
* const isDefault = Option.isSetToDefault(codecContext, 'b', AV_OPT_SEARCH_CHILDREN);
|
|
697
|
+
* console.log('Bitrate is default:', isDefault);
|
|
698
|
+
* ```
|
|
543
699
|
*/
|
|
544
700
|
static isSetToDefault(obj, name, searchFlags = AVFLAG_NONE) {
|
|
545
701
|
return bindings.Option.isSetToDefault(obj, name, searchFlags);
|
|
@@ -555,6 +711,13 @@ export class Option {
|
|
|
555
711
|
* @param keyValSep - Key-value separator
|
|
556
712
|
* @param pairsSep - Pairs separator
|
|
557
713
|
* @returns Serialized string, or null on error
|
|
714
|
+
*
|
|
715
|
+
* @example
|
|
716
|
+
* ```typescript
|
|
717
|
+
* // Serialize codec options to string
|
|
718
|
+
* const serialized = Option.serialize(codecContext, 0, 0, '=', ':');
|
|
719
|
+
* console.log('Options:', serialized); // 'bitrate=2000000:preset=fast'
|
|
720
|
+
* ```
|
|
558
721
|
*/
|
|
559
722
|
static serialize(obj, optFlags = 0, flags = 0, keyValSep = '=', pairsSep = ',') {
|
|
560
723
|
return bindings.Option.serialize(obj, optFlags, flags, keyValSep, pairsSep);
|
|
@@ -565,6 +728,12 @@ export class Option {
|
|
|
565
728
|
* Direct mapping to av_opt_free().
|
|
566
729
|
*
|
|
567
730
|
* @param obj - Object to free options from
|
|
731
|
+
*
|
|
732
|
+
* @example
|
|
733
|
+
* ```typescript
|
|
734
|
+
* // Free codec context options
|
|
735
|
+
* Option.free(codecContext);
|
|
736
|
+
* ```
|
|
568
737
|
*/
|
|
569
738
|
static free(obj) {
|
|
570
739
|
bindings.Option.free(obj);
|
|
@@ -578,6 +747,13 @@ export class Option {
|
|
|
578
747
|
* @param reqFlags - Required flags
|
|
579
748
|
* @param rejFlags - Rejected flags
|
|
580
749
|
* @returns 0 on success, negative AVERROR on error
|
|
750
|
+
*
|
|
751
|
+
* @example
|
|
752
|
+
* ```typescript
|
|
753
|
+
* // Show all codec options for debugging
|
|
754
|
+
* const ret = Option.show(codecContext, 0, 0);
|
|
755
|
+
* FFmpegError.throwIfError(ret, 'Failed to show options');
|
|
756
|
+
* ```
|
|
581
757
|
*/
|
|
582
758
|
static show(obj, reqFlags = 0, rejFlags = 0) {
|
|
583
759
|
return bindings.Option.show(obj, reqFlags, rejFlags);
|