@revizly/node-av 5.2.2-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (254) hide show
  1. package/BUILD_LINUX.md +61 -0
  2. package/LICENSE.md +22 -0
  3. package/README.md +662 -0
  4. package/build_mac_local.sh +69 -0
  5. package/dist/api/audio-frame-buffer.d.ts +205 -0
  6. package/dist/api/audio-frame-buffer.js +287 -0
  7. package/dist/api/audio-frame-buffer.js.map +1 -0
  8. package/dist/api/bitstream-filter.d.ts +820 -0
  9. package/dist/api/bitstream-filter.js +1242 -0
  10. package/dist/api/bitstream-filter.js.map +1 -0
  11. package/dist/api/constants.d.ts +44 -0
  12. package/dist/api/constants.js +45 -0
  13. package/dist/api/constants.js.map +1 -0
  14. package/dist/api/data/test_av1.ivf +0 -0
  15. package/dist/api/data/test_h264.h264 +0 -0
  16. package/dist/api/data/test_hevc.h265 +0 -0
  17. package/dist/api/data/test_mjpeg.mjpeg +0 -0
  18. package/dist/api/data/test_vp8.ivf +0 -0
  19. package/dist/api/data/test_vp9.ivf +0 -0
  20. package/dist/api/decoder.d.ts +1088 -0
  21. package/dist/api/decoder.js +1775 -0
  22. package/dist/api/decoder.js.map +1 -0
  23. package/dist/api/demuxer.d.ts +1219 -0
  24. package/dist/api/demuxer.js +2081 -0
  25. package/dist/api/demuxer.js.map +1 -0
  26. package/dist/api/device.d.ts +586 -0
  27. package/dist/api/device.js +961 -0
  28. package/dist/api/device.js.map +1 -0
  29. package/dist/api/encoder.d.ts +1132 -0
  30. package/dist/api/encoder.js +1988 -0
  31. package/dist/api/encoder.js.map +1 -0
  32. package/dist/api/filter-complex.d.ts +821 -0
  33. package/dist/api/filter-complex.js +1604 -0
  34. package/dist/api/filter-complex.js.map +1 -0
  35. package/dist/api/filter-presets.d.ts +1286 -0
  36. package/dist/api/filter-presets.js +2152 -0
  37. package/dist/api/filter-presets.js.map +1 -0
  38. package/dist/api/filter.d.ts +1234 -0
  39. package/dist/api/filter.js +1976 -0
  40. package/dist/api/filter.js.map +1 -0
  41. package/dist/api/fmp4-stream.d.ts +426 -0
  42. package/dist/api/fmp4-stream.js +739 -0
  43. package/dist/api/fmp4-stream.js.map +1 -0
  44. package/dist/api/hardware.d.ts +651 -0
  45. package/dist/api/hardware.js +1260 -0
  46. package/dist/api/hardware.js.map +1 -0
  47. package/dist/api/index.d.ts +17 -0
  48. package/dist/api/index.js +32 -0
  49. package/dist/api/index.js.map +1 -0
  50. package/dist/api/io-stream.d.ts +307 -0
  51. package/dist/api/io-stream.js +282 -0
  52. package/dist/api/io-stream.js.map +1 -0
  53. package/dist/api/muxer.d.ts +957 -0
  54. package/dist/api/muxer.js +2002 -0
  55. package/dist/api/muxer.js.map +1 -0
  56. package/dist/api/pipeline.d.ts +607 -0
  57. package/dist/api/pipeline.js +1145 -0
  58. package/dist/api/pipeline.js.map +1 -0
  59. package/dist/api/utilities/async-queue.d.ts +120 -0
  60. package/dist/api/utilities/async-queue.js +211 -0
  61. package/dist/api/utilities/async-queue.js.map +1 -0
  62. package/dist/api/utilities/audio-sample.d.ts +117 -0
  63. package/dist/api/utilities/audio-sample.js +112 -0
  64. package/dist/api/utilities/audio-sample.js.map +1 -0
  65. package/dist/api/utilities/channel-layout.d.ts +76 -0
  66. package/dist/api/utilities/channel-layout.js +80 -0
  67. package/dist/api/utilities/channel-layout.js.map +1 -0
  68. package/dist/api/utilities/electron-shared-texture.d.ts +328 -0
  69. package/dist/api/utilities/electron-shared-texture.js +503 -0
  70. package/dist/api/utilities/electron-shared-texture.js.map +1 -0
  71. package/dist/api/utilities/image.d.ts +207 -0
  72. package/dist/api/utilities/image.js +213 -0
  73. package/dist/api/utilities/image.js.map +1 -0
  74. package/dist/api/utilities/index.d.ts +12 -0
  75. package/dist/api/utilities/index.js +25 -0
  76. package/dist/api/utilities/index.js.map +1 -0
  77. package/dist/api/utilities/media-type.d.ts +49 -0
  78. package/dist/api/utilities/media-type.js +53 -0
  79. package/dist/api/utilities/media-type.js.map +1 -0
  80. package/dist/api/utilities/pixel-format.d.ts +89 -0
  81. package/dist/api/utilities/pixel-format.js +97 -0
  82. package/dist/api/utilities/pixel-format.js.map +1 -0
  83. package/dist/api/utilities/sample-format.d.ts +129 -0
  84. package/dist/api/utilities/sample-format.js +141 -0
  85. package/dist/api/utilities/sample-format.js.map +1 -0
  86. package/dist/api/utilities/scheduler.d.ts +138 -0
  87. package/dist/api/utilities/scheduler.js +98 -0
  88. package/dist/api/utilities/scheduler.js.map +1 -0
  89. package/dist/api/utilities/streaming.d.ts +186 -0
  90. package/dist/api/utilities/streaming.js +309 -0
  91. package/dist/api/utilities/streaming.js.map +1 -0
  92. package/dist/api/utilities/timestamp.d.ts +193 -0
  93. package/dist/api/utilities/timestamp.js +206 -0
  94. package/dist/api/utilities/timestamp.js.map +1 -0
  95. package/dist/api/utilities/whisper-model.d.ts +310 -0
  96. package/dist/api/utilities/whisper-model.js +528 -0
  97. package/dist/api/utilities/whisper-model.js.map +1 -0
  98. package/dist/api/utils.d.ts +19 -0
  99. package/dist/api/utils.js +39 -0
  100. package/dist/api/utils.js.map +1 -0
  101. package/dist/api/whisper.d.ts +324 -0
  102. package/dist/api/whisper.js +362 -0
  103. package/dist/api/whisper.js.map +1 -0
  104. package/dist/constants/channel-layouts.d.ts +53 -0
  105. package/dist/constants/channel-layouts.js +57 -0
  106. package/dist/constants/channel-layouts.js.map +1 -0
  107. package/dist/constants/constants.d.ts +2325 -0
  108. package/dist/constants/constants.js +1887 -0
  109. package/dist/constants/constants.js.map +1 -0
  110. package/dist/constants/decoders.d.ts +633 -0
  111. package/dist/constants/decoders.js +641 -0
  112. package/dist/constants/decoders.js.map +1 -0
  113. package/dist/constants/encoders.d.ts +295 -0
  114. package/dist/constants/encoders.js +308 -0
  115. package/dist/constants/encoders.js.map +1 -0
  116. package/dist/constants/hardware.d.ts +26 -0
  117. package/dist/constants/hardware.js +27 -0
  118. package/dist/constants/hardware.js.map +1 -0
  119. package/dist/constants/index.d.ts +5 -0
  120. package/dist/constants/index.js +6 -0
  121. package/dist/constants/index.js.map +1 -0
  122. package/dist/ffmpeg/index.d.ts +99 -0
  123. package/dist/ffmpeg/index.js +115 -0
  124. package/dist/ffmpeg/index.js.map +1 -0
  125. package/dist/ffmpeg/utils.d.ts +31 -0
  126. package/dist/ffmpeg/utils.js +68 -0
  127. package/dist/ffmpeg/utils.js.map +1 -0
  128. package/dist/ffmpeg/version.d.ts +6 -0
  129. package/dist/ffmpeg/version.js +7 -0
  130. package/dist/ffmpeg/version.js.map +1 -0
  131. package/dist/index.d.ts +4 -0
  132. package/dist/index.js +9 -0
  133. package/dist/index.js.map +1 -0
  134. package/dist/lib/audio-fifo.d.ts +399 -0
  135. package/dist/lib/audio-fifo.js +431 -0
  136. package/dist/lib/audio-fifo.js.map +1 -0
  137. package/dist/lib/binding.d.ts +228 -0
  138. package/dist/lib/binding.js +60 -0
  139. package/dist/lib/binding.js.map +1 -0
  140. package/dist/lib/bitstream-filter-context.d.ts +379 -0
  141. package/dist/lib/bitstream-filter-context.js +441 -0
  142. package/dist/lib/bitstream-filter-context.js.map +1 -0
  143. package/dist/lib/bitstream-filter.d.ts +140 -0
  144. package/dist/lib/bitstream-filter.js +154 -0
  145. package/dist/lib/bitstream-filter.js.map +1 -0
  146. package/dist/lib/codec-context.d.ts +1071 -0
  147. package/dist/lib/codec-context.js +1354 -0
  148. package/dist/lib/codec-context.js.map +1 -0
  149. package/dist/lib/codec-parameters.d.ts +616 -0
  150. package/dist/lib/codec-parameters.js +761 -0
  151. package/dist/lib/codec-parameters.js.map +1 -0
  152. package/dist/lib/codec-parser.d.ts +201 -0
  153. package/dist/lib/codec-parser.js +213 -0
  154. package/dist/lib/codec-parser.js.map +1 -0
  155. package/dist/lib/codec.d.ts +586 -0
  156. package/dist/lib/codec.js +713 -0
  157. package/dist/lib/codec.js.map +1 -0
  158. package/dist/lib/device.d.ts +291 -0
  159. package/dist/lib/device.js +324 -0
  160. package/dist/lib/device.js.map +1 -0
  161. package/dist/lib/dictionary.d.ts +333 -0
  162. package/dist/lib/dictionary.js +372 -0
  163. package/dist/lib/dictionary.js.map +1 -0
  164. package/dist/lib/error.d.ts +242 -0
  165. package/dist/lib/error.js +303 -0
  166. package/dist/lib/error.js.map +1 -0
  167. package/dist/lib/fifo.d.ts +416 -0
  168. package/dist/lib/fifo.js +453 -0
  169. package/dist/lib/fifo.js.map +1 -0
  170. package/dist/lib/filter-context.d.ts +712 -0
  171. package/dist/lib/filter-context.js +789 -0
  172. package/dist/lib/filter-context.js.map +1 -0
  173. package/dist/lib/filter-graph-segment.d.ts +160 -0
  174. package/dist/lib/filter-graph-segment.js +171 -0
  175. package/dist/lib/filter-graph-segment.js.map +1 -0
  176. package/dist/lib/filter-graph.d.ts +641 -0
  177. package/dist/lib/filter-graph.js +704 -0
  178. package/dist/lib/filter-graph.js.map +1 -0
  179. package/dist/lib/filter-inout.d.ts +198 -0
  180. package/dist/lib/filter-inout.js +257 -0
  181. package/dist/lib/filter-inout.js.map +1 -0
  182. package/dist/lib/filter.d.ts +243 -0
  183. package/dist/lib/filter.js +272 -0
  184. package/dist/lib/filter.js.map +1 -0
  185. package/dist/lib/format-context.d.ts +1254 -0
  186. package/dist/lib/format-context.js +1379 -0
  187. package/dist/lib/format-context.js.map +1 -0
  188. package/dist/lib/frame-utils.d.ts +116 -0
  189. package/dist/lib/frame-utils.js +98 -0
  190. package/dist/lib/frame-utils.js.map +1 -0
  191. package/dist/lib/frame.d.ts +1222 -0
  192. package/dist/lib/frame.js +1435 -0
  193. package/dist/lib/frame.js.map +1 -0
  194. package/dist/lib/hardware-device-context.d.ts +362 -0
  195. package/dist/lib/hardware-device-context.js +383 -0
  196. package/dist/lib/hardware-device-context.js.map +1 -0
  197. package/dist/lib/hardware-frames-context.d.ts +419 -0
  198. package/dist/lib/hardware-frames-context.js +477 -0
  199. package/dist/lib/hardware-frames-context.js.map +1 -0
  200. package/dist/lib/index.d.ts +35 -0
  201. package/dist/lib/index.js +60 -0
  202. package/dist/lib/index.js.map +1 -0
  203. package/dist/lib/input-format.d.ts +249 -0
  204. package/dist/lib/input-format.js +306 -0
  205. package/dist/lib/input-format.js.map +1 -0
  206. package/dist/lib/io-context.d.ts +696 -0
  207. package/dist/lib/io-context.js +769 -0
  208. package/dist/lib/io-context.js.map +1 -0
  209. package/dist/lib/log.d.ts +174 -0
  210. package/dist/lib/log.js +184 -0
  211. package/dist/lib/log.js.map +1 -0
  212. package/dist/lib/native-types.d.ts +946 -0
  213. package/dist/lib/native-types.js +2 -0
  214. package/dist/lib/native-types.js.map +1 -0
  215. package/dist/lib/option.d.ts +927 -0
  216. package/dist/lib/option.js +1583 -0
  217. package/dist/lib/option.js.map +1 -0
  218. package/dist/lib/output-format.d.ts +180 -0
  219. package/dist/lib/output-format.js +213 -0
  220. package/dist/lib/output-format.js.map +1 -0
  221. package/dist/lib/packet.d.ts +501 -0
  222. package/dist/lib/packet.js +590 -0
  223. package/dist/lib/packet.js.map +1 -0
  224. package/dist/lib/rational.d.ts +251 -0
  225. package/dist/lib/rational.js +278 -0
  226. package/dist/lib/rational.js.map +1 -0
  227. package/dist/lib/software-resample-context.d.ts +552 -0
  228. package/dist/lib/software-resample-context.js +592 -0
  229. package/dist/lib/software-resample-context.js.map +1 -0
  230. package/dist/lib/software-scale-context.d.ts +344 -0
  231. package/dist/lib/software-scale-context.js +366 -0
  232. package/dist/lib/software-scale-context.js.map +1 -0
  233. package/dist/lib/stream.d.ts +379 -0
  234. package/dist/lib/stream.js +526 -0
  235. package/dist/lib/stream.js.map +1 -0
  236. package/dist/lib/sync-queue.d.ts +179 -0
  237. package/dist/lib/sync-queue.js +197 -0
  238. package/dist/lib/sync-queue.js.map +1 -0
  239. package/dist/lib/types.d.ts +34 -0
  240. package/dist/lib/types.js +2 -0
  241. package/dist/lib/types.js.map +1 -0
  242. package/dist/lib/utilities.d.ts +1127 -0
  243. package/dist/lib/utilities.js +1225 -0
  244. package/dist/lib/utilities.js.map +1 -0
  245. package/dist/utils/electron.d.ts +49 -0
  246. package/dist/utils/electron.js +63 -0
  247. package/dist/utils/electron.js.map +1 -0
  248. package/dist/utils/index.d.ts +4 -0
  249. package/dist/utils/index.js +5 -0
  250. package/dist/utils/index.js.map +1 -0
  251. package/install/check.js +121 -0
  252. package/install/ffmpeg.js +66 -0
  253. package/jellyfin-ffmpeg.patch +181 -0
  254. package/package.json +129 -0
@@ -0,0 +1,1286 @@
1
+ import type { AVPixelFormat, AVSampleFormat } from '../constants/index.js';
2
+ import type { HardwareContext } from './hardware.js';
3
+ /**
4
+ * Hardware filter capabilities for different platforms.
5
+ * Maps hardware types to their supported filter operations.
6
+ * Each capability indicates whether a specific filter operation is supported
7
+ * by the hardware acceleration type.
8
+ *
9
+ * Support varies significantly between hardware types:
10
+ * - CUDA: Comprehensive filter support with custom kernels
11
+ * - VAAPI: Good Linux support with Intel/AMD GPUs
12
+ * - QSV: Intel Quick Sync with basic filtering
13
+ * - VideoToolbox: macOS/iOS with CoreImage filters
14
+ * - Vulkan: Cross-platform with growing filter support
15
+ * - OpenCL: Cross-platform compute-based filtering
16
+ */
17
+ export interface FilterSupport {
18
+ scale: boolean;
19
+ overlay: boolean;
20
+ transpose: boolean;
21
+ tonemap: boolean;
22
+ deinterlace: boolean;
23
+ denoise: boolean;
24
+ flip: boolean;
25
+ blur: boolean;
26
+ sharpen: boolean;
27
+ sobel: boolean;
28
+ chromakey: boolean;
29
+ colorspace: boolean;
30
+ pad: boolean;
31
+ stack: boolean;
32
+ }
33
+ /**
34
+ * Filter preset builder for composing filter chains.
35
+ * Supports both software and hardware-accelerated filters.
36
+ * Automatically selects appropriate filter implementations based on hardware context.
37
+ * Uses fluent interface pattern for chaining multiple filters.
38
+ *
39
+ * @example
40
+ * ```typescript
41
+ * // Software filter chain
42
+ * const filter = FilterPreset.chain()
43
+ * .scale(1920, 1080)
44
+ * .fps(30)
45
+ * .fade('in', 0, 2)
46
+ * .build();
47
+ *
48
+ * // Hardware-accelerated filter chain
49
+ * const hw = HardwareContext.auto();
50
+ * const hwFilter = FilterPreset.chain(hw)
51
+ * .scale(1920, 1080)
52
+ * .blur('gaussian', 5)
53
+ * .build();
54
+ * ```
55
+ */
56
+ export declare class FilterPreset {
57
+ private hardware?;
58
+ private filters;
59
+ private support;
60
+ private constructor();
61
+ /**
62
+ * Checks if a filter is hardware-accelerated.
63
+ *
64
+ * @param filterName - Name of the filter to check
65
+ *
66
+ * @returns True if the filter uses hardware acceleration
67
+ *
68
+ * @example
69
+ * ```typescript
70
+ * if (FilterPreset.isHardwareFilter('scale_cuda')) {
71
+ * console.log('Hardware accelerated scaling');
72
+ * }
73
+ * ```
74
+ */
75
+ static isHardwareFilter(filterName: string): boolean;
76
+ /**
77
+ * Creates a new filter chain builder.
78
+ *
79
+ * @param hardware - Optional hardware context for hardware-accelerated filters
80
+ *
81
+ * @returns A new FilterPreset instance for chaining
82
+ *
83
+ * @example
84
+ * ```typescript
85
+ * // Software filter chain
86
+ * const filter = FilterPreset.chain()
87
+ * .scale(1280, 720)
88
+ * .fps(30)
89
+ * .build();
90
+ * ```
91
+ *
92
+ * @example
93
+ * ```typescript
94
+ * // Hardware filter chain
95
+ * const hw = HardwareContext.auto();
96
+ * const filter = FilterPreset.chain(hw)
97
+ * .scale(1280, 720)
98
+ * .deinterlace()
99
+ * .build();
100
+ * ```
101
+ */
102
+ static chain(hardware?: HardwareContext | null): FilterPreset;
103
+ /**
104
+ * Adds a custom filter string to the chain.
105
+ *
106
+ * @param filter - Custom filter string
107
+ *
108
+ * @returns This instance for chaining
109
+ *
110
+ * @example
111
+ * ```typescript
112
+ * chain.custom('myfilter=param1:param2')
113
+ * ```
114
+ */
115
+ custom(filter?: string): this;
116
+ /**
117
+ * Builds the final filter string.
118
+ *
119
+ * @param separator - Separator between filters (default: ',')
120
+ *
121
+ * @returns Combined filter string
122
+ *
123
+ * @example
124
+ * ```typescript
125
+ * const filterString = chain.build() // "scale=1920:1080,fps=30"
126
+ * ```
127
+ */
128
+ build(separator?: string): string;
129
+ /**
130
+ * Returns the filters as an array.
131
+ *
132
+ * @returns Array of filter strings
133
+ *
134
+ * @example
135
+ * ```typescript
136
+ * const filters = chain.toArray() // ["scale=1920:1080", "fps=30"]
137
+ * ```
138
+ */
139
+ toArray(): string[];
140
+ /**
141
+ * Adds a scale filter to the chain.
142
+ * Automatically selects hardware-specific scaler if hardware context is set.
143
+ *
144
+ * @param width - Target width in pixels
145
+ *
146
+ * @param height - Target height in pixels
147
+ *
148
+ * @param options - Additional scaling options (e.g., flags for algorithm)
149
+ *
150
+ * @returns This instance for chaining
151
+ *
152
+ * @example
153
+ * ```typescript
154
+ * chain.scale(1920, 1080) // Scale to Full HD
155
+ * chain.scale(640, 480, { flags: 'lanczos' }) // With specific algorithm
156
+ * ```
157
+ *
158
+ * @example
159
+ * ```typescript
160
+ * // Hardware crop + scale (VAAPI, CUDA, QSV, VideoToolbox)
161
+ * chain.crop(100, 100, 50, 50) // Sets AVFrame crop fields
162
+ * .scale(1920, 1080) // Hardware scaler reads crop fields
163
+ * ```
164
+ *
165
+ * @see {@link https://ffmpeg.org/ffmpeg-filters.html#scale | FFmpeg scale filter}
166
+ */
167
+ scale(width: number, height: number, options?: Record<string, any>): FilterPreset;
168
+ /**
169
+ * Adds a GPU format conversion filter without scaling.
170
+ * Only available for hardware contexts. Uses hardware-specific scale filter with format parameter.
171
+ *
172
+ * @param format - Target pixel format (e.g., 'nv12', 'p010')
173
+ *
174
+ * @returns This instance for chaining
175
+ *
176
+ * @example
177
+ * ```typescript
178
+ * // Convert to NV12 on GPU without scaling
179
+ * chain.scaleFormat('nv12')
180
+ * // Generates: scale_vt=format=nv12 (VideoToolbox)
181
+ * // or: scale_cuda=format=nv12 (CUDA)
182
+ * // or: scale_opencl=format=nv12 (OpenCL)
183
+ * ```
184
+ *
185
+ * @example
186
+ * ```typescript
187
+ * // Convert P010 → NV12 on GPU
188
+ * const hw = await HardwareContext.auto();
189
+ * const filter = FilterPreset.chain(hw)
190
+ * .scaleFormat('nv12')
191
+ * .build();
192
+ * ```
193
+ *
194
+ * @example
195
+ * ```typescript
196
+ * // Scale then convert format (two separate GPU operations)
197
+ * chain.scale(1920, 1080)
198
+ * .scaleFormat('p010')
199
+ * // Generates: scale_vt=1920:1080,scale_vt=format=p010
200
+ * ```
201
+ */
202
+ scaleFormat(format: string | AVPixelFormat): FilterPreset;
203
+ /**
204
+ * Adds a crop filter to the chain.
205
+ *
206
+ * @param width - Width of the cropped area
207
+ *
208
+ * @param height - Height of the cropped area
209
+ *
210
+ * @param x - X coordinate of top-left corner (default: 0)
211
+ *
212
+ * @param y - Y coordinate of top-left corner (default: 0)
213
+ *
214
+ * @returns This instance for chaining
215
+ *
216
+ * @example
217
+ * ```typescript
218
+ * chain.crop(640, 480, 100, 100) // Crop 640x480 area starting at (100,100)
219
+ * chain.crop(1280, 720) // Crop from top-left corner
220
+ * ```
221
+ *
222
+ * @example
223
+ * ```typescript
224
+ * // Hardware crop + scale
225
+ * chain.crop(100, 100, 50, 50)
226
+ * .scale(1920, 1080)
227
+ * ```
228
+ *
229
+ * @see {@link https://ffmpeg.org/ffmpeg-filters.html#crop | FFmpeg crop filter}
230
+ */
231
+ crop(width: number, height: number, x?: number, y?: number): FilterPreset;
232
+ /**
233
+ * Adds a blur filter to the chain (hardware-specific).
234
+ * Only available for hardware presets that support blur
235
+ *
236
+ * @param type - Blur type (default: 'avg')
237
+ *
238
+ * @param radius - Blur radius (optional)
239
+ *
240
+ * @returns This instance for chaining
241
+ *
242
+ * @example
243
+ * ```typescript
244
+ * const chain = FilterPresets.chain()
245
+ * .blur('gaussian', 5)
246
+ * .build();
247
+ * ```
248
+ *
249
+ * @example
250
+ * ```typescript
251
+ * const chain = FilterPresets.chain()
252
+ * .blur('box')
253
+ * .build();
254
+ * ```
255
+ */
256
+ blur(type?: 'avg' | 'gaussian' | 'box', radius?: number): FilterPreset;
257
+ /**
258
+ * Adds a sharpen filter to the chain (hardware-specific).
259
+ * Only available for hardware presets that support sharpening
260
+ *
261
+ * @param amount - Sharpen amount (optional)
262
+ *
263
+ * @returns This instance for chaining
264
+ *
265
+ * @example
266
+ * ```typescript
267
+ * const chain = FilterPresets.chain()
268
+ * .sharpen(1.5)
269
+ * .build();
270
+ * ```
271
+ *
272
+ * @example
273
+ * ```typescript
274
+ * const chain = FilterPresets.chain()
275
+ * .sharpen()
276
+ * .build();
277
+ * ```
278
+ */
279
+ sharpen(amount?: number): FilterPreset;
280
+ /**
281
+ * Adds a Sobel edge detection filter.
282
+ *
283
+ * Applies Sobel operator to detect edges in images.
284
+ * Supports hardware acceleration with OpenCL.
285
+ * Useful for computer vision and artistic effects.
286
+ *
287
+ * @param planes - Planes to process (1-15, default: 15 for all)
288
+ *
289
+ * @param scale - Scale factor for result (default: 1.0)
290
+ *
291
+ * @returns This instance for chaining
292
+ *
293
+ * @example
294
+ * ```typescript
295
+ * const chain = FilterPresets.chain()
296
+ * .sobel()
297
+ * .build();
298
+ * ```
299
+ *
300
+ * @example
301
+ * ```typescript
302
+ * const chain = FilterPresets.chain()
303
+ * .sobel(15, 2.0) // All planes, 2x scale
304
+ * .build();
305
+ * ```
306
+ */
307
+ 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
+ /**
325
+ * Adds a format filter to convert pixel format.
326
+ *
327
+ * @param pixelFormat - Target pixel format(s) - AVPixelFormat enum, or array
328
+ *
329
+ * @returns This instance for chaining
330
+ *
331
+ * @example
332
+ * ```typescript
333
+ * // Single format
334
+ * chain.format(AV_PIX_FMT_YUV420P);
335
+ *
336
+ * // Multiple formats (tries formats in order)
337
+ * chain.format([AV_PIX_FMT_YUV420P, AV_PIX_FMT_RGB24]);
338
+ * ```
339
+ *
340
+ * @see {@link https://ffmpeg.org/ffmpeg-filters.html#format | FFmpeg format filter}
341
+ */
342
+ 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
+ /**
360
+ * Adds a flip filter to the chain (hardware-specific).
361
+ * Falls back to hflip/vflip if hardware flip not available
362
+ *
363
+ * @param direction - Flip direction ('h' or 'v')
364
+ *
365
+ * @returns This instance for chaining
366
+ *
367
+ * @example
368
+ * ```typescript
369
+ * const chain = FilterPresets.chain()
370
+ * .flip('h')
371
+ * .build();
372
+ * ```
373
+ *
374
+ * @example
375
+ * ```typescript
376
+ * const chain = FilterPresets.chain()
377
+ * .flip('v')
378
+ * .build();
379
+ * ```
380
+ */
381
+ flip(direction: 'h' | 'v'): FilterPreset;
382
+ /**
383
+ * Adds a stack filter to the chain (hardware-specific).
384
+ * Only available for hardware presets that support stacking
385
+ *
386
+ * @param type - Stack type ('h' for horizontal, 'v' for vertical, 'x' for grid)
387
+ *
388
+ * @param inputs - Number of inputs (default: 2)
389
+ *
390
+ * @returns This instance for chaining
391
+ *
392
+ * @example
393
+ * ```typescript
394
+ * const chain = FilterPresets.chain()
395
+ * .stack('h', 2)
396
+ * .build();
397
+ * ```
398
+ *
399
+ * @example
400
+ * ```typescript
401
+ * const chain = FilterPresets.chain()
402
+ * .stack('x', 4)
403
+ * .build();
404
+ * ```
405
+ */
406
+ stack(type: 'h' | 'v' | 'x', inputs?: number): FilterPreset;
407
+ /**
408
+ * Creates a tonemap filter.
409
+ * Used for HDR to SDR conversion with hardware acceleration.
410
+ *
411
+ * @param alg - Tonemapping algorithm (e.g., 'hable', 'reinhard', 'mobius', etc.)
412
+ *
413
+ * @param options - Tonemapping options
414
+ *
415
+ * @returns Hardware tonemap filter string or null if not supported
416
+ *
417
+ * @example
418
+ * ```typescript
419
+ * const filter = hwPresets.tonemap();
420
+ * ```
421
+ *
422
+ * @example
423
+ * ```typescript
424
+ * const filter = hwPresets.tonemap({ tonemap: 'hable', desat: '0' });
425
+ * ```
426
+ */
427
+ 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
+ /**
449
+ * Creates an overlay filter string to composite two video streams.
450
+ *
451
+ * @param x - X position for overlay (default: 0)
452
+ *
453
+ * @param y - Y position for overlay (default: 0)
454
+ *
455
+ * @param options - Additional overlay options
456
+ *
457
+ * @returns Filter string or null if not supported
458
+ *
459
+ * @example
460
+ * ```typescript
461
+ * // Basic overlay at position
462
+ * presets.overlay(100, 50);
463
+ *
464
+ * // With additional options
465
+ * presets.overlay(0, 0, { format: 'yuv420' });
466
+ * ```
467
+ *
468
+ * @see {@link https://ffmpeg.org/ffmpeg-filters.html#overlay | FFmpeg overlay filter}
469
+ */
470
+ 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
+ /**
488
+ * Creates an audio format filter string.
489
+ *
490
+ * @param sampleFormat - Target sample format (e.g., 's16', 'fltp')
491
+ *
492
+ * @param sampleRate - Target sample rate in Hz (optional)
493
+ *
494
+ * @param channelLayout - Target channel layout (optional)
495
+ *
496
+ * @returns Filter string or null if not supported
497
+ *
498
+ * @example
499
+ * ```typescript
500
+ * // Change sample format only
501
+ * presets.aformat('s16');
502
+ *
503
+ * // Change format and sample rate
504
+ * presets.aformat('fltp', 48000);
505
+ *
506
+ * // Full conversion
507
+ * presets.aformat('s16', 44100, 'stereo');
508
+ * ```
509
+ *
510
+ * @see {@link https://ffmpeg.org/ffmpeg-filters.html#aformat | FFmpeg aformat filter}
511
+ */
512
+ 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
+ /**
614
+ * Adds a pad filter to add padding to video.
615
+ * Essential for aspect ratio adjustments and letterboxing.
616
+ *
617
+ * @param width - Output width (can use expressions like 'iw+100')
618
+ *
619
+ * @param height - Output height (can use expressions like 'ih+100')
620
+ *
621
+ * @param x - X position of input video (default: '(ow-iw)/2' for center)
622
+ *
623
+ * @param y - Y position of input video (default: '(oh-ih)/2' for center)
624
+ *
625
+ * @param color - Padding color (default: 'black')
626
+ *
627
+ * @returns This instance for chaining
628
+ *
629
+ * @example
630
+ * ```typescript
631
+ * // Add black bars for 16:9 aspect ratio
632
+ * chain.pad('iw', 'iw*9/16');
633
+ *
634
+ * // Add 50px padding on all sides
635
+ * chain.pad('iw+100', 'ih+100');
636
+ * ```
637
+ *
638
+ * @see {@link https://ffmpeg.org/ffmpeg-filters.html#pad | FFmpeg pad filter}
639
+ */
640
+ 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
+ /**
701
+ * Creates a transpose filter string for rotation/flipping.
702
+ * More efficient than rotate for 90-degree rotations.
703
+ *
704
+ * @param mode - Transpose mode (0-3, or named constants)
705
+ *
706
+ * @returns Filter string or null if not supported
707
+ *
708
+ * @example
709
+ * ```typescript
710
+ * presets.transpose(1) // Rotate 90 degrees clockwise
711
+ * presets.transpose('cclock') // Rotate 90 degrees counter-clockwise
712
+ * ```
713
+ *
714
+ * @see {@link https://ffmpeg.org/ffmpeg-filters.html#transpose | FFmpeg transpose filter}
715
+ */
716
+ 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
+ /**
770
+ * Creates a deinterlace filter string.
771
+ * Essential for processing interlaced content.
772
+ *
773
+ * @param mode - Deinterlace mode (default: 'yadif')
774
+ *
775
+ * @param options - Additional options for the filter
776
+ *
777
+ * @returns Filter string or null if not supported
778
+ *
779
+ * @example
780
+ * ```typescript
781
+ * presets.deinterlace('yadif') // Standard deinterlacing
782
+ * presets.deinterlace('bwdif') // Bob Weaver deinterlacing
783
+ * ```
784
+ *
785
+ * @see {@link https://ffmpeg.org/ffmpeg-filters.html#yadif | FFmpeg yadif filter}
786
+ */
787
+ 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
+ /**
1142
+ * Adds a whisper filter for audio transcription using whisper.cpp.
1143
+ * Transcribes audio and adds metadata to frames (lavfi.whisper.text, lavfi.whisper.duration).
1144
+ *
1145
+ * @param options - Whisper transcription options
1146
+ *
1147
+ * @param options.model - Path to whisper.cpp model file
1148
+ *
1149
+ * @param options.language - Language for transcription (default: 'auto')
1150
+ *
1151
+ * @param options.queue - Audio queue size in seconds (default: 3)
1152
+ *
1153
+ * @param options.useGpu - Use GPU for processing (default: true)
1154
+ *
1155
+ * @param options.gpuDevice - GPU device to use (default: 0)
1156
+ *
1157
+ * @param options.destination - Output destination for transcripts
1158
+ *
1159
+ * @param options.format - Output format: text|srt|json (default: 'text')
1160
+ *
1161
+ * @param options.vadModel - Path to VAD model file (optional)
1162
+ *
1163
+ * @param options.vadThreshold - VAD threshold 0.0-1.0 (default: 0.5)
1164
+ *
1165
+ * @param options.vadMinSpeechDuration - Minimum speech duration for VAD in seconds (default: 0.1)
1166
+ *
1167
+ * @param options.vadMinSilenceDuration - Minimum silence duration for VAD in seconds (default: 0.5)
1168
+ *
1169
+ * @returns This instance for chaining
1170
+ *
1171
+ * @example
1172
+ * ```typescript
1173
+ * // Basic transcription
1174
+ * chain.whisper({
1175
+ * model: '/path/to/ggml-base.bin'
1176
+ * });
1177
+ *
1178
+ * // With language and output
1179
+ * chain.whisper({
1180
+ * model: '/path/to/ggml-base.bin',
1181
+ * language: 'en',
1182
+ * destination: 'output.srt',
1183
+ * format: 'srt'
1184
+ * });
1185
+ *
1186
+ * // With VAD model
1187
+ * chain.whisper({
1188
+ * model: '/path/to/ggml-base.bin',
1189
+ * vadModel: '/path/to/ggml-silero-v5.1.2.bin',
1190
+ * vadThreshold: 0.5
1191
+ * });
1192
+ * ```
1193
+ *
1194
+ * @see {@link https://ffmpeg.org/ffmpeg-filters.html#whisper | FFmpeg whisper filter}
1195
+ */
1196
+ whisper(options: {
1197
+ model: string;
1198
+ language?: string;
1199
+ queue?: number;
1200
+ useGpu?: boolean;
1201
+ gpuDevice?: number;
1202
+ destination?: string;
1203
+ format?: 'text' | 'srt' | 'json';
1204
+ vadModel?: string;
1205
+ vadThreshold?: number;
1206
+ vadMinSpeechDuration?: number;
1207
+ vadMinSilenceDuration?: number;
1208
+ }): FilterPreset;
1209
+ /**
1210
+ * Adds a hwupload filter to upload frames to hardware.
1211
+ * Only applied if hardware acceleration is configured.
1212
+ *
1213
+ * @returns This instance for chaining
1214
+ *
1215
+ * @example
1216
+ * ```typescript
1217
+ * const chain = FilterPresets.chain()
1218
+ * .hwupload()
1219
+ * .scale(1920, 1080)
1220
+ * .build();
1221
+ * ```
1222
+ */
1223
+ hwupload(): FilterPreset;
1224
+ /**
1225
+ * Adds a hwdownload filter to download frames from hardware.
1226
+ * Only applied if hardware acceleration is configured.
1227
+ *
1228
+ * @returns This instance for chaining
1229
+ *
1230
+ * @example
1231
+ * ```typescript
1232
+ * const chain = FilterPresets.chain()
1233
+ * .scale(1920, 1080)
1234
+ * .hwdownload()
1235
+ * .build();
1236
+ * ```
1237
+ */
1238
+ 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
+ /**
1262
+ * Adds a filter to the chain.
1263
+ *
1264
+ * @param filter - Filter string to add (ignored if null/undefined)
1265
+ *
1266
+ * @param unshift - If true, adds to the start instead of the end (default: false)
1267
+ *
1268
+ * @returns This instance for chaining
1269
+ *
1270
+ * @example
1271
+ * ```typescript
1272
+ * chain.add('scale=1920:1080')
1273
+ * ```
1274
+ *
1275
+ * @internal
1276
+ */
1277
+ private add;
1278
+ /**
1279
+ * Determines filter support for the hardware type.
1280
+ *
1281
+ * @returns Hardware filter support configuration
1282
+ *
1283
+ * @internal
1284
+ */
1285
+ private getSupport;
1286
+ }