node-av 5.2.4 → 6.0.0-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/api/bitstream-filter.d.ts +11 -6
- package/dist/api/bitstream-filter.js.map +1 -1
- package/dist/api/decoder.d.ts +9 -7
- package/dist/api/decoder.js.map +1 -1
- package/dist/api/demuxer.d.ts +30 -24
- package/dist/api/demuxer.js +4 -5
- package/dist/api/demuxer.js.map +1 -1
- package/dist/api/device.js.map +1 -1
- package/dist/api/encoder.d.ts +9 -7
- package/dist/api/encoder.js +10 -4
- package/dist/api/encoder.js.map +1 -1
- package/dist/api/filter-presets.d.ts +27 -658
- package/dist/api/filter-presets.js +45 -838
- package/dist/api/filter-presets.js.map +1 -1
- package/dist/api/fmp4-stream.js +1 -1
- package/dist/api/fmp4-stream.js.map +1 -1
- package/dist/api/index.d.ts +1 -4
- package/dist/api/index.js +0 -6
- package/dist/api/index.js.map +1 -1
- package/dist/api/muxer.d.ts +21 -15
- package/dist/api/muxer.js.map +1 -1
- package/dist/api/rtp-stream.js +1 -1
- package/dist/api/rtp-stream.js.map +1 -1
- package/dist/api/utilities/index.d.ts +1 -1
- package/dist/api/utilities/index.js.map +1 -1
- package/dist/api/webrtc-stream.d.ts +0 -1
- package/dist/api/webrtc-stream.js +0 -1
- package/dist/api/webrtc-stream.js.map +1 -1
- package/dist/constants/bsf-options.d.ts +326 -0
- package/dist/constants/bsf-options.js +7 -0
- package/dist/constants/bsf-options.js.map +1 -0
- package/dist/constants/constants.d.ts +11 -0
- package/dist/constants/constants.js +11 -0
- package/dist/constants/constants.js.map +1 -1
- package/dist/constants/decoders.d.ts +636 -618
- package/dist/constants/decoders.js +1 -3
- package/dist/constants/decoders.js.map +1 -1
- package/dist/constants/encoders.d.ts +300 -282
- package/dist/constants/encoders.js +0 -2
- package/dist/constants/encoders.js.map +1 -1
- package/dist/constants/filter-options.d.ts +10915 -0
- package/dist/constants/filter-options.js +7 -0
- package/dist/constants/filter-options.js.map +1 -0
- package/dist/constants/format-options.d.ts +2555 -0
- package/dist/constants/format-options.js +7 -0
- package/dist/constants/format-options.js.map +1 -0
- package/dist/constants/index.d.ts +4 -0
- package/dist/constants/options.d.ts +4073 -0
- package/dist/constants/options.js +7 -0
- package/dist/constants/options.js.map +1 -0
- package/dist/lib/codec.d.ts +36 -5
- package/dist/lib/codec.js +37 -4
- package/dist/lib/codec.js.map +1 -1
- package/dist/lib/dictionary.d.ts +1 -1
- package/dist/lib/dictionary.js.map +1 -1
- package/dist/lib/frame.d.ts +29 -0
- package/dist/lib/frame.js +31 -0
- package/dist/lib/frame.js.map +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/native-types.d.ts +19 -0
- package/dist/webrtc/index.d.ts +3 -0
- package/dist/webrtc/index.js +7 -0
- package/dist/webrtc/index.js.map +1 -0
- package/package.json +31 -21
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { AVPixelFormat, AVSampleFormat } from '../constants/index.js';
|
|
1
|
+
import type { AVPixelFormat, AVSampleFormat, FilterOptionsMap } from '../constants/index.js';
|
|
2
2
|
import type { HardwareContext } from './hardware.js';
|
|
3
3
|
/**
|
|
4
4
|
* Hardware filter capabilities for different platforms.
|
|
@@ -41,8 +41,8 @@ export interface FilterSupport {
|
|
|
41
41
|
* // Software filter chain
|
|
42
42
|
* const filter = FilterPreset.chain()
|
|
43
43
|
* .scale(1920, 1080)
|
|
44
|
-
* .fps
|
|
45
|
-
* .
|
|
44
|
+
* .filter('fps', { fps: 30 })
|
|
45
|
+
* .filter('fade', { type: 'in', start_time: 0, duration: 2 })
|
|
46
46
|
* .build();
|
|
47
47
|
*
|
|
48
48
|
* // Hardware-accelerated filter chain
|
|
@@ -85,7 +85,7 @@ export declare class FilterPreset {
|
|
|
85
85
|
* // Software filter chain
|
|
86
86
|
* const filter = FilterPreset.chain()
|
|
87
87
|
* .scale(1280, 720)
|
|
88
|
-
* .fps
|
|
88
|
+
* .filter('fps', { fps: 30 })
|
|
89
89
|
* .build();
|
|
90
90
|
* ```
|
|
91
91
|
*
|
|
@@ -113,6 +113,29 @@ export declare class FilterPreset {
|
|
|
113
113
|
* ```
|
|
114
114
|
*/
|
|
115
115
|
custom(filter?: string): this;
|
|
116
|
+
/**
|
|
117
|
+
* Adds any FFmpeg filter to the chain with type-safe options.
|
|
118
|
+
*
|
|
119
|
+
* Provides autocomplete for every available filter name and its options
|
|
120
|
+
* (generated from FFmpeg's AVOption metadata). Prefer the dedicated methods
|
|
121
|
+
* (e.g. {@link scale}) when hardware-aware selection or automatic mapping is
|
|
122
|
+
* needed; use {@link custom} for raw filter strings.
|
|
123
|
+
*
|
|
124
|
+
* @param name - Filter name (autocompleted from all available filters)
|
|
125
|
+
*
|
|
126
|
+
* @param options - Filter-specific options, typed to the chosen filter
|
|
127
|
+
*
|
|
128
|
+
* @returns This instance for chaining
|
|
129
|
+
*
|
|
130
|
+
* @example
|
|
131
|
+
* ```typescript
|
|
132
|
+
* chain
|
|
133
|
+
* .filter('drawtext', { text: 'hello', fontsize: 24 })
|
|
134
|
+
* .filter('hue', { s: 0 });
|
|
135
|
+
* // "drawtext=text=hello:fontsize=24,hue=s=0"
|
|
136
|
+
* ```
|
|
137
|
+
*/
|
|
138
|
+
filter<N extends keyof FilterOptionsMap>(name: N, options?: FilterOptionsMap[N]): this;
|
|
116
139
|
/**
|
|
117
140
|
* Builds the final filter string.
|
|
118
141
|
*
|
|
@@ -305,22 +328,6 @@ export declare class FilterPreset {
|
|
|
305
328
|
* ```
|
|
306
329
|
*/
|
|
307
330
|
sobel(planes?: number, scale?: number): FilterPreset;
|
|
308
|
-
/**
|
|
309
|
-
* Adds an FPS filter to change frame rate.
|
|
310
|
-
*
|
|
311
|
-
* @param fps - Target frames per second
|
|
312
|
-
*
|
|
313
|
-
* @returns This instance for chaining
|
|
314
|
-
*
|
|
315
|
-
* @example
|
|
316
|
-
* ```typescript
|
|
317
|
-
* chain.fps(30) // Convert to 30 FPS
|
|
318
|
-
* chain.fps(23.976) // Film frame rate
|
|
319
|
-
* ```
|
|
320
|
-
*
|
|
321
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#fps | FFmpeg fps filter}
|
|
322
|
-
*/
|
|
323
|
-
fps(fps: number): FilterPreset;
|
|
324
331
|
/**
|
|
325
332
|
* Adds a format filter to convert pixel format.
|
|
326
333
|
*
|
|
@@ -340,22 +347,6 @@ export declare class FilterPreset {
|
|
|
340
347
|
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#format | FFmpeg format filter}
|
|
341
348
|
*/
|
|
342
349
|
format(pixelFormat: AVPixelFormat | AVPixelFormat[]): FilterPreset;
|
|
343
|
-
/**
|
|
344
|
-
* Adds a rotate filter to the chain.
|
|
345
|
-
*
|
|
346
|
-
* @param angle - Rotation angle in degrees
|
|
347
|
-
*
|
|
348
|
-
* @returns This instance for chaining
|
|
349
|
-
*
|
|
350
|
-
* @example
|
|
351
|
-
* ```typescript
|
|
352
|
-
* chain.rotate(90) // Rotate 90 degrees clockwise
|
|
353
|
-
* chain.rotate(-45) // Rotate 45 degrees counter-clockwise
|
|
354
|
-
* ```
|
|
355
|
-
*
|
|
356
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#rotate | FFmpeg rotate filter}
|
|
357
|
-
*/
|
|
358
|
-
rotate(angle: number): FilterPreset;
|
|
359
350
|
/**
|
|
360
351
|
* Adds a flip filter to the chain (hardware-specific).
|
|
361
352
|
* Falls back to hflip/vflip if hardware flip not available
|
|
@@ -425,26 +416,6 @@ export declare class FilterPreset {
|
|
|
425
416
|
* ```
|
|
426
417
|
*/
|
|
427
418
|
tonemap(alg: string, options: Record<string, string | number>): FilterPreset;
|
|
428
|
-
/**
|
|
429
|
-
* Creates a fade filter string for video.
|
|
430
|
-
*
|
|
431
|
-
* @param type - Fade type ('in' or 'out')
|
|
432
|
-
*
|
|
433
|
-
* @param start - Start time in seconds
|
|
434
|
-
*
|
|
435
|
-
* @param duration - Fade duration in seconds
|
|
436
|
-
*
|
|
437
|
-
* @returns Filter string or null if not supported
|
|
438
|
-
*
|
|
439
|
-
* @example
|
|
440
|
-
* ```typescript
|
|
441
|
-
* presets.fade('in', 0, 2) // 2-second fade in from start
|
|
442
|
-
* presets.fade('out', 10, 1) // 1-second fade out at 10 seconds
|
|
443
|
-
* ```
|
|
444
|
-
*
|
|
445
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#fade | FFmpeg fade filter}
|
|
446
|
-
*/
|
|
447
|
-
fade(type: 'in' | 'out', start: number, duration: number): FilterPreset;
|
|
448
419
|
/**
|
|
449
420
|
* Creates an overlay filter string to composite two video streams.
|
|
450
421
|
*
|
|
@@ -468,22 +439,6 @@ export declare class FilterPreset {
|
|
|
468
439
|
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#overlay | FFmpeg overlay filter}
|
|
469
440
|
*/
|
|
470
441
|
overlay(x?: number, y?: number, options?: Record<string, string>): FilterPreset;
|
|
471
|
-
/**
|
|
472
|
-
* Creates a volume filter string for audio.
|
|
473
|
-
*
|
|
474
|
-
* @param factor - Volume multiplication factor (1.0 = unchanged, 2.0 = double)
|
|
475
|
-
*
|
|
476
|
-
* @returns Filter string or null if not supported
|
|
477
|
-
*
|
|
478
|
-
* @example
|
|
479
|
-
* ```typescript
|
|
480
|
-
* presets.volume(0.5) // Reduce volume by 50%
|
|
481
|
-
* presets.volume(1.5) // Increase volume by 50%
|
|
482
|
-
* ```
|
|
483
|
-
*
|
|
484
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#volume | FFmpeg volume filter}
|
|
485
|
-
*/
|
|
486
|
-
volume(factor: number): FilterPreset;
|
|
487
442
|
/**
|
|
488
443
|
* Creates an audio format filter string.
|
|
489
444
|
*
|
|
@@ -510,106 +465,6 @@ export declare class FilterPreset {
|
|
|
510
465
|
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#aformat | FFmpeg aformat filter}
|
|
511
466
|
*/
|
|
512
467
|
aformat(sampleFormat: AVSampleFormat | AVSampleFormat[], sampleRate?: number, channelLayout?: string): FilterPreset;
|
|
513
|
-
/**
|
|
514
|
-
* Adds an asetnsamples filter to set the number of samples per frame.
|
|
515
|
-
* This is crucial for encoders like Opus that require specific frame sizes.
|
|
516
|
-
*
|
|
517
|
-
* @param samples - Number of samples per frame
|
|
518
|
-
*
|
|
519
|
-
* @param padding - Whether to pad or drop samples (default: true)
|
|
520
|
-
*
|
|
521
|
-
* @returns This instance for chaining
|
|
522
|
-
*
|
|
523
|
-
* @example
|
|
524
|
-
* ```typescript
|
|
525
|
-
* // For Opus encoder (requires 960 samples)
|
|
526
|
-
* chain.asetnsamples(960);
|
|
527
|
-
*
|
|
528
|
-
* // Drop samples instead of padding
|
|
529
|
-
* chain.asetnsamples(1024, false);
|
|
530
|
-
* ```
|
|
531
|
-
*
|
|
532
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#asetnsamples | FFmpeg asetnsamples filter}
|
|
533
|
-
*/
|
|
534
|
-
asetnsamples(samples: number, padding?: boolean): FilterPreset;
|
|
535
|
-
/**
|
|
536
|
-
* Adds an aresample filter to change audio sample rate, format, and channel layout.
|
|
537
|
-
*
|
|
538
|
-
* Uses libswresample for high-quality audio resampling and format conversion.
|
|
539
|
-
* Can also perform timestamp compensation (stretch/squeeze/fill/trim).
|
|
540
|
-
*
|
|
541
|
-
* @param rate - Target sample rate in Hz
|
|
542
|
-
*
|
|
543
|
-
* @param format - Optional target sample format (e.g., 's16', 'flt', 'fltp')
|
|
544
|
-
*
|
|
545
|
-
* @param channelLayout - Optional target channel layout (e.g., 'mono', 'stereo')
|
|
546
|
-
*
|
|
547
|
-
* @returns This instance for chaining
|
|
548
|
-
*
|
|
549
|
-
* @example
|
|
550
|
-
* ```typescript
|
|
551
|
-
* chain.aresample(44100) // Convert to 44.1 kHz only
|
|
552
|
-
* chain.aresample(48000, 's16', 'stereo') // Full conversion
|
|
553
|
-
* ```
|
|
554
|
-
*
|
|
555
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#aresample | FFmpeg aresample filter}
|
|
556
|
-
*/
|
|
557
|
-
aresample(rate: number, format?: AVSampleFormat | string, channelLayout?: string): FilterPreset;
|
|
558
|
-
/**
|
|
559
|
-
* Adds an atempo filter to change audio playback speed.
|
|
560
|
-
* Factor must be between 0.5 and 2.0. For larger changes, chain multiple atempo filters.
|
|
561
|
-
*
|
|
562
|
-
* @param factor - Tempo factor (0.5 = half speed, 2.0 = double speed)
|
|
563
|
-
*
|
|
564
|
-
* @returns This instance for chaining
|
|
565
|
-
*
|
|
566
|
-
* @example
|
|
567
|
-
* ```typescript
|
|
568
|
-
* chain.atempo(1.5) // 1.5x speed
|
|
569
|
-
* chain.atempo(0.8) // Slow down to 80% speed
|
|
570
|
-
* ```
|
|
571
|
-
*
|
|
572
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#atempo | FFmpeg atempo filter}
|
|
573
|
-
*/
|
|
574
|
-
atempo(factor: number): FilterPreset;
|
|
575
|
-
/**
|
|
576
|
-
* Adds an audio fade filter.
|
|
577
|
-
*
|
|
578
|
-
* @param type - Fade type ('in' or 'out')
|
|
579
|
-
*
|
|
580
|
-
* @param start - Start time in seconds
|
|
581
|
-
*
|
|
582
|
-
* @param duration - Fade duration in seconds
|
|
583
|
-
*
|
|
584
|
-
* @returns This instance for chaining
|
|
585
|
-
*
|
|
586
|
-
* @example
|
|
587
|
-
* ```typescript
|
|
588
|
-
* chain.afade('in', 0, 3) // 3-second audio fade in
|
|
589
|
-
* chain.afade('out', 20, 2) // 2-second fade out at 20s
|
|
590
|
-
* ```
|
|
591
|
-
*
|
|
592
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#afade | FFmpeg afade filter}
|
|
593
|
-
*/
|
|
594
|
-
afade(type: 'in' | 'out', start: number, duration: number): FilterPreset;
|
|
595
|
-
/**
|
|
596
|
-
* Adds an amix filter to mix multiple audio streams.
|
|
597
|
-
*
|
|
598
|
-
* @param inputs - Number of input streams to mix (default: 2)
|
|
599
|
-
*
|
|
600
|
-
* @param duration - How to determine output duration (default: 'longest')
|
|
601
|
-
*
|
|
602
|
-
* @returns This instance for chaining
|
|
603
|
-
*
|
|
604
|
-
* @example
|
|
605
|
-
* ```typescript
|
|
606
|
-
* chain.amix(3, 'longest') // Mix 3 audio streams
|
|
607
|
-
* chain.amix(2, 'first') // Mix 2 streams, use first's duration
|
|
608
|
-
* ```
|
|
609
|
-
*
|
|
610
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#amix | FFmpeg amix filter}
|
|
611
|
-
*/
|
|
612
|
-
amix(inputs?: number, duration?: 'first' | 'longest' | 'shortest'): FilterPreset;
|
|
613
468
|
/**
|
|
614
469
|
* Adds a pad filter to add padding to video.
|
|
615
470
|
* Essential for aspect ratio adjustments and letterboxing.
|
|
@@ -638,65 +493,6 @@ export declare class FilterPreset {
|
|
|
638
493
|
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#pad | FFmpeg pad filter}
|
|
639
494
|
*/
|
|
640
495
|
pad(width: string | number, height: string | number, x?: string, y?: string, color?: string): FilterPreset;
|
|
641
|
-
/**
|
|
642
|
-
* Adds a trim filter to cut a portion of the stream.
|
|
643
|
-
* Crucial for cutting segments from media.
|
|
644
|
-
*
|
|
645
|
-
* @param start - Start time in seconds
|
|
646
|
-
*
|
|
647
|
-
* @param end - End time in seconds (optional)
|
|
648
|
-
*
|
|
649
|
-
* @param duration - Duration in seconds (optional, alternative to end)
|
|
650
|
-
*
|
|
651
|
-
* @returns This instance for chaining
|
|
652
|
-
*
|
|
653
|
-
* @example
|
|
654
|
-
* ```typescript
|
|
655
|
-
* chain.trim(10, 30) // Extract from 10s to 30s
|
|
656
|
-
* chain.trim(5, undefined, 10) // Extract 10s starting at 5s
|
|
657
|
-
* ```
|
|
658
|
-
*
|
|
659
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#trim | FFmpeg trim filter}
|
|
660
|
-
*/
|
|
661
|
-
trim(start: number, end?: number, duration?: number): FilterPreset;
|
|
662
|
-
/**
|
|
663
|
-
* Creates a setpts filter string to change presentation timestamps.
|
|
664
|
-
* Essential for speed changes and timestamp manipulation.
|
|
665
|
-
*
|
|
666
|
-
* @param expression - PTS expression (e.g., 'PTS*2' for half speed, 'PTS/2' for double speed)
|
|
667
|
-
*
|
|
668
|
-
* @returns Filter string or null if not supported
|
|
669
|
-
*
|
|
670
|
-
* @example
|
|
671
|
-
* ```typescript
|
|
672
|
-
* // Double speed
|
|
673
|
-
* presets.setpts('PTS/2');
|
|
674
|
-
*
|
|
675
|
-
* // Half speed
|
|
676
|
-
* presets.setpts('PTS*2');
|
|
677
|
-
*
|
|
678
|
-
* // Reset timestamps
|
|
679
|
-
* presets.setpts('PTS-STARTPTS');
|
|
680
|
-
* ```
|
|
681
|
-
*
|
|
682
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#setpts | FFmpeg setpts filter}
|
|
683
|
-
*/
|
|
684
|
-
setpts(expression: string): FilterPreset;
|
|
685
|
-
/**
|
|
686
|
-
* Creates an asetpts filter string for audio timestamp manipulation.
|
|
687
|
-
*
|
|
688
|
-
* @param expression - PTS expression
|
|
689
|
-
*
|
|
690
|
-
* @returns Filter string or null if not supported
|
|
691
|
-
*
|
|
692
|
-
* @example
|
|
693
|
-
* ```typescript
|
|
694
|
-
* presets.asetpts('PTS-STARTPTS') // Reset timestamps to start from 0
|
|
695
|
-
* ```
|
|
696
|
-
*
|
|
697
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#asetpts | FFmpeg asetpts filter}
|
|
698
|
-
*/
|
|
699
|
-
asetpts(expression: string): FilterPreset;
|
|
700
496
|
/**
|
|
701
497
|
* Creates a transpose filter string for rotation/flipping.
|
|
702
498
|
* More efficient than rotate for 90-degree rotations.
|
|
@@ -714,58 +510,6 @@ export declare class FilterPreset {
|
|
|
714
510
|
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#transpose | FFmpeg transpose filter}
|
|
715
511
|
*/
|
|
716
512
|
transpose(mode: number | 'clock' | 'cclock' | 'clock_flip' | 'cclock_flip'): FilterPreset;
|
|
717
|
-
/**
|
|
718
|
-
* Creates a setsar filter string to set sample aspect ratio.
|
|
719
|
-
* Important for correcting aspect ratio issues.
|
|
720
|
-
*
|
|
721
|
-
* @param ratio - Aspect ratio (e.g., '1:1', '16:9', or number)
|
|
722
|
-
*
|
|
723
|
-
* @returns Filter string or null if not supported
|
|
724
|
-
*
|
|
725
|
-
* @example
|
|
726
|
-
* ```typescript
|
|
727
|
-
* presets.setsar('1:1') // Square pixels
|
|
728
|
-
* presets.setsar(1.333) // 4:3 aspect ratio
|
|
729
|
-
* ```
|
|
730
|
-
*
|
|
731
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#setsar | FFmpeg setsar/setdar filter}
|
|
732
|
-
*/
|
|
733
|
-
setsar(ratio: string | number): FilterPreset;
|
|
734
|
-
/**
|
|
735
|
-
* Creates a setdar filter string to set display aspect ratio.
|
|
736
|
-
*
|
|
737
|
-
* @param ratio - Aspect ratio (e.g., '16:9', '4:3')
|
|
738
|
-
*
|
|
739
|
-
* @returns Filter string or null if not supported
|
|
740
|
-
*
|
|
741
|
-
* @example
|
|
742
|
-
* ```typescript
|
|
743
|
-
* presets.setdar('16:9') // Widescreen
|
|
744
|
-
* presets.setdar('4:3') // Traditional TV aspect
|
|
745
|
-
* ```
|
|
746
|
-
*
|
|
747
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#setsar | FFmpeg setsar/setdar filter}
|
|
748
|
-
*/
|
|
749
|
-
setdar(ratio: string | number): FilterPreset;
|
|
750
|
-
/**
|
|
751
|
-
* Adds an apad filter to add audio padding.
|
|
752
|
-
* Useful for ensuring minimum audio duration.
|
|
753
|
-
*
|
|
754
|
-
* @param wholeDuration - Minimum duration in seconds (optional)
|
|
755
|
-
*
|
|
756
|
-
* @param padDuration - Amount of padding to add in seconds (optional)
|
|
757
|
-
*
|
|
758
|
-
* @returns This instance for chaining
|
|
759
|
-
*
|
|
760
|
-
* @example
|
|
761
|
-
* ```typescript
|
|
762
|
-
* chain.apad(30) // Ensure at least 30 seconds total
|
|
763
|
-
* chain.apad(undefined, 5) // Add 5 seconds of padding
|
|
764
|
-
* ```
|
|
765
|
-
*
|
|
766
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#apad | FFmpeg apad filter}
|
|
767
|
-
*/
|
|
768
|
-
apad(wholeDuration?: number, padDuration?: number): FilterPreset;
|
|
769
513
|
/**
|
|
770
514
|
* Creates a deinterlace filter string.
|
|
771
515
|
* Essential for processing interlaced content.
|
|
@@ -785,359 +529,6 @@ export declare class FilterPreset {
|
|
|
785
529
|
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#yadif | FFmpeg yadif filter}
|
|
786
530
|
*/
|
|
787
531
|
deinterlace(mode?: 'yadif' | 'bwdif' | 'w3fdif', options?: Record<string, any>): FilterPreset;
|
|
788
|
-
/**
|
|
789
|
-
* Creates a select filter string to select specific frames.
|
|
790
|
-
* Powerful for extracting keyframes, specific frame types, etc.
|
|
791
|
-
*
|
|
792
|
-
* @param expression - Selection expression
|
|
793
|
-
*
|
|
794
|
-
* @returns Filter string or null if not supported
|
|
795
|
-
*
|
|
796
|
-
* @example
|
|
797
|
-
* ```typescript
|
|
798
|
-
* presets.select('eq(pict_type,I)') // Select only keyframes
|
|
799
|
-
* presets.select('not(mod(n,10))') // Select every 10th frame
|
|
800
|
-
* ```
|
|
801
|
-
*
|
|
802
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#select | FFmpeg select filter}
|
|
803
|
-
*/
|
|
804
|
-
select(expression: string): FilterPreset;
|
|
805
|
-
/**
|
|
806
|
-
* Creates an aselect filter string for audio selection.
|
|
807
|
-
*
|
|
808
|
-
* @param expression - Selection expression
|
|
809
|
-
*
|
|
810
|
-
* @returns Filter string or null if not supported
|
|
811
|
-
*
|
|
812
|
-
* @example
|
|
813
|
-
* ```typescript
|
|
814
|
-
* presets.aselect('between(t,10,20)') // Select audio between 10-20 seconds
|
|
815
|
-
* ```
|
|
816
|
-
*
|
|
817
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#aselect | FFmpeg aselect filter}
|
|
818
|
-
*/
|
|
819
|
-
aselect(expression: string): FilterPreset;
|
|
820
|
-
/**
|
|
821
|
-
* Creates a concat filter string to concatenate multiple inputs.
|
|
822
|
-
* Essential for joining multiple video/audio segments.
|
|
823
|
-
*
|
|
824
|
-
* @param n - Number of input segments
|
|
825
|
-
*
|
|
826
|
-
* @param v - Number of output video streams (0 or 1)
|
|
827
|
-
*
|
|
828
|
-
* @param a - Number of output audio streams (0 or 1)
|
|
829
|
-
*
|
|
830
|
-
* @returns Filter string or null if not supported
|
|
831
|
-
*
|
|
832
|
-
* @example
|
|
833
|
-
* ```typescript
|
|
834
|
-
* presets.concat(3, 1, 1) // Join 3 segments with video and audio
|
|
835
|
-
* presets.concat(2, 1, 0) // Join 2 video-only segments
|
|
836
|
-
* ```
|
|
837
|
-
*
|
|
838
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#concat | FFmpeg concat filter}
|
|
839
|
-
*/
|
|
840
|
-
concat(n: number, v?: number, a?: number): FilterPreset;
|
|
841
|
-
/**
|
|
842
|
-
* Creates an amerge filter string to merge multiple audio streams into one.
|
|
843
|
-
* Different from amix - this creates multi-channel output.
|
|
844
|
-
*
|
|
845
|
-
* @param inputs - Number of input streams
|
|
846
|
-
*
|
|
847
|
-
* @returns Filter string or null if not supported
|
|
848
|
-
*
|
|
849
|
-
* @example
|
|
850
|
-
* ```typescript
|
|
851
|
-
* presets.amerge(2) // Merge 2 mono streams to stereo
|
|
852
|
-
* presets.amerge(6) // Merge 6 channels for 5.1 surround
|
|
853
|
-
* ```
|
|
854
|
-
*
|
|
855
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#amerge | FFmpeg amerge filter}
|
|
856
|
-
*/
|
|
857
|
-
amerge(inputs?: number): FilterPreset;
|
|
858
|
-
/**
|
|
859
|
-
* Creates a channelmap filter string to remap audio channels.
|
|
860
|
-
* Critical for audio channel manipulation.
|
|
861
|
-
*
|
|
862
|
-
* @param map - Channel mapping (e.g., '0-0|1-1' or 'FL-FR|FR-FL' to swap stereo)
|
|
863
|
-
*
|
|
864
|
-
* @returns Filter string or null if not supported
|
|
865
|
-
*
|
|
866
|
-
* @example
|
|
867
|
-
* ```typescript
|
|
868
|
-
* presets.channelmap('FL-FR|FR-FL') // Swap left and right channels
|
|
869
|
-
* presets.channelmap('0-0|0-1') // Duplicate mono to stereo
|
|
870
|
-
* ```
|
|
871
|
-
*
|
|
872
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#channelmap | FFmpeg channelmap filter}
|
|
873
|
-
*/
|
|
874
|
-
channelmap(map: string): FilterPreset;
|
|
875
|
-
/**
|
|
876
|
-
* Creates a channelsplit filter string to split audio channels.
|
|
877
|
-
*
|
|
878
|
-
* @param channelLayout - Channel layout to split (optional)
|
|
879
|
-
*
|
|
880
|
-
* @returns Filter string or null if not supported
|
|
881
|
-
*
|
|
882
|
-
* @example
|
|
883
|
-
* ```typescript
|
|
884
|
-
* presets.channelsplit('stereo') // Split stereo to 2 mono
|
|
885
|
-
* presets.channelsplit('5.1') // Split 5.1 to individual channels
|
|
886
|
-
* ```
|
|
887
|
-
*
|
|
888
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#channelsplit | FFmpeg channelsplit filter}
|
|
889
|
-
*/
|
|
890
|
-
channelsplit(channelLayout?: string): FilterPreset;
|
|
891
|
-
/**
|
|
892
|
-
* Creates a loudnorm filter string for loudness normalization.
|
|
893
|
-
* Essential for broadcast compliance and consistent audio levels.
|
|
894
|
-
*
|
|
895
|
-
* @param I - Integrated loudness target (default: -24 LUFS)
|
|
896
|
-
*
|
|
897
|
-
* @param TP - True peak (default: -2 dBTP)
|
|
898
|
-
*
|
|
899
|
-
* @param LRA - Loudness range (default: 7 LU)
|
|
900
|
-
*
|
|
901
|
-
* @returns Filter string or null if not supported
|
|
902
|
-
*
|
|
903
|
-
* @example
|
|
904
|
-
* ```typescript
|
|
905
|
-
* presets.loudnorm(-23, -1, 7) // EBU R128 broadcast standard
|
|
906
|
-
* presets.loudnorm(-16, -1.5, 11) // Streaming platforms standard
|
|
907
|
-
* ```
|
|
908
|
-
*
|
|
909
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#loudnorm | FFmpeg loudnorm filter}
|
|
910
|
-
*/
|
|
911
|
-
loudnorm(I?: number, TP?: number, LRA?: number): FilterPreset;
|
|
912
|
-
/**
|
|
913
|
-
* Creates a compand filter string for audio compression/expansion.
|
|
914
|
-
* Important for dynamic range control.
|
|
915
|
-
*
|
|
916
|
-
* @param attacks - Attack times
|
|
917
|
-
*
|
|
918
|
-
* @param decays - Decay times
|
|
919
|
-
*
|
|
920
|
-
* @param points - Transfer function points
|
|
921
|
-
*
|
|
922
|
-
* @param gain - Output gain
|
|
923
|
-
*
|
|
924
|
-
* @returns Filter string or null if not supported
|
|
925
|
-
*
|
|
926
|
-
* @example
|
|
927
|
-
* ```typescript
|
|
928
|
-
* presets.compand('0.3|0.3', '1|1', '-90/-60|-60/-40|-40/-30|-20/-20', 6)
|
|
929
|
-
* ```
|
|
930
|
-
*
|
|
931
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#compand | FFmpeg compand filter}
|
|
932
|
-
*/
|
|
933
|
-
compand(attacks: string, decays: string, points: string, gain?: number): FilterPreset;
|
|
934
|
-
/**
|
|
935
|
-
* Adds a drawtext filter to overlay text on video.
|
|
936
|
-
*
|
|
937
|
-
* @param text - Text to display
|
|
938
|
-
*
|
|
939
|
-
* @param options - Text rendering options
|
|
940
|
-
*
|
|
941
|
-
* @returns This instance for chaining
|
|
942
|
-
*
|
|
943
|
-
* @example
|
|
944
|
-
* ```typescript
|
|
945
|
-
* chain.drawtext('Hello World', { x: 10, y: 10, fontsize: 24 })
|
|
946
|
-
* chain.drawtext('Timestamp', {
|
|
947
|
-
* x: 10,
|
|
948
|
-
* y: 10,
|
|
949
|
-
* fontsize: 24,
|
|
950
|
-
* fontcolor: 'white',
|
|
951
|
-
* fontfile: '/path/to/font.ttf'
|
|
952
|
-
* })
|
|
953
|
-
* ```
|
|
954
|
-
*
|
|
955
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#drawtext | FFmpeg drawtext filter}
|
|
956
|
-
*/
|
|
957
|
-
drawtext(text: string, options: Record<string, any>): FilterPreset;
|
|
958
|
-
/**
|
|
959
|
-
* Adds a split filter to duplicate a video stream.
|
|
960
|
-
*
|
|
961
|
-
* @param outputs - Number of output streams (default: 2)
|
|
962
|
-
*
|
|
963
|
-
* @returns This instance for chaining
|
|
964
|
-
*
|
|
965
|
-
* @example
|
|
966
|
-
* ```typescript
|
|
967
|
-
* chain.split() // Split into 2 outputs
|
|
968
|
-
* chain.split(3) // Split into 3 outputs
|
|
969
|
-
* ```
|
|
970
|
-
*
|
|
971
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#split | FFmpeg split filter}
|
|
972
|
-
*/
|
|
973
|
-
split(outputs?: number): FilterPreset;
|
|
974
|
-
/**
|
|
975
|
-
* Adds an asplit filter to duplicate an audio stream.
|
|
976
|
-
*
|
|
977
|
-
* @param outputs - Number of output streams (default: 2)
|
|
978
|
-
*
|
|
979
|
-
* @returns This instance for chaining
|
|
980
|
-
*
|
|
981
|
-
* @example
|
|
982
|
-
* ```typescript
|
|
983
|
-
* chain.asplit() // Split into 2 outputs
|
|
984
|
-
* chain.asplit(3) // Split into 3 outputs
|
|
985
|
-
* ```
|
|
986
|
-
*
|
|
987
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#asplit | FFmpeg asplit filter}
|
|
988
|
-
*/
|
|
989
|
-
asplit(outputs?: number): FilterPreset;
|
|
990
|
-
/**
|
|
991
|
-
* Adds an adelay filter to delay audio by specified milliseconds.
|
|
992
|
-
*
|
|
993
|
-
* @param delays - Delay in milliseconds (single value or array for multiple channels)
|
|
994
|
-
*
|
|
995
|
-
* @returns This instance for chaining
|
|
996
|
-
*
|
|
997
|
-
* @example
|
|
998
|
-
* ```typescript
|
|
999
|
-
* chain.adelay(100) // Delay all channels by 100ms
|
|
1000
|
-
* chain.adelay([100, 200]) // Delay first channel by 100ms, second by 200ms
|
|
1001
|
-
* ```
|
|
1002
|
-
*
|
|
1003
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#adelay | FFmpeg adelay filter}
|
|
1004
|
-
*/
|
|
1005
|
-
adelay(delays: number | number[]): FilterPreset;
|
|
1006
|
-
/**
|
|
1007
|
-
* Adds an aecho filter for audio echo effect.
|
|
1008
|
-
*
|
|
1009
|
-
* @param in_gain - Input gain (0-1)
|
|
1010
|
-
*
|
|
1011
|
-
* @param out_gain - Output gain (0-1)
|
|
1012
|
-
*
|
|
1013
|
-
* @param delays - Delay in milliseconds
|
|
1014
|
-
*
|
|
1015
|
-
* @param decays - Decay factor (0-1)
|
|
1016
|
-
*
|
|
1017
|
-
* @returns This instance for chaining
|
|
1018
|
-
*
|
|
1019
|
-
* @example
|
|
1020
|
-
* ```typescript
|
|
1021
|
-
* chain.aecho(0.8, 0.9, 1000, 0.3) // Echo with 1 second delay
|
|
1022
|
-
* ```
|
|
1023
|
-
*
|
|
1024
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#aecho | FFmpeg aecho filter}
|
|
1025
|
-
*/
|
|
1026
|
-
aecho(in_gain: number, out_gain: number, delays: number, decays: number): FilterPreset;
|
|
1027
|
-
/**
|
|
1028
|
-
* Adds a highpass filter to remove low frequencies.
|
|
1029
|
-
*
|
|
1030
|
-
* @param frequency - Cutoff frequency in Hz
|
|
1031
|
-
*
|
|
1032
|
-
* @param options - Additional filter options
|
|
1033
|
-
*
|
|
1034
|
-
* @returns This instance for chaining
|
|
1035
|
-
*
|
|
1036
|
-
* @example
|
|
1037
|
-
* ```typescript
|
|
1038
|
-
* chain.highpass(200) // Remove frequencies below 200Hz
|
|
1039
|
-
* chain.highpass(200, { width_type: 'q', width: 1 })
|
|
1040
|
-
* ```
|
|
1041
|
-
*
|
|
1042
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#highpass | FFmpeg highpass filter}
|
|
1043
|
-
*/
|
|
1044
|
-
highpass(frequency: number, options?: Record<string, any>): FilterPreset;
|
|
1045
|
-
/**
|
|
1046
|
-
* Adds a lowpass filter to remove high frequencies.
|
|
1047
|
-
*
|
|
1048
|
-
* @param frequency - Cutoff frequency in Hz
|
|
1049
|
-
*
|
|
1050
|
-
* @param options - Additional filter options
|
|
1051
|
-
*
|
|
1052
|
-
* @returns This instance for chaining
|
|
1053
|
-
*
|
|
1054
|
-
* @example
|
|
1055
|
-
* ```typescript
|
|
1056
|
-
* chain.lowpass(5000) // Remove frequencies above 5000Hz
|
|
1057
|
-
* ```
|
|
1058
|
-
*
|
|
1059
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#lowpass | FFmpeg lowpass filter}
|
|
1060
|
-
*/
|
|
1061
|
-
lowpass(frequency: number, options?: Record<string, any>): FilterPreset;
|
|
1062
|
-
/**
|
|
1063
|
-
* Adds a bandpass filter to keep only a frequency band.
|
|
1064
|
-
*
|
|
1065
|
-
* @param frequency - Center frequency in Hz
|
|
1066
|
-
*
|
|
1067
|
-
* @param options - Additional filter options
|
|
1068
|
-
*
|
|
1069
|
-
* @returns This instance for chaining
|
|
1070
|
-
*
|
|
1071
|
-
* @example
|
|
1072
|
-
* ```typescript
|
|
1073
|
-
* chain.bandpass(1000) // Keep frequencies around 1000Hz
|
|
1074
|
-
* ```
|
|
1075
|
-
*
|
|
1076
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#bandpass | FFmpeg bandpass filter}
|
|
1077
|
-
*/
|
|
1078
|
-
bandpass(frequency: number, options?: Record<string, any>): FilterPreset;
|
|
1079
|
-
/**
|
|
1080
|
-
* Adds an equalizer filter for frequency band adjustment.
|
|
1081
|
-
*
|
|
1082
|
-
* @param frequency - Center frequency in Hz
|
|
1083
|
-
*
|
|
1084
|
-
* @param width - Band width
|
|
1085
|
-
*
|
|
1086
|
-
* @param gain - Gain in dB
|
|
1087
|
-
*
|
|
1088
|
-
* @param width_type - Width type (optional)
|
|
1089
|
-
*
|
|
1090
|
-
* @returns This instance for chaining
|
|
1091
|
-
*
|
|
1092
|
-
* @example
|
|
1093
|
-
* ```typescript
|
|
1094
|
-
* chain.equalizer(1000, 2, 5) // Boost 1000Hz by 5dB
|
|
1095
|
-
* chain.equalizer(1000, 2, 5, 'q') // Use Q factor for width
|
|
1096
|
-
* ```
|
|
1097
|
-
*
|
|
1098
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#equalizer | FFmpeg equalizer filter}
|
|
1099
|
-
*/
|
|
1100
|
-
equalizer(frequency: number, width: number, gain: number, width_type?: string): FilterPreset;
|
|
1101
|
-
/**
|
|
1102
|
-
* Adds a compressor filter for dynamic range compression.
|
|
1103
|
-
*
|
|
1104
|
-
* @param options - Compressor parameters
|
|
1105
|
-
*
|
|
1106
|
-
* @returns This instance for chaining
|
|
1107
|
-
*
|
|
1108
|
-
* @example
|
|
1109
|
-
* ```typescript
|
|
1110
|
-
* chain.compressor() // Default compression
|
|
1111
|
-
* chain.compressor({
|
|
1112
|
-
* threshold: 0.5,
|
|
1113
|
-
* ratio: 4,
|
|
1114
|
-
* attack: 5,
|
|
1115
|
-
* release: 50
|
|
1116
|
-
* })
|
|
1117
|
-
* ```
|
|
1118
|
-
*
|
|
1119
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#acompressor | FFmpeg acompressor filter}
|
|
1120
|
-
*/
|
|
1121
|
-
compressor(options?: Record<string, any>): FilterPreset;
|
|
1122
|
-
/**
|
|
1123
|
-
* Adds an atrim filter to trim audio.
|
|
1124
|
-
*
|
|
1125
|
-
* @param start - Start time in seconds
|
|
1126
|
-
*
|
|
1127
|
-
* @param end - End time in seconds (optional)
|
|
1128
|
-
*
|
|
1129
|
-
* @param duration - Duration in seconds (optional)
|
|
1130
|
-
*
|
|
1131
|
-
* @returns This instance for chaining
|
|
1132
|
-
*
|
|
1133
|
-
* @example
|
|
1134
|
-
* ```typescript
|
|
1135
|
-
* chain.atrim(10, 20) // Extract audio from 10s to 20s
|
|
1136
|
-
* ```
|
|
1137
|
-
*
|
|
1138
|
-
* @see {@link https://ffmpeg.org/ffmpeg-filters.html#atrim | FFmpeg atrim filter}
|
|
1139
|
-
*/
|
|
1140
|
-
atrim(start: number, end?: number, duration?: number): FilterPreset;
|
|
1141
532
|
/**
|
|
1142
533
|
* Adds a whisper filter for audio transcription using whisper.cpp.
|
|
1143
534
|
* Transcribes audio and adds metadata to frames (lavfi.whisper.text, lavfi.whisper.duration).
|
|
@@ -1236,28 +627,6 @@ export declare class FilterPreset {
|
|
|
1236
627
|
* ```
|
|
1237
628
|
*/
|
|
1238
629
|
hwdownload(): FilterPreset;
|
|
1239
|
-
/**
|
|
1240
|
-
* Adds a hwmap filter to map frames between hardware devices.
|
|
1241
|
-
*
|
|
1242
|
-
* @param derive - Device to derive from (optional)
|
|
1243
|
-
*
|
|
1244
|
-
* @returns This instance for chaining
|
|
1245
|
-
*
|
|
1246
|
-
* @example
|
|
1247
|
-
* ```typescript
|
|
1248
|
-
* const chain = FilterPresets.chain()
|
|
1249
|
-
* .hwmap('cuda')
|
|
1250
|
-
* .build();
|
|
1251
|
-
* ```
|
|
1252
|
-
*
|
|
1253
|
-
* @example
|
|
1254
|
-
* ```typescript
|
|
1255
|
-
* const chain = FilterPresets.chain()
|
|
1256
|
-
* .hwmap()
|
|
1257
|
-
* .build();
|
|
1258
|
-
* ```
|
|
1259
|
-
*/
|
|
1260
|
-
hwmap(derive?: string): FilterPreset;
|
|
1261
630
|
/**
|
|
1262
631
|
* Adds a filter to the chain.
|
|
1263
632
|
*
|