typed-ffmpeg-compatible 2.6.2__py3-none-any.whl → 2.6.4__py3-none-any.whl
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.
- typed_ffmpeg/__init__.py +26 -1
- typed_ffmpeg/base.py +87 -29
- typed_ffmpeg/common/schema.py +281 -3
- typed_ffmpeg/common/serialize.py +118 -21
- typed_ffmpeg/dag/__init__.py +13 -0
- typed_ffmpeg/dag/compile.py +39 -4
- typed_ffmpeg/dag/context.py +137 -29
- typed_ffmpeg/dag/factory.py +27 -0
- typed_ffmpeg/dag/global_runnable/global_args.py +11 -0
- typed_ffmpeg/dag/global_runnable/runnable.py +143 -34
- typed_ffmpeg/dag/io/_input.py +2 -1
- typed_ffmpeg/dag/io/_output.py +2 -1
- typed_ffmpeg/dag/nodes.py +402 -67
- typed_ffmpeg/dag/schema.py +3 -1
- typed_ffmpeg/dag/utils.py +29 -8
- typed_ffmpeg/dag/validate.py +83 -20
- typed_ffmpeg/exceptions.py +42 -9
- typed_ffmpeg/info.py +137 -16
- typed_ffmpeg/probe.py +31 -6
- typed_ffmpeg/schema.py +32 -5
- typed_ffmpeg/sources.py +2825 -0
- typed_ffmpeg/streams/channel_layout.py +13 -0
- typed_ffmpeg/utils/escaping.py +47 -7
- typed_ffmpeg/utils/forzendict.py +108 -0
- typed_ffmpeg/utils/lazy_eval/operator.py +43 -1
- typed_ffmpeg/utils/lazy_eval/schema.py +122 -6
- typed_ffmpeg/utils/run.py +44 -7
- typed_ffmpeg/utils/snapshot.py +36 -1
- typed_ffmpeg/utils/typing.py +29 -4
- typed_ffmpeg/utils/view.py +46 -4
- {typed_ffmpeg_compatible-2.6.2.dist-info → typed_ffmpeg_compatible-2.6.4.dist-info}/METADATA +1 -1
- typed_ffmpeg_compatible-2.6.4.dist-info/RECORD +48 -0
- typed_ffmpeg_compatible-2.6.2.dist-info/RECORD +0 -46
- {typed_ffmpeg_compatible-2.6.2.dist-info → typed_ffmpeg_compatible-2.6.4.dist-info}/LICENSE +0 -0
- {typed_ffmpeg_compatible-2.6.2.dist-info → typed_ffmpeg_compatible-2.6.4.dist-info}/WHEEL +0 -0
- {typed_ffmpeg_compatible-2.6.2.dist-info → typed_ffmpeg_compatible-2.6.4.dist-info}/entry_points.txt +0 -0
typed_ffmpeg/sources.py
ADDED
@@ -0,0 +1,2825 @@
|
|
1
|
+
# NOTE: this file is auto-generated, do not modify
|
2
|
+
from typing import Any, Literal
|
3
|
+
|
4
|
+
from .common.schema import FFMpegFilterDef
|
5
|
+
from .dag.factory import filter_node_factory
|
6
|
+
from .dag.nodes import FilterableStream, FilterNode
|
7
|
+
from .schema import Auto, Default
|
8
|
+
from .streams.audio import AudioStream
|
9
|
+
from .streams.video import VideoStream
|
10
|
+
from .types import (
|
11
|
+
Boolean,
|
12
|
+
Color,
|
13
|
+
Dictionary,
|
14
|
+
Double,
|
15
|
+
Duration,
|
16
|
+
Flags,
|
17
|
+
Float,
|
18
|
+
Image_size,
|
19
|
+
Int,
|
20
|
+
Int64,
|
21
|
+
Pix_fmt,
|
22
|
+
Rational,
|
23
|
+
Sample_fmt,
|
24
|
+
String,
|
25
|
+
Video_rate,
|
26
|
+
)
|
27
|
+
|
28
|
+
|
29
|
+
def abuffer(
|
30
|
+
*,
|
31
|
+
time_base: Rational = Default("0/1"),
|
32
|
+
sample_rate: Int = Default(0),
|
33
|
+
sample_fmt: Sample_fmt = Default("none"),
|
34
|
+
channel_layout: String = Default(None),
|
35
|
+
channels: Int = Default(0),
|
36
|
+
extra_options: dict[str, Any] = None,
|
37
|
+
) -> AudioStream:
|
38
|
+
"""
|
39
|
+
|
40
|
+
Buffer audio frames, and make them accessible to the filterchain.
|
41
|
+
|
42
|
+
Args:
|
43
|
+
time_base: (from 0 to INT_MAX) (default 0/1)
|
44
|
+
sample_rate: (from 0 to INT_MAX) (default 0)
|
45
|
+
sample_fmt: (default none)
|
46
|
+
channel_layout:
|
47
|
+
channels: (from 0 to INT_MAX) (default 0)
|
48
|
+
|
49
|
+
Returns:
|
50
|
+
default: the audio stream
|
51
|
+
|
52
|
+
References:
|
53
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#abuffer)
|
54
|
+
|
55
|
+
"""
|
56
|
+
filter_node = filter_node_factory(
|
57
|
+
FFMpegFilterDef(name="abuffer", typings_input=(), typings_output=("audio",)),
|
58
|
+
**{
|
59
|
+
"time_base": time_base,
|
60
|
+
"sample_rate": sample_rate,
|
61
|
+
"sample_fmt": sample_fmt,
|
62
|
+
"channel_layout": channel_layout,
|
63
|
+
"channels": channels,
|
64
|
+
}
|
65
|
+
| (extra_options or {}),
|
66
|
+
)
|
67
|
+
return filter_node.audio(0)
|
68
|
+
|
69
|
+
|
70
|
+
def aevalsrc(
|
71
|
+
*,
|
72
|
+
exprs: String = Default(None),
|
73
|
+
nb_samples: Int = Default(1024),
|
74
|
+
sample_rate: String = Default("44100"),
|
75
|
+
duration: Duration = Default(-1e-06),
|
76
|
+
channel_layout: String = Default(None),
|
77
|
+
extra_options: dict[str, Any] = None,
|
78
|
+
) -> AudioStream:
|
79
|
+
"""
|
80
|
+
|
81
|
+
Generate an audio signal generated by an expression.
|
82
|
+
|
83
|
+
Args:
|
84
|
+
exprs: set the '|'-separated list of channels expressions
|
85
|
+
nb_samples: set the number of samples per requested frame (from 0 to INT_MAX) (default 1024)
|
86
|
+
sample_rate: set the sample rate (default "44100")
|
87
|
+
duration: set audio duration (default -0.000001)
|
88
|
+
channel_layout: set channel layout
|
89
|
+
|
90
|
+
Returns:
|
91
|
+
default: the audio stream
|
92
|
+
|
93
|
+
References:
|
94
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#aevalsrc)
|
95
|
+
|
96
|
+
"""
|
97
|
+
filter_node = filter_node_factory(
|
98
|
+
FFMpegFilterDef(name="aevalsrc", typings_input=(), typings_output=("audio",)),
|
99
|
+
**{
|
100
|
+
"exprs": exprs,
|
101
|
+
"nb_samples": nb_samples,
|
102
|
+
"sample_rate": sample_rate,
|
103
|
+
"duration": duration,
|
104
|
+
"channel_layout": channel_layout,
|
105
|
+
}
|
106
|
+
| (extra_options or {}),
|
107
|
+
)
|
108
|
+
return filter_node.audio(0)
|
109
|
+
|
110
|
+
|
111
|
+
def afdelaysrc(
|
112
|
+
*,
|
113
|
+
delay: Double = Default(0.0),
|
114
|
+
sample_rate: Int = Default(44100),
|
115
|
+
nb_samples: Int = Default(1024),
|
116
|
+
taps: Int = Default(0),
|
117
|
+
channel_layout: String = Default("stereo"),
|
118
|
+
extra_options: dict[str, Any] = None,
|
119
|
+
) -> AudioStream:
|
120
|
+
"""
|
121
|
+
|
122
|
+
Generate a Fractional delay FIR coefficients.
|
123
|
+
|
124
|
+
Args:
|
125
|
+
delay: set fractional delay (from 0 to 32767) (default 0)
|
126
|
+
sample_rate: set sample rate (from 1 to INT_MAX) (default 44100)
|
127
|
+
nb_samples: set the number of samples per requested frame (from 1 to INT_MAX) (default 1024)
|
128
|
+
taps: set number of taps for delay filter (from 0 to 32768) (default 0)
|
129
|
+
channel_layout: set channel layout (default "stereo")
|
130
|
+
|
131
|
+
Returns:
|
132
|
+
default: the audio stream
|
133
|
+
|
134
|
+
References:
|
135
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#afdelaysrc)
|
136
|
+
|
137
|
+
"""
|
138
|
+
filter_node = filter_node_factory(
|
139
|
+
FFMpegFilterDef(name="afdelaysrc", typings_input=(), typings_output=("audio",)),
|
140
|
+
**{
|
141
|
+
"delay": delay,
|
142
|
+
"sample_rate": sample_rate,
|
143
|
+
"nb_samples": nb_samples,
|
144
|
+
"taps": taps,
|
145
|
+
"channel_layout": channel_layout,
|
146
|
+
}
|
147
|
+
| (extra_options or {}),
|
148
|
+
)
|
149
|
+
return filter_node.audio(0)
|
150
|
+
|
151
|
+
|
152
|
+
def afirsrc(
|
153
|
+
*,
|
154
|
+
taps: Int = Default(1025),
|
155
|
+
frequency: String = Default("0 1"),
|
156
|
+
magnitude: String = Default("1 1"),
|
157
|
+
phase: String = Default("0 0"),
|
158
|
+
sample_rate: Int = Default(44100),
|
159
|
+
nb_samples: Int = Default(1024),
|
160
|
+
win_func: Int
|
161
|
+
| Literal[
|
162
|
+
"rect",
|
163
|
+
"bartlett",
|
164
|
+
"hann",
|
165
|
+
"hanning",
|
166
|
+
"hamming",
|
167
|
+
"blackman",
|
168
|
+
"welch",
|
169
|
+
"flattop",
|
170
|
+
"bharris",
|
171
|
+
"bnuttall",
|
172
|
+
"bhann",
|
173
|
+
"sine",
|
174
|
+
"nuttall",
|
175
|
+
"lanczos",
|
176
|
+
"gauss",
|
177
|
+
"tukey",
|
178
|
+
"dolph",
|
179
|
+
"cauchy",
|
180
|
+
"parzen",
|
181
|
+
"poisson",
|
182
|
+
"bohman",
|
183
|
+
"kaiser",
|
184
|
+
"rect",
|
185
|
+
"bartlett",
|
186
|
+
"hann",
|
187
|
+
"hanning",
|
188
|
+
"hamming",
|
189
|
+
"blackman",
|
190
|
+
"welch",
|
191
|
+
"flattop",
|
192
|
+
"bharris",
|
193
|
+
"bnuttall",
|
194
|
+
"bhann",
|
195
|
+
"sine",
|
196
|
+
"nuttall",
|
197
|
+
"lanczos",
|
198
|
+
"gauss",
|
199
|
+
"tukey",
|
200
|
+
"dolph",
|
201
|
+
"cauchy",
|
202
|
+
"parzen",
|
203
|
+
"poisson",
|
204
|
+
"bohman",
|
205
|
+
"kaiser",
|
206
|
+
]
|
207
|
+
| Default = Default("blackman"),
|
208
|
+
extra_options: dict[str, Any] = None,
|
209
|
+
) -> AudioStream:
|
210
|
+
"""
|
211
|
+
|
212
|
+
Generate a FIR coefficients audio stream.
|
213
|
+
|
214
|
+
Args:
|
215
|
+
taps: set number of taps (from 9 to 65535) (default 1025)
|
216
|
+
frequency: set frequency points (default "0 1")
|
217
|
+
magnitude: set magnitude values (default "1 1")
|
218
|
+
phase: set phase values (default "0 0")
|
219
|
+
sample_rate: set sample rate (from 1 to INT_MAX) (default 44100)
|
220
|
+
nb_samples: set the number of samples per requested frame (from 1 to INT_MAX) (default 1024)
|
221
|
+
win_func: set window function (from 0 to 20) (default blackman)
|
222
|
+
|
223
|
+
Returns:
|
224
|
+
default: the audio stream
|
225
|
+
|
226
|
+
References:
|
227
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#afirsrc)
|
228
|
+
|
229
|
+
"""
|
230
|
+
filter_node = filter_node_factory(
|
231
|
+
FFMpegFilterDef(name="afirsrc", typings_input=(), typings_output=("audio",)),
|
232
|
+
**{
|
233
|
+
"taps": taps,
|
234
|
+
"frequency": frequency,
|
235
|
+
"magnitude": magnitude,
|
236
|
+
"phase": phase,
|
237
|
+
"sample_rate": sample_rate,
|
238
|
+
"nb_samples": nb_samples,
|
239
|
+
"win_func": win_func,
|
240
|
+
}
|
241
|
+
| (extra_options or {}),
|
242
|
+
)
|
243
|
+
return filter_node.audio(0)
|
244
|
+
|
245
|
+
|
246
|
+
def ainterleave(
|
247
|
+
*streams: AudioStream,
|
248
|
+
nb_inputs: Int = Auto("len(streams)"),
|
249
|
+
duration: Int | Literal["longest", "shortest", "first"] | Default = Default(
|
250
|
+
"longest"
|
251
|
+
),
|
252
|
+
extra_options: dict[str, Any] = None,
|
253
|
+
) -> AudioStream:
|
254
|
+
"""
|
255
|
+
|
256
|
+
Temporally interleave audio inputs.
|
257
|
+
|
258
|
+
Args:
|
259
|
+
nb_inputs: set number of inputs (from 1 to INT_MAX) (default 2)
|
260
|
+
duration: how to determine the end-of-stream (from 0 to 2) (default longest)
|
261
|
+
|
262
|
+
Returns:
|
263
|
+
default: the audio stream
|
264
|
+
|
265
|
+
References:
|
266
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#interleave_002c-ainterleave)
|
267
|
+
|
268
|
+
"""
|
269
|
+
filter_node = filter_node_factory(
|
270
|
+
FFMpegFilterDef(
|
271
|
+
name="ainterleave",
|
272
|
+
typings_input="[StreamType.audio] * int(nb_inputs)",
|
273
|
+
typings_output=("audio",),
|
274
|
+
),
|
275
|
+
*streams,
|
276
|
+
**{
|
277
|
+
"nb_inputs": nb_inputs,
|
278
|
+
"duration": duration,
|
279
|
+
}
|
280
|
+
| (extra_options or {}),
|
281
|
+
)
|
282
|
+
return filter_node.audio(0)
|
283
|
+
|
284
|
+
|
285
|
+
def allrgb(
|
286
|
+
*,
|
287
|
+
rate: Video_rate = Default("25"),
|
288
|
+
duration: Duration = Default(-1e-06),
|
289
|
+
sar: Rational = Default("1/1"),
|
290
|
+
extra_options: dict[str, Any] = None,
|
291
|
+
) -> VideoStream:
|
292
|
+
"""
|
293
|
+
|
294
|
+
Generate all RGB colors.
|
295
|
+
|
296
|
+
Args:
|
297
|
+
rate: set video rate (default "25")
|
298
|
+
duration: set video duration (default -0.000001)
|
299
|
+
sar: set video sample aspect ratio (from 0 to INT_MAX) (default 1/1)
|
300
|
+
|
301
|
+
Returns:
|
302
|
+
default: the video stream
|
303
|
+
|
304
|
+
References:
|
305
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#allrgb_002c-allyuv_002c-color_002c-colorchart_002c-colorspectrum_002c-haldclutsrc_002c-nullsrc_002c-pal75bars_002c-pal100bars_002c-rgbtestsrc_002c-smptebars_002c-smptehdbars_002c-testsrc_002c-testsrc2_002c-yuvtestsrc)
|
306
|
+
|
307
|
+
"""
|
308
|
+
filter_node = filter_node_factory(
|
309
|
+
FFMpegFilterDef(name="allrgb", typings_input=(), typings_output=("video",)),
|
310
|
+
**{
|
311
|
+
"rate": rate,
|
312
|
+
"duration": duration,
|
313
|
+
"sar": sar,
|
314
|
+
}
|
315
|
+
| (extra_options or {}),
|
316
|
+
)
|
317
|
+
return filter_node.video(0)
|
318
|
+
|
319
|
+
|
320
|
+
def allyuv(
|
321
|
+
*,
|
322
|
+
rate: Video_rate = Default("25"),
|
323
|
+
duration: Duration = Default(-1e-06),
|
324
|
+
sar: Rational = Default("1/1"),
|
325
|
+
extra_options: dict[str, Any] = None,
|
326
|
+
) -> VideoStream:
|
327
|
+
"""
|
328
|
+
|
329
|
+
Generate all yuv colors.
|
330
|
+
|
331
|
+
Args:
|
332
|
+
rate: set video rate (default "25")
|
333
|
+
duration: set video duration (default -0.000001)
|
334
|
+
sar: set video sample aspect ratio (from 0 to INT_MAX) (default 1/1)
|
335
|
+
|
336
|
+
Returns:
|
337
|
+
default: the video stream
|
338
|
+
|
339
|
+
References:
|
340
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#allrgb_002c-allyuv_002c-color_002c-colorchart_002c-colorspectrum_002c-haldclutsrc_002c-nullsrc_002c-pal75bars_002c-pal100bars_002c-rgbtestsrc_002c-smptebars_002c-smptehdbars_002c-testsrc_002c-testsrc2_002c-yuvtestsrc)
|
341
|
+
|
342
|
+
"""
|
343
|
+
filter_node = filter_node_factory(
|
344
|
+
FFMpegFilterDef(name="allyuv", typings_input=(), typings_output=("video",)),
|
345
|
+
**{
|
346
|
+
"rate": rate,
|
347
|
+
"duration": duration,
|
348
|
+
"sar": sar,
|
349
|
+
}
|
350
|
+
| (extra_options or {}),
|
351
|
+
)
|
352
|
+
return filter_node.video(0)
|
353
|
+
|
354
|
+
|
355
|
+
def amerge(
|
356
|
+
*streams: AudioStream,
|
357
|
+
inputs: Int = Auto("len(streams)"),
|
358
|
+
extra_options: dict[str, Any] = None,
|
359
|
+
) -> AudioStream:
|
360
|
+
"""
|
361
|
+
|
362
|
+
Merge two or more audio streams into a single multi-channel stream.
|
363
|
+
|
364
|
+
Args:
|
365
|
+
inputs: specify the number of inputs (from 1 to 64) (default 2)
|
366
|
+
|
367
|
+
Returns:
|
368
|
+
default: the audio stream
|
369
|
+
|
370
|
+
References:
|
371
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#amerge)
|
372
|
+
|
373
|
+
"""
|
374
|
+
filter_node = filter_node_factory(
|
375
|
+
FFMpegFilterDef(
|
376
|
+
name="amerge",
|
377
|
+
typings_input="[StreamType.audio] * int(inputs)",
|
378
|
+
typings_output=("audio",),
|
379
|
+
),
|
380
|
+
*streams,
|
381
|
+
**{
|
382
|
+
"inputs": inputs,
|
383
|
+
}
|
384
|
+
| (extra_options or {}),
|
385
|
+
)
|
386
|
+
return filter_node.audio(0)
|
387
|
+
|
388
|
+
|
389
|
+
def amix(
|
390
|
+
*streams: AudioStream,
|
391
|
+
inputs: Int = Auto("len(streams)"),
|
392
|
+
duration: Int | Literal["longest", "shortest", "first"] | Default = Default(
|
393
|
+
"longest"
|
394
|
+
),
|
395
|
+
dropout_transition: Float = Default(2.0),
|
396
|
+
weights: String = Default("1 1"),
|
397
|
+
normalize: Boolean = Default(True),
|
398
|
+
extra_options: dict[str, Any] = None,
|
399
|
+
) -> AudioStream:
|
400
|
+
"""
|
401
|
+
|
402
|
+
Audio mixing.
|
403
|
+
|
404
|
+
Args:
|
405
|
+
inputs: Number of inputs. (from 1 to 32767) (default 2)
|
406
|
+
duration: How to determine the end-of-stream. (from 0 to 2) (default longest)
|
407
|
+
dropout_transition: Transition time, in seconds, for volume renormalization when an input stream ends. (from 0 to INT_MAX) (default 2)
|
408
|
+
weights: Set weight for each input. (default "1 1")
|
409
|
+
normalize: Scale inputs (default true)
|
410
|
+
|
411
|
+
Returns:
|
412
|
+
default: the audio stream
|
413
|
+
|
414
|
+
References:
|
415
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#amix)
|
416
|
+
|
417
|
+
"""
|
418
|
+
filter_node = filter_node_factory(
|
419
|
+
FFMpegFilterDef(
|
420
|
+
name="amix",
|
421
|
+
typings_input="[StreamType.audio] * int(inputs)",
|
422
|
+
typings_output=("audio",),
|
423
|
+
),
|
424
|
+
*streams,
|
425
|
+
**{
|
426
|
+
"inputs": inputs,
|
427
|
+
"duration": duration,
|
428
|
+
"dropout_transition": dropout_transition,
|
429
|
+
"weights": weights,
|
430
|
+
"normalize": normalize,
|
431
|
+
}
|
432
|
+
| (extra_options or {}),
|
433
|
+
)
|
434
|
+
return filter_node.audio(0)
|
435
|
+
|
436
|
+
|
437
|
+
def amovie(
|
438
|
+
*,
|
439
|
+
filename: String = Default(None),
|
440
|
+
format_name: String = Default(None),
|
441
|
+
stream_index: Int = Default(-1),
|
442
|
+
seek_point: Double = Default(0.0),
|
443
|
+
streams: String = Default(None),
|
444
|
+
loop: Int = Default(1),
|
445
|
+
discontinuity: Duration = Default(0.0),
|
446
|
+
dec_threads: Int = Default(0),
|
447
|
+
format_opts: Dictionary = Default(None),
|
448
|
+
extra_options: dict[str, Any] = None,
|
449
|
+
) -> FilterNode:
|
450
|
+
"""
|
451
|
+
|
452
|
+
Read audio from a movie source.
|
453
|
+
|
454
|
+
Args:
|
455
|
+
filename:
|
456
|
+
format_name: set format name
|
457
|
+
stream_index: set stream index (from -1 to INT_MAX) (default -1)
|
458
|
+
seek_point: set seekpoint (seconds) (from 0 to 9.22337e+12) (default 0)
|
459
|
+
streams: set streams
|
460
|
+
loop: set loop count (from 0 to INT_MAX) (default 1)
|
461
|
+
discontinuity: set discontinuity threshold (default 0)
|
462
|
+
dec_threads: set the number of threads for decoding (from 0 to INT_MAX) (default 0)
|
463
|
+
format_opts: set format options for the opened file
|
464
|
+
|
465
|
+
Returns:
|
466
|
+
filter_node: the filter node
|
467
|
+
|
468
|
+
|
469
|
+
References:
|
470
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#amovie)
|
471
|
+
|
472
|
+
"""
|
473
|
+
filter_node = filter_node_factory(
|
474
|
+
FFMpegFilterDef(
|
475
|
+
name="amovie",
|
476
|
+
typings_input="[StreamType.audio] * len(streams.split('+'))",
|
477
|
+
typings_output="[StreamType.audio] * len(streams.split('+'))",
|
478
|
+
),
|
479
|
+
**{
|
480
|
+
"filename": filename,
|
481
|
+
"format_name": format_name,
|
482
|
+
"stream_index": stream_index,
|
483
|
+
"seek_point": seek_point,
|
484
|
+
"streams": streams,
|
485
|
+
"loop": loop,
|
486
|
+
"discontinuity": discontinuity,
|
487
|
+
"dec_threads": dec_threads,
|
488
|
+
"format_opts": format_opts,
|
489
|
+
}
|
490
|
+
| (extra_options or {}),
|
491
|
+
)
|
492
|
+
|
493
|
+
return filter_node
|
494
|
+
|
495
|
+
|
496
|
+
def anoisesrc(
|
497
|
+
*,
|
498
|
+
sample_rate: Int = Default(48000),
|
499
|
+
amplitude: Double = Default(1.0),
|
500
|
+
duration: Duration = Default(0.0),
|
501
|
+
color: Int
|
502
|
+
| Literal["white", "pink", "brown", "blue", "violet", "velvet"]
|
503
|
+
| Default = Default("white"),
|
504
|
+
seed: Int64 = Default(-1),
|
505
|
+
nb_samples: Int = Default(1024),
|
506
|
+
extra_options: dict[str, Any] = None,
|
507
|
+
) -> AudioStream:
|
508
|
+
"""
|
509
|
+
|
510
|
+
Generate a noise audio signal.
|
511
|
+
|
512
|
+
Args:
|
513
|
+
sample_rate: set sample rate (from 15 to INT_MAX) (default 48000)
|
514
|
+
amplitude: set amplitude (from 0 to 1) (default 1)
|
515
|
+
duration: set duration (default 0)
|
516
|
+
color: set noise color (from 0 to 5) (default white)
|
517
|
+
seed: set random seed (from -1 to UINT32_MAX) (default -1)
|
518
|
+
nb_samples: set the number of samples per requested frame (from 1 to INT_MAX) (default 1024)
|
519
|
+
|
520
|
+
Returns:
|
521
|
+
default: the audio stream
|
522
|
+
|
523
|
+
References:
|
524
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#anoisesrc)
|
525
|
+
|
526
|
+
"""
|
527
|
+
filter_node = filter_node_factory(
|
528
|
+
FFMpegFilterDef(name="anoisesrc", typings_input=(), typings_output=("audio",)),
|
529
|
+
**{
|
530
|
+
"sample_rate": sample_rate,
|
531
|
+
"amplitude": amplitude,
|
532
|
+
"duration": duration,
|
533
|
+
"color": color,
|
534
|
+
"seed": seed,
|
535
|
+
"nb_samples": nb_samples,
|
536
|
+
}
|
537
|
+
| (extra_options or {}),
|
538
|
+
)
|
539
|
+
return filter_node.audio(0)
|
540
|
+
|
541
|
+
|
542
|
+
def anullsrc(
|
543
|
+
*,
|
544
|
+
channel_layout: String = Default("stereo"),
|
545
|
+
sample_rate: String = Default("44100"),
|
546
|
+
nb_samples: Int = Default(1024),
|
547
|
+
duration: Duration = Default(-1e-06),
|
548
|
+
extra_options: dict[str, Any] = None,
|
549
|
+
) -> AudioStream:
|
550
|
+
"""
|
551
|
+
|
552
|
+
Null audio source, return empty audio frames.
|
553
|
+
|
554
|
+
Args:
|
555
|
+
channel_layout: set channel_layout (default "stereo")
|
556
|
+
sample_rate: set sample rate (default "44100")
|
557
|
+
nb_samples: set the number of samples per requested frame (from 1 to 65535) (default 1024)
|
558
|
+
duration: set the audio duration (default -0.000001)
|
559
|
+
|
560
|
+
Returns:
|
561
|
+
default: the audio stream
|
562
|
+
|
563
|
+
References:
|
564
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#anullsrc)
|
565
|
+
|
566
|
+
"""
|
567
|
+
filter_node = filter_node_factory(
|
568
|
+
FFMpegFilterDef(name="anullsrc", typings_input=(), typings_output=("audio",)),
|
569
|
+
**{
|
570
|
+
"channel_layout": channel_layout,
|
571
|
+
"sample_rate": sample_rate,
|
572
|
+
"nb_samples": nb_samples,
|
573
|
+
"duration": duration,
|
574
|
+
}
|
575
|
+
| (extra_options or {}),
|
576
|
+
)
|
577
|
+
return filter_node.audio(0)
|
578
|
+
|
579
|
+
|
580
|
+
def astreamselect(
|
581
|
+
*streams: AudioStream,
|
582
|
+
inputs: Int = Auto("len(streams)"),
|
583
|
+
map: String = Default(None),
|
584
|
+
extra_options: dict[str, Any] = None,
|
585
|
+
) -> FilterNode:
|
586
|
+
"""
|
587
|
+
|
588
|
+
Select audio streams
|
589
|
+
|
590
|
+
Args:
|
591
|
+
inputs: number of input streams (from 2 to INT_MAX) (default 2)
|
592
|
+
map: input indexes to remap to outputs
|
593
|
+
|
594
|
+
Returns:
|
595
|
+
filter_node: the filter node
|
596
|
+
|
597
|
+
|
598
|
+
References:
|
599
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#streamselect_002c-astreamselect)
|
600
|
+
|
601
|
+
"""
|
602
|
+
filter_node = filter_node_factory(
|
603
|
+
FFMpegFilterDef(
|
604
|
+
name="astreamselect",
|
605
|
+
typings_input="[StreamType.audio] * int(inputs)",
|
606
|
+
typings_output="[StreamType.audio] * len(re.findall(r'\\d+', str(map)))",
|
607
|
+
),
|
608
|
+
*streams,
|
609
|
+
**{
|
610
|
+
"inputs": inputs,
|
611
|
+
"map": map,
|
612
|
+
}
|
613
|
+
| (extra_options or {}),
|
614
|
+
)
|
615
|
+
|
616
|
+
return filter_node
|
617
|
+
|
618
|
+
|
619
|
+
def avsynctest(
|
620
|
+
*,
|
621
|
+
size: Image_size = Default("hd720"),
|
622
|
+
framerate: Video_rate = Default("30"),
|
623
|
+
samplerate: Int = Default(44100),
|
624
|
+
amplitude: Float = Default(0.7),
|
625
|
+
period: Int = Default(3),
|
626
|
+
delay: Int = Default(0),
|
627
|
+
cycle: Boolean = Default(False),
|
628
|
+
duration: Duration = Default(0.0),
|
629
|
+
fg: Color = Default("white"),
|
630
|
+
bg: Color = Default("black"),
|
631
|
+
ag: Color = Default("gray"),
|
632
|
+
extra_options: dict[str, Any] = None,
|
633
|
+
) -> tuple[
|
634
|
+
AudioStream,
|
635
|
+
VideoStream,
|
636
|
+
]:
|
637
|
+
"""
|
638
|
+
|
639
|
+
Generate an Audio Video Sync Test.
|
640
|
+
|
641
|
+
Args:
|
642
|
+
size: set frame size (default "hd720")
|
643
|
+
framerate: set frame rate (default "30")
|
644
|
+
samplerate: set sample rate (from 8000 to 384000) (default 44100)
|
645
|
+
amplitude: set beep amplitude (from 0 to 1) (default 0.7)
|
646
|
+
period: set beep period (from 1 to 99) (default 3)
|
647
|
+
delay: set flash delay (from -30 to 30) (default 0)
|
648
|
+
cycle: set delay cycle (default false)
|
649
|
+
duration: set duration (default 0)
|
650
|
+
fg: set foreground color (default "white")
|
651
|
+
bg: set background color (default "black")
|
652
|
+
ag: set additional color (default "gray")
|
653
|
+
|
654
|
+
Returns:
|
655
|
+
audio: the audio stream
|
656
|
+
video: the video stream
|
657
|
+
|
658
|
+
References:
|
659
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#avsynctest)
|
660
|
+
|
661
|
+
"""
|
662
|
+
filter_node = filter_node_factory(
|
663
|
+
FFMpegFilterDef(
|
664
|
+
name="avsynctest", typings_input=(), typings_output=("audio", "video")
|
665
|
+
),
|
666
|
+
**{
|
667
|
+
"size": size,
|
668
|
+
"framerate": framerate,
|
669
|
+
"samplerate": samplerate,
|
670
|
+
"amplitude": amplitude,
|
671
|
+
"period": period,
|
672
|
+
"delay": delay,
|
673
|
+
"cycle": cycle,
|
674
|
+
"duration": duration,
|
675
|
+
"fg": fg,
|
676
|
+
"bg": bg,
|
677
|
+
"ag": ag,
|
678
|
+
}
|
679
|
+
| (extra_options or {}),
|
680
|
+
)
|
681
|
+
return (
|
682
|
+
filter_node.audio(0),
|
683
|
+
filter_node.video(1),
|
684
|
+
)
|
685
|
+
|
686
|
+
|
687
|
+
def bm3d(
|
688
|
+
*streams: VideoStream,
|
689
|
+
sigma: Float = Default(1.0),
|
690
|
+
block: Int = Default(16),
|
691
|
+
bstep: Int = Default(4),
|
692
|
+
group: Int = Default(1),
|
693
|
+
range: Int = Default(9),
|
694
|
+
mstep: Int = Default(1),
|
695
|
+
thmse: Float = Default(0.0),
|
696
|
+
hdthr: Float = Default(2.7),
|
697
|
+
estim: Int | Literal["basic", "final"] | Default = Default("basic"),
|
698
|
+
ref: Boolean = Default(False),
|
699
|
+
planes: Int = Default(7),
|
700
|
+
enable: String = Default(None),
|
701
|
+
extra_options: dict[str, Any] = None,
|
702
|
+
) -> VideoStream:
|
703
|
+
"""
|
704
|
+
|
705
|
+
Block-Matching 3D denoiser.
|
706
|
+
|
707
|
+
Args:
|
708
|
+
sigma: set denoising strength (from 0 to 99999.9) (default 1)
|
709
|
+
block: set size of local patch (from 8 to 64) (default 16)
|
710
|
+
bstep: set sliding step for processing blocks (from 1 to 64) (default 4)
|
711
|
+
group: set maximal number of similar blocks (from 1 to 256) (default 1)
|
712
|
+
range: set block matching range (from 1 to INT_MAX) (default 9)
|
713
|
+
mstep: set step for block matching (from 1 to 64) (default 1)
|
714
|
+
thmse: set threshold of mean square error for block matching (from 0 to INT_MAX) (default 0)
|
715
|
+
hdthr: set hard threshold for 3D transfer domain (from 0 to INT_MAX) (default 2.7)
|
716
|
+
estim: set filtering estimation mode (from 0 to 1) (default basic)
|
717
|
+
ref: have reference stream (default false)
|
718
|
+
planes: set planes to filter (from 0 to 15) (default 7)
|
719
|
+
enable: timeline editing
|
720
|
+
|
721
|
+
Returns:
|
722
|
+
default: the video stream
|
723
|
+
|
724
|
+
References:
|
725
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#bm3d)
|
726
|
+
|
727
|
+
"""
|
728
|
+
filter_node = filter_node_factory(
|
729
|
+
FFMpegFilterDef(
|
730
|
+
name="bm3d",
|
731
|
+
typings_input="[StreamType.video] + [StreamType.video] if ref else []",
|
732
|
+
typings_output=("video",),
|
733
|
+
),
|
734
|
+
*streams,
|
735
|
+
**{
|
736
|
+
"sigma": sigma,
|
737
|
+
"block": block,
|
738
|
+
"bstep": bstep,
|
739
|
+
"group": group,
|
740
|
+
"range": range,
|
741
|
+
"mstep": mstep,
|
742
|
+
"thmse": thmse,
|
743
|
+
"hdthr": hdthr,
|
744
|
+
"estim": estim,
|
745
|
+
"ref": ref,
|
746
|
+
"planes": planes,
|
747
|
+
"enable": enable,
|
748
|
+
}
|
749
|
+
| (extra_options or {}),
|
750
|
+
)
|
751
|
+
return filter_node.video(0)
|
752
|
+
|
753
|
+
|
754
|
+
def buffer(
|
755
|
+
*,
|
756
|
+
width: Int = Default(0),
|
757
|
+
video_size: Image_size = Default(None),
|
758
|
+
height: Int = Default(0),
|
759
|
+
pix_fmt: Pix_fmt = Default("none"),
|
760
|
+
sar: Rational = Default("0/1"),
|
761
|
+
time_base: Rational = Default("0/1"),
|
762
|
+
extra_options: dict[str, Any] = None,
|
763
|
+
) -> VideoStream:
|
764
|
+
"""
|
765
|
+
|
766
|
+
Buffer video frames, and make them accessible to the filterchain.
|
767
|
+
|
768
|
+
Args:
|
769
|
+
width: (from 0 to INT_MAX) (default 0)
|
770
|
+
video_size:
|
771
|
+
height: (from 0 to INT_MAX) (default 0)
|
772
|
+
pix_fmt: (default none)
|
773
|
+
sar: sample aspect ratio (from 0 to DBL_MAX) (default 0/1)
|
774
|
+
time_base: (from 0 to DBL_MAX) (default 0/1)
|
775
|
+
|
776
|
+
Returns:
|
777
|
+
default: the video stream
|
778
|
+
|
779
|
+
References:
|
780
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#buffer)
|
781
|
+
|
782
|
+
"""
|
783
|
+
filter_node = filter_node_factory(
|
784
|
+
FFMpegFilterDef(name="buffer", typings_input=(), typings_output=("video",)),
|
785
|
+
**{
|
786
|
+
"width": width,
|
787
|
+
"video_size": video_size,
|
788
|
+
"height": height,
|
789
|
+
"pix_fmt": pix_fmt,
|
790
|
+
"sar": sar,
|
791
|
+
"time_base": time_base,
|
792
|
+
}
|
793
|
+
| (extra_options or {}),
|
794
|
+
)
|
795
|
+
return filter_node.video(0)
|
796
|
+
|
797
|
+
|
798
|
+
def cellauto(
|
799
|
+
*,
|
800
|
+
filename: String = Default(None),
|
801
|
+
pattern: String = Default(None),
|
802
|
+
rate: Video_rate = Default("25"),
|
803
|
+
size: Image_size = Default(None),
|
804
|
+
rule: Int = Default(110),
|
805
|
+
random_fill_ratio: Double = Default(0.618034),
|
806
|
+
random_seed: Int64 = Default(-1),
|
807
|
+
scroll: Boolean = Default(True),
|
808
|
+
start_full: Boolean = Default(False),
|
809
|
+
full: Boolean = Default(True),
|
810
|
+
stitch: Boolean = Default(True),
|
811
|
+
extra_options: dict[str, Any] = None,
|
812
|
+
) -> VideoStream:
|
813
|
+
"""
|
814
|
+
|
815
|
+
Create pattern generated by an elementary cellular automaton.
|
816
|
+
|
817
|
+
Args:
|
818
|
+
filename: read initial pattern from file
|
819
|
+
pattern: set initial pattern
|
820
|
+
rate: set video rate (default "25")
|
821
|
+
size: set video size
|
822
|
+
rule: set rule (from 0 to 255) (default 110)
|
823
|
+
random_fill_ratio: set fill ratio for filling initial grid randomly (from 0 to 1) (default 0.618034)
|
824
|
+
random_seed: set the seed for filling the initial grid randomly (from -1 to UINT32_MAX) (default -1)
|
825
|
+
scroll: scroll pattern downward (default true)
|
826
|
+
start_full: start filling the whole video (default false)
|
827
|
+
full: start filling the whole video (default true)
|
828
|
+
stitch: stitch boundaries (default true)
|
829
|
+
|
830
|
+
Returns:
|
831
|
+
default: the video stream
|
832
|
+
|
833
|
+
References:
|
834
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#cellauto)
|
835
|
+
|
836
|
+
"""
|
837
|
+
filter_node = filter_node_factory(
|
838
|
+
FFMpegFilterDef(name="cellauto", typings_input=(), typings_output=("video",)),
|
839
|
+
**{
|
840
|
+
"filename": filename,
|
841
|
+
"pattern": pattern,
|
842
|
+
"rate": rate,
|
843
|
+
"size": size,
|
844
|
+
"rule": rule,
|
845
|
+
"random_fill_ratio": random_fill_ratio,
|
846
|
+
"random_seed": random_seed,
|
847
|
+
"scroll": scroll,
|
848
|
+
"start_full": start_full,
|
849
|
+
"full": full,
|
850
|
+
"stitch": stitch,
|
851
|
+
}
|
852
|
+
| (extra_options or {}),
|
853
|
+
)
|
854
|
+
return filter_node.video(0)
|
855
|
+
|
856
|
+
|
857
|
+
def color(
|
858
|
+
*,
|
859
|
+
color: Color = Default("black"),
|
860
|
+
size: Image_size = Default("320x240"),
|
861
|
+
rate: Video_rate = Default("25"),
|
862
|
+
duration: Duration = Default(-1e-06),
|
863
|
+
sar: Rational = Default("1/1"),
|
864
|
+
extra_options: dict[str, Any] = None,
|
865
|
+
) -> VideoStream:
|
866
|
+
"""
|
867
|
+
|
868
|
+
Provide an uniformly colored input.
|
869
|
+
|
870
|
+
Args:
|
871
|
+
color: set color (default "black")
|
872
|
+
size: set video size (default "320x240")
|
873
|
+
rate: set video rate (default "25")
|
874
|
+
duration: set video duration (default -0.000001)
|
875
|
+
sar: set video sample aspect ratio (from 0 to INT_MAX) (default 1/1)
|
876
|
+
|
877
|
+
Returns:
|
878
|
+
default: the video stream
|
879
|
+
|
880
|
+
References:
|
881
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#allrgb_002c-allyuv_002c-color_002c-colorchart_002c-colorspectrum_002c-haldclutsrc_002c-nullsrc_002c-pal75bars_002c-pal100bars_002c-rgbtestsrc_002c-smptebars_002c-smptehdbars_002c-testsrc_002c-testsrc2_002c-yuvtestsrc)
|
882
|
+
|
883
|
+
"""
|
884
|
+
filter_node = filter_node_factory(
|
885
|
+
FFMpegFilterDef(name="color", typings_input=(), typings_output=("video",)),
|
886
|
+
**{
|
887
|
+
"color": color,
|
888
|
+
"size": size,
|
889
|
+
"rate": rate,
|
890
|
+
"duration": duration,
|
891
|
+
"sar": sar,
|
892
|
+
}
|
893
|
+
| (extra_options or {}),
|
894
|
+
)
|
895
|
+
return filter_node.video(0)
|
896
|
+
|
897
|
+
|
898
|
+
def colorchart(
|
899
|
+
*,
|
900
|
+
rate: Video_rate = Default("25"),
|
901
|
+
duration: Duration = Default(-1e-06),
|
902
|
+
sar: Rational = Default("1/1"),
|
903
|
+
patch_size: Image_size = Default("64x64"),
|
904
|
+
preset: Int | Literal["reference", "skintones"] | Default = Default("reference"),
|
905
|
+
extra_options: dict[str, Any] = None,
|
906
|
+
) -> VideoStream:
|
907
|
+
"""
|
908
|
+
|
909
|
+
Generate color checker chart.
|
910
|
+
|
911
|
+
Args:
|
912
|
+
rate: set video rate (default "25")
|
913
|
+
duration: set video duration (default -0.000001)
|
914
|
+
sar: set video sample aspect ratio (from 0 to INT_MAX) (default 1/1)
|
915
|
+
patch_size: set the single patch size (default "64x64")
|
916
|
+
preset: set the color checker chart preset (from 0 to 1) (default reference)
|
917
|
+
|
918
|
+
Returns:
|
919
|
+
default: the video stream
|
920
|
+
|
921
|
+
References:
|
922
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#allrgb_002c-allyuv_002c-color_002c-colorchart_002c-colorspectrum_002c-haldclutsrc_002c-nullsrc_002c-pal75bars_002c-pal100bars_002c-rgbtestsrc_002c-smptebars_002c-smptehdbars_002c-testsrc_002c-testsrc2_002c-yuvtestsrc)
|
923
|
+
|
924
|
+
"""
|
925
|
+
filter_node = filter_node_factory(
|
926
|
+
FFMpegFilterDef(name="colorchart", typings_input=(), typings_output=("video",)),
|
927
|
+
**{
|
928
|
+
"rate": rate,
|
929
|
+
"duration": duration,
|
930
|
+
"sar": sar,
|
931
|
+
"patch_size": patch_size,
|
932
|
+
"preset": preset,
|
933
|
+
}
|
934
|
+
| (extra_options or {}),
|
935
|
+
)
|
936
|
+
return filter_node.video(0)
|
937
|
+
|
938
|
+
|
939
|
+
def colorspectrum(
|
940
|
+
*,
|
941
|
+
size: Image_size = Default("320x240"),
|
942
|
+
rate: Video_rate = Default("25"),
|
943
|
+
duration: Duration = Default(-1e-06),
|
944
|
+
sar: Rational = Default("1/1"),
|
945
|
+
type: Int | Literal["black", "white", "all"] | Default = Default("black"),
|
946
|
+
extra_options: dict[str, Any] = None,
|
947
|
+
) -> VideoStream:
|
948
|
+
"""
|
949
|
+
|
950
|
+
Generate colors spectrum.
|
951
|
+
|
952
|
+
Args:
|
953
|
+
size: set video size (default "320x240")
|
954
|
+
rate: set video rate (default "25")
|
955
|
+
duration: set video duration (default -0.000001)
|
956
|
+
sar: set video sample aspect ratio (from 0 to INT_MAX) (default 1/1)
|
957
|
+
type: set the color spectrum type (from 0 to 2) (default black)
|
958
|
+
|
959
|
+
Returns:
|
960
|
+
default: the video stream
|
961
|
+
|
962
|
+
References:
|
963
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#allrgb_002c-allyuv_002c-color_002c-colorchart_002c-colorspectrum_002c-haldclutsrc_002c-nullsrc_002c-pal75bars_002c-pal100bars_002c-rgbtestsrc_002c-smptebars_002c-smptehdbars_002c-testsrc_002c-testsrc2_002c-yuvtestsrc)
|
964
|
+
|
965
|
+
"""
|
966
|
+
filter_node = filter_node_factory(
|
967
|
+
FFMpegFilterDef(
|
968
|
+
name="colorspectrum", typings_input=(), typings_output=("video",)
|
969
|
+
),
|
970
|
+
**{
|
971
|
+
"size": size,
|
972
|
+
"rate": rate,
|
973
|
+
"duration": duration,
|
974
|
+
"sar": sar,
|
975
|
+
"type": type,
|
976
|
+
}
|
977
|
+
| (extra_options or {}),
|
978
|
+
)
|
979
|
+
return filter_node.video(0)
|
980
|
+
|
981
|
+
|
982
|
+
def concat(
|
983
|
+
*streams: FilterableStream,
|
984
|
+
n: Int = Auto("len(streams) // (int(v) + int(a))"),
|
985
|
+
v: Int = Default(1),
|
986
|
+
a: Int = Default(0),
|
987
|
+
unsafe: Boolean = Default(False),
|
988
|
+
extra_options: dict[str, Any] = None,
|
989
|
+
) -> FilterNode:
|
990
|
+
"""
|
991
|
+
|
992
|
+
Concatenate audio and video streams.
|
993
|
+
|
994
|
+
Args:
|
995
|
+
n: specify the number of segments (from 1 to INT_MAX) (default 2)
|
996
|
+
v: specify the number of video streams (from 0 to INT_MAX) (default 1)
|
997
|
+
a: specify the number of audio streams (from 0 to INT_MAX) (default 0)
|
998
|
+
unsafe: enable unsafe mode (default false)
|
999
|
+
|
1000
|
+
Returns:
|
1001
|
+
filter_node: the filter node
|
1002
|
+
|
1003
|
+
|
1004
|
+
References:
|
1005
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#concat)
|
1006
|
+
|
1007
|
+
"""
|
1008
|
+
filter_node = filter_node_factory(
|
1009
|
+
FFMpegFilterDef(
|
1010
|
+
name="concat",
|
1011
|
+
typings_input="([StreamType.video]*int(v) + [StreamType.audio]*int(a))*int(n)",
|
1012
|
+
typings_output="[StreamType.video]*int(v) + [StreamType.audio]*int(a)",
|
1013
|
+
),
|
1014
|
+
*streams,
|
1015
|
+
**{
|
1016
|
+
"n": n,
|
1017
|
+
"v": v,
|
1018
|
+
"a": a,
|
1019
|
+
"unsafe": unsafe,
|
1020
|
+
}
|
1021
|
+
| (extra_options or {}),
|
1022
|
+
)
|
1023
|
+
|
1024
|
+
return filter_node
|
1025
|
+
|
1026
|
+
|
1027
|
+
def decimate(
|
1028
|
+
*streams: VideoStream,
|
1029
|
+
cycle: Int = Default(5),
|
1030
|
+
dupthresh: Double = Default(1.1),
|
1031
|
+
scthresh: Double = Default(15.0),
|
1032
|
+
blockx: Int = Default(32),
|
1033
|
+
blocky: Int = Default(32),
|
1034
|
+
ppsrc: Boolean = Default(False),
|
1035
|
+
chroma: Boolean = Default(True),
|
1036
|
+
mixed: Boolean = Default(False),
|
1037
|
+
extra_options: dict[str, Any] = None,
|
1038
|
+
) -> VideoStream:
|
1039
|
+
"""
|
1040
|
+
|
1041
|
+
Decimate frames (post field matching filter).
|
1042
|
+
|
1043
|
+
Args:
|
1044
|
+
cycle: set the number of frame from which one will be dropped (from 2 to 25) (default 5)
|
1045
|
+
dupthresh: set duplicate threshold (from 0 to 100) (default 1.1)
|
1046
|
+
scthresh: set scene change threshold (from 0 to 100) (default 15)
|
1047
|
+
blockx: set the size of the x-axis blocks used during metric calculations (from 4 to 512) (default 32)
|
1048
|
+
blocky: set the size of the y-axis blocks used during metric calculations (from 4 to 512) (default 32)
|
1049
|
+
ppsrc: mark main input as a pre-processed input and activate clean source input stream (default false)
|
1050
|
+
chroma: set whether or not chroma is considered in the metric calculations (default true)
|
1051
|
+
mixed: set whether or not the input only partially contains content to be decimated (default false)
|
1052
|
+
|
1053
|
+
Returns:
|
1054
|
+
default: the video stream
|
1055
|
+
|
1056
|
+
References:
|
1057
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#decimate)
|
1058
|
+
|
1059
|
+
"""
|
1060
|
+
filter_node = filter_node_factory(
|
1061
|
+
FFMpegFilterDef(
|
1062
|
+
name="decimate",
|
1063
|
+
typings_input="[StreamType.video] + ([StreamType.video] if ppsrc else [])",
|
1064
|
+
typings_output=("video",),
|
1065
|
+
),
|
1066
|
+
*streams,
|
1067
|
+
**{
|
1068
|
+
"cycle": cycle,
|
1069
|
+
"dupthresh": dupthresh,
|
1070
|
+
"scthresh": scthresh,
|
1071
|
+
"blockx": blockx,
|
1072
|
+
"blocky": blocky,
|
1073
|
+
"ppsrc": ppsrc,
|
1074
|
+
"chroma": chroma,
|
1075
|
+
"mixed": mixed,
|
1076
|
+
}
|
1077
|
+
| (extra_options or {}),
|
1078
|
+
)
|
1079
|
+
return filter_node.video(0)
|
1080
|
+
|
1081
|
+
|
1082
|
+
def fieldmatch(
|
1083
|
+
*streams: VideoStream,
|
1084
|
+
order: Int | Literal["auto", "bff", "tff"] | Default = Default("auto"),
|
1085
|
+
mode: Int
|
1086
|
+
| Literal["pc", "pc_n", "pc_u", "pc_n_ub", "pcn", "pcn_ub"]
|
1087
|
+
| Default = Default("pc_n"),
|
1088
|
+
ppsrc: Boolean = Default(False),
|
1089
|
+
field: Int | Literal["auto", "bottom", "top"] | Default = Default("auto"),
|
1090
|
+
mchroma: Boolean = Default(True),
|
1091
|
+
y0: Int = Default(0),
|
1092
|
+
scthresh: Double = Default(12.0),
|
1093
|
+
combmatch: Int | Literal["none", "sc", "full"] | Default = Default("sc"),
|
1094
|
+
combdbg: Int | Literal["none", "pcn", "pcnub"] | Default = Default("none"),
|
1095
|
+
cthresh: Int = Default(9),
|
1096
|
+
chroma: Boolean = Default(False),
|
1097
|
+
blockx: Int = Default(16),
|
1098
|
+
blocky: Int = Default(16),
|
1099
|
+
combpel: Int = Default(80),
|
1100
|
+
extra_options: dict[str, Any] = None,
|
1101
|
+
) -> VideoStream:
|
1102
|
+
"""
|
1103
|
+
|
1104
|
+
Field matching for inverse telecine.
|
1105
|
+
|
1106
|
+
Args:
|
1107
|
+
order: specify the assumed field order (from -1 to 1) (default auto)
|
1108
|
+
mode: set the matching mode or strategy to use (from 0 to 5) (default pc_n)
|
1109
|
+
ppsrc: mark main input as a pre-processed input and activate clean source input stream (default false)
|
1110
|
+
field: set the field to match from (from -1 to 1) (default auto)
|
1111
|
+
mchroma: set whether or not chroma is included during the match comparisons (default true)
|
1112
|
+
y0: define an exclusion band which excludes the lines between y0 and y1 from the field matching decision (from 0 to INT_MAX) (default 0)
|
1113
|
+
scthresh: set scene change detection threshold (from 0 to 100) (default 12)
|
1114
|
+
combmatch: set combmatching mode (from 0 to 2) (default sc)
|
1115
|
+
combdbg: enable comb debug (from 0 to 2) (default none)
|
1116
|
+
cthresh: set the area combing threshold used for combed frame detection (from -1 to 255) (default 9)
|
1117
|
+
chroma: set whether or not chroma is considered in the combed frame decision (default false)
|
1118
|
+
blockx: set the x-axis size of the window used during combed frame detection (from 4 to 512) (default 16)
|
1119
|
+
blocky: set the y-axis size of the window used during combed frame detection (from 4 to 512) (default 16)
|
1120
|
+
combpel: set the number of combed pixels inside any of the blocky by blockx size blocks on the frame for the frame to be detected as combed (from 0 to INT_MAX) (default 80)
|
1121
|
+
|
1122
|
+
Returns:
|
1123
|
+
default: the video stream
|
1124
|
+
|
1125
|
+
References:
|
1126
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#fieldmatch)
|
1127
|
+
|
1128
|
+
"""
|
1129
|
+
filter_node = filter_node_factory(
|
1130
|
+
FFMpegFilterDef(
|
1131
|
+
name="fieldmatch",
|
1132
|
+
typings_input="[StreamType.video] + [StreamType.video] if ppsrc else []",
|
1133
|
+
typings_output=("video",),
|
1134
|
+
),
|
1135
|
+
*streams,
|
1136
|
+
**{
|
1137
|
+
"order": order,
|
1138
|
+
"mode": mode,
|
1139
|
+
"ppsrc": ppsrc,
|
1140
|
+
"field": field,
|
1141
|
+
"mchroma": mchroma,
|
1142
|
+
"y0": y0,
|
1143
|
+
"scthresh": scthresh,
|
1144
|
+
"combmatch": combmatch,
|
1145
|
+
"combdbg": combdbg,
|
1146
|
+
"cthresh": cthresh,
|
1147
|
+
"chroma": chroma,
|
1148
|
+
"blockx": blockx,
|
1149
|
+
"blocky": blocky,
|
1150
|
+
"combpel": combpel,
|
1151
|
+
}
|
1152
|
+
| (extra_options or {}),
|
1153
|
+
)
|
1154
|
+
return filter_node.video(0)
|
1155
|
+
|
1156
|
+
|
1157
|
+
def frei0r_src(
|
1158
|
+
*,
|
1159
|
+
size: Image_size = Default("320x240"),
|
1160
|
+
framerate: Video_rate = Default("25"),
|
1161
|
+
filter_name: String = Default(None),
|
1162
|
+
filter_params: String = Default(None),
|
1163
|
+
extra_options: dict[str, Any] = None,
|
1164
|
+
) -> VideoStream:
|
1165
|
+
"""
|
1166
|
+
|
1167
|
+
Generate a frei0r source.
|
1168
|
+
|
1169
|
+
Args:
|
1170
|
+
size: Dimensions of the generated video. (default "320x240")
|
1171
|
+
framerate: (default "25")
|
1172
|
+
filter_name:
|
1173
|
+
filter_params:
|
1174
|
+
|
1175
|
+
Returns:
|
1176
|
+
default: the video stream
|
1177
|
+
|
1178
|
+
References:
|
1179
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#frei0r_005fsrc)
|
1180
|
+
|
1181
|
+
"""
|
1182
|
+
filter_node = filter_node_factory(
|
1183
|
+
FFMpegFilterDef(name="frei0r_src", typings_input=(), typings_output=("video",)),
|
1184
|
+
**{
|
1185
|
+
"size": size,
|
1186
|
+
"framerate": framerate,
|
1187
|
+
"filter_name": filter_name,
|
1188
|
+
"filter_params": filter_params,
|
1189
|
+
}
|
1190
|
+
| (extra_options or {}),
|
1191
|
+
)
|
1192
|
+
return filter_node.video(0)
|
1193
|
+
|
1194
|
+
|
1195
|
+
def gradients(
|
1196
|
+
*,
|
1197
|
+
size: Image_size = Default("640x480"),
|
1198
|
+
rate: Video_rate = Default("25"),
|
1199
|
+
c0: Color = Default("random"),
|
1200
|
+
c1: Color = Default("random"),
|
1201
|
+
c2: Color = Default("random"),
|
1202
|
+
c3: Color = Default("random"),
|
1203
|
+
c4: Color = Default("random"),
|
1204
|
+
c5: Color = Default("random"),
|
1205
|
+
c6: Color = Default("random"),
|
1206
|
+
c7: Color = Default("random"),
|
1207
|
+
x0: Int = Default(-1),
|
1208
|
+
y0: Int = Default(-1),
|
1209
|
+
x1: Int = Default(-1),
|
1210
|
+
y1: Int = Default(-1),
|
1211
|
+
nb_colors: Int = Default(2),
|
1212
|
+
seed: Int64 = Default(-1),
|
1213
|
+
duration: Duration = Default(-1e-06),
|
1214
|
+
speed: Float = Default(0.01),
|
1215
|
+
type: Int | Literal["linear", "radial", "circular", "spiral"] | Default = Default(
|
1216
|
+
"linear"
|
1217
|
+
),
|
1218
|
+
extra_options: dict[str, Any] = None,
|
1219
|
+
) -> VideoStream:
|
1220
|
+
"""
|
1221
|
+
|
1222
|
+
Draw a gradients.
|
1223
|
+
|
1224
|
+
Args:
|
1225
|
+
size: set frame size (default "640x480")
|
1226
|
+
rate: set frame rate (default "25")
|
1227
|
+
c0: set 1st color (default "random")
|
1228
|
+
c1: set 2nd color (default "random")
|
1229
|
+
c2: set 3rd color (default "random")
|
1230
|
+
c3: set 4th color (default "random")
|
1231
|
+
c4: set 5th color (default "random")
|
1232
|
+
c5: set 6th color (default "random")
|
1233
|
+
c6: set 7th color (default "random")
|
1234
|
+
c7: set 8th color (default "random")
|
1235
|
+
x0: set gradient line source x0 (from -1 to INT_MAX) (default -1)
|
1236
|
+
y0: set gradient line source y0 (from -1 to INT_MAX) (default -1)
|
1237
|
+
x1: set gradient line destination x1 (from -1 to INT_MAX) (default -1)
|
1238
|
+
y1: set gradient line destination y1 (from -1 to INT_MAX) (default -1)
|
1239
|
+
nb_colors: set the number of colors (from 2 to 8) (default 2)
|
1240
|
+
seed: set the seed (from -1 to UINT32_MAX) (default -1)
|
1241
|
+
duration: set video duration (default -0.000001)
|
1242
|
+
speed: set gradients rotation speed (from 1e-05 to 1) (default 0.01)
|
1243
|
+
type: set gradient type (from 0 to 3) (default linear)
|
1244
|
+
|
1245
|
+
Returns:
|
1246
|
+
default: the video stream
|
1247
|
+
|
1248
|
+
References:
|
1249
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#gradients)
|
1250
|
+
|
1251
|
+
"""
|
1252
|
+
filter_node = filter_node_factory(
|
1253
|
+
FFMpegFilterDef(name="gradients", typings_input=(), typings_output=("video",)),
|
1254
|
+
**{
|
1255
|
+
"size": size,
|
1256
|
+
"rate": rate,
|
1257
|
+
"c0": c0,
|
1258
|
+
"c1": c1,
|
1259
|
+
"c2": c2,
|
1260
|
+
"c3": c3,
|
1261
|
+
"c4": c4,
|
1262
|
+
"c5": c5,
|
1263
|
+
"c6": c6,
|
1264
|
+
"c7": c7,
|
1265
|
+
"x0": x0,
|
1266
|
+
"y0": y0,
|
1267
|
+
"x1": x1,
|
1268
|
+
"y1": y1,
|
1269
|
+
"nb_colors": nb_colors,
|
1270
|
+
"seed": seed,
|
1271
|
+
"duration": duration,
|
1272
|
+
"speed": speed,
|
1273
|
+
"type": type,
|
1274
|
+
}
|
1275
|
+
| (extra_options or {}),
|
1276
|
+
)
|
1277
|
+
return filter_node.video(0)
|
1278
|
+
|
1279
|
+
|
1280
|
+
def guided(
|
1281
|
+
*streams: VideoStream,
|
1282
|
+
radius: Int = Default(3),
|
1283
|
+
eps: Float = Default(0.01),
|
1284
|
+
mode: Int | Literal["basic", "fast"] | Default = Default("basic"),
|
1285
|
+
sub: Int = Default(4),
|
1286
|
+
guidance: Int | Literal["off", "on"] | Default = Default("off"),
|
1287
|
+
planes: Int = Default(1),
|
1288
|
+
enable: String = Default(None),
|
1289
|
+
extra_options: dict[str, Any] = None,
|
1290
|
+
) -> VideoStream:
|
1291
|
+
"""
|
1292
|
+
|
1293
|
+
Apply Guided filter.
|
1294
|
+
|
1295
|
+
Args:
|
1296
|
+
radius: set the box radius (from 1 to 20) (default 3)
|
1297
|
+
eps: set the regularization parameter (with square) (from 0 to 1) (default 0.01)
|
1298
|
+
mode: set filtering mode (0: basic mode; 1: fast mode) (from 0 to 1) (default basic)
|
1299
|
+
sub: subsampling ratio for fast mode (from 2 to 64) (default 4)
|
1300
|
+
guidance: set guidance mode (0: off mode; 1: on mode) (from 0 to 1) (default off)
|
1301
|
+
planes: set planes to filter (from 0 to 15) (default 1)
|
1302
|
+
enable: timeline editing
|
1303
|
+
|
1304
|
+
Returns:
|
1305
|
+
default: the video stream
|
1306
|
+
|
1307
|
+
References:
|
1308
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#guided)
|
1309
|
+
|
1310
|
+
"""
|
1311
|
+
filter_node = filter_node_factory(
|
1312
|
+
FFMpegFilterDef(
|
1313
|
+
name="guided",
|
1314
|
+
typings_input="[StreamType.video] + [StreamType.video] if guidance else []",
|
1315
|
+
typings_output=("video",),
|
1316
|
+
),
|
1317
|
+
*streams,
|
1318
|
+
**{
|
1319
|
+
"radius": radius,
|
1320
|
+
"eps": eps,
|
1321
|
+
"mode": mode,
|
1322
|
+
"sub": sub,
|
1323
|
+
"guidance": guidance,
|
1324
|
+
"planes": planes,
|
1325
|
+
"enable": enable,
|
1326
|
+
}
|
1327
|
+
| (extra_options or {}),
|
1328
|
+
)
|
1329
|
+
return filter_node.video(0)
|
1330
|
+
|
1331
|
+
|
1332
|
+
def haldclutsrc(
|
1333
|
+
*,
|
1334
|
+
level: Int = Default(6),
|
1335
|
+
rate: Video_rate = Default("25"),
|
1336
|
+
duration: Duration = Default(-1e-06),
|
1337
|
+
sar: Rational = Default("1/1"),
|
1338
|
+
extra_options: dict[str, Any] = None,
|
1339
|
+
) -> VideoStream:
|
1340
|
+
"""
|
1341
|
+
|
1342
|
+
Provide an identity Hald CLUT.
|
1343
|
+
|
1344
|
+
Args:
|
1345
|
+
level: set level (from 2 to 16) (default 6)
|
1346
|
+
rate: set video rate (default "25")
|
1347
|
+
duration: set video duration (default -0.000001)
|
1348
|
+
sar: set video sample aspect ratio (from 0 to INT_MAX) (default 1/1)
|
1349
|
+
|
1350
|
+
Returns:
|
1351
|
+
default: the video stream
|
1352
|
+
|
1353
|
+
References:
|
1354
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#allrgb_002c-allyuv_002c-color_002c-colorchart_002c-colorspectrum_002c-haldclutsrc_002c-nullsrc_002c-pal75bars_002c-pal100bars_002c-rgbtestsrc_002c-smptebars_002c-smptehdbars_002c-testsrc_002c-testsrc2_002c-yuvtestsrc)
|
1355
|
+
|
1356
|
+
"""
|
1357
|
+
filter_node = filter_node_factory(
|
1358
|
+
FFMpegFilterDef(
|
1359
|
+
name="haldclutsrc", typings_input=(), typings_output=("video",)
|
1360
|
+
),
|
1361
|
+
**{
|
1362
|
+
"level": level,
|
1363
|
+
"rate": rate,
|
1364
|
+
"duration": duration,
|
1365
|
+
"sar": sar,
|
1366
|
+
}
|
1367
|
+
| (extra_options or {}),
|
1368
|
+
)
|
1369
|
+
return filter_node.video(0)
|
1370
|
+
|
1371
|
+
|
1372
|
+
def headphone(
|
1373
|
+
*streams: AudioStream,
|
1374
|
+
map: String = Default(None),
|
1375
|
+
gain: Float = Default(0.0),
|
1376
|
+
lfe: Float = Default(0.0),
|
1377
|
+
type: Int | Literal["time", "freq"] | Default = Default("freq"),
|
1378
|
+
size: Int = Default(1024),
|
1379
|
+
hrir: Int | Literal["stereo", "multich"] | Default = Default("stereo"),
|
1380
|
+
extra_options: dict[str, Any] = None,
|
1381
|
+
) -> AudioStream:
|
1382
|
+
"""
|
1383
|
+
|
1384
|
+
Apply headphone binaural spatialization with HRTFs in additional streams.
|
1385
|
+
|
1386
|
+
Args:
|
1387
|
+
map: set channels convolution mappings
|
1388
|
+
gain: set gain in dB (from -20 to 40) (default 0)
|
1389
|
+
lfe: set lfe gain in dB (from -20 to 40) (default 0)
|
1390
|
+
type: set processing (from 0 to 1) (default freq)
|
1391
|
+
size: set frame size (from 1024 to 96000) (default 1024)
|
1392
|
+
hrir: set hrir format (from 0 to 1) (default stereo)
|
1393
|
+
|
1394
|
+
Returns:
|
1395
|
+
default: the audio stream
|
1396
|
+
|
1397
|
+
References:
|
1398
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#headphone)
|
1399
|
+
|
1400
|
+
"""
|
1401
|
+
filter_node = filter_node_factory(
|
1402
|
+
FFMpegFilterDef(
|
1403
|
+
name="headphone",
|
1404
|
+
typings_input="[StreamType.audio] + [StreamType.audio] * (len(str(map).split('|')) - 1) if int(hrir) == 1 else []",
|
1405
|
+
typings_output=("audio",),
|
1406
|
+
),
|
1407
|
+
*streams,
|
1408
|
+
**{
|
1409
|
+
"map": map,
|
1410
|
+
"gain": gain,
|
1411
|
+
"lfe": lfe,
|
1412
|
+
"type": type,
|
1413
|
+
"size": size,
|
1414
|
+
"hrir": hrir,
|
1415
|
+
}
|
1416
|
+
| (extra_options or {}),
|
1417
|
+
)
|
1418
|
+
return filter_node.audio(0)
|
1419
|
+
|
1420
|
+
|
1421
|
+
def hilbert(
|
1422
|
+
*,
|
1423
|
+
sample_rate: Int = Default(44100),
|
1424
|
+
taps: Int = Default(22051),
|
1425
|
+
nb_samples: Int = Default(1024),
|
1426
|
+
win_func: Int
|
1427
|
+
| Literal[
|
1428
|
+
"rect",
|
1429
|
+
"bartlett",
|
1430
|
+
"hann",
|
1431
|
+
"hanning",
|
1432
|
+
"hamming",
|
1433
|
+
"blackman",
|
1434
|
+
"welch",
|
1435
|
+
"flattop",
|
1436
|
+
"bharris",
|
1437
|
+
"bnuttall",
|
1438
|
+
"bhann",
|
1439
|
+
"sine",
|
1440
|
+
"nuttall",
|
1441
|
+
"lanczos",
|
1442
|
+
"gauss",
|
1443
|
+
"tukey",
|
1444
|
+
"dolph",
|
1445
|
+
"cauchy",
|
1446
|
+
"parzen",
|
1447
|
+
"poisson",
|
1448
|
+
"bohman",
|
1449
|
+
"kaiser",
|
1450
|
+
"rect",
|
1451
|
+
"bartlett",
|
1452
|
+
"hann",
|
1453
|
+
"hanning",
|
1454
|
+
"hamming",
|
1455
|
+
"blackman",
|
1456
|
+
"welch",
|
1457
|
+
"flattop",
|
1458
|
+
"bharris",
|
1459
|
+
"bnuttall",
|
1460
|
+
"bhann",
|
1461
|
+
"sine",
|
1462
|
+
"nuttall",
|
1463
|
+
"lanczos",
|
1464
|
+
"gauss",
|
1465
|
+
"tukey",
|
1466
|
+
"dolph",
|
1467
|
+
"cauchy",
|
1468
|
+
"parzen",
|
1469
|
+
"poisson",
|
1470
|
+
"bohman",
|
1471
|
+
"kaiser",
|
1472
|
+
]
|
1473
|
+
| Default = Default("blackman"),
|
1474
|
+
extra_options: dict[str, Any] = None,
|
1475
|
+
) -> AudioStream:
|
1476
|
+
"""
|
1477
|
+
|
1478
|
+
Generate a Hilbert transform FIR coefficients.
|
1479
|
+
|
1480
|
+
Args:
|
1481
|
+
sample_rate: set sample rate (from 1 to INT_MAX) (default 44100)
|
1482
|
+
taps: set number of taps (from 11 to 65535) (default 22051)
|
1483
|
+
nb_samples: set the number of samples per requested frame (from 1 to INT_MAX) (default 1024)
|
1484
|
+
win_func: set window function (from 0 to 20) (default blackman)
|
1485
|
+
|
1486
|
+
Returns:
|
1487
|
+
default: the audio stream
|
1488
|
+
|
1489
|
+
References:
|
1490
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#hilbert)
|
1491
|
+
|
1492
|
+
"""
|
1493
|
+
filter_node = filter_node_factory(
|
1494
|
+
FFMpegFilterDef(name="hilbert", typings_input=(), typings_output=("audio",)),
|
1495
|
+
**{
|
1496
|
+
"sample_rate": sample_rate,
|
1497
|
+
"taps": taps,
|
1498
|
+
"nb_samples": nb_samples,
|
1499
|
+
"win_func": win_func,
|
1500
|
+
}
|
1501
|
+
| (extra_options or {}),
|
1502
|
+
)
|
1503
|
+
return filter_node.audio(0)
|
1504
|
+
|
1505
|
+
|
1506
|
+
def hstack(
|
1507
|
+
*streams: VideoStream,
|
1508
|
+
inputs: Int = Auto("len(streams)"),
|
1509
|
+
shortest: Boolean = Default(False),
|
1510
|
+
extra_options: dict[str, Any] = None,
|
1511
|
+
) -> VideoStream:
|
1512
|
+
"""
|
1513
|
+
|
1514
|
+
Stack video inputs horizontally.
|
1515
|
+
|
1516
|
+
Args:
|
1517
|
+
inputs: set number of inputs (from 2 to INT_MAX) (default 2)
|
1518
|
+
shortest: force termination when the shortest input terminates (default false)
|
1519
|
+
|
1520
|
+
Returns:
|
1521
|
+
default: the video stream
|
1522
|
+
|
1523
|
+
References:
|
1524
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#hstack)
|
1525
|
+
|
1526
|
+
"""
|
1527
|
+
filter_node = filter_node_factory(
|
1528
|
+
FFMpegFilterDef(
|
1529
|
+
name="hstack",
|
1530
|
+
typings_input="[StreamType.video] * int(inputs)",
|
1531
|
+
typings_output=("video",),
|
1532
|
+
),
|
1533
|
+
*streams,
|
1534
|
+
**{
|
1535
|
+
"inputs": inputs,
|
1536
|
+
"shortest": shortest,
|
1537
|
+
}
|
1538
|
+
| (extra_options or {}),
|
1539
|
+
)
|
1540
|
+
return filter_node.video(0)
|
1541
|
+
|
1542
|
+
|
1543
|
+
def interleave(
|
1544
|
+
*streams: VideoStream,
|
1545
|
+
nb_inputs: Int = Auto("len(streams)"),
|
1546
|
+
duration: Int | Literal["longest", "shortest", "first"] | Default = Default(
|
1547
|
+
"longest"
|
1548
|
+
),
|
1549
|
+
extra_options: dict[str, Any] = None,
|
1550
|
+
) -> VideoStream:
|
1551
|
+
"""
|
1552
|
+
|
1553
|
+
Temporally interleave video inputs.
|
1554
|
+
|
1555
|
+
Args:
|
1556
|
+
nb_inputs: set number of inputs (from 1 to INT_MAX) (default 2)
|
1557
|
+
duration: how to determine the end-of-stream (from 0 to 2) (default longest)
|
1558
|
+
|
1559
|
+
Returns:
|
1560
|
+
default: the video stream
|
1561
|
+
|
1562
|
+
References:
|
1563
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#interleave_002c-ainterleave)
|
1564
|
+
|
1565
|
+
"""
|
1566
|
+
filter_node = filter_node_factory(
|
1567
|
+
FFMpegFilterDef(
|
1568
|
+
name="interleave",
|
1569
|
+
typings_input="[StreamType.video] * int(nb_inputs)",
|
1570
|
+
typings_output=("video",),
|
1571
|
+
),
|
1572
|
+
*streams,
|
1573
|
+
**{
|
1574
|
+
"nb_inputs": nb_inputs,
|
1575
|
+
"duration": duration,
|
1576
|
+
}
|
1577
|
+
| (extra_options or {}),
|
1578
|
+
)
|
1579
|
+
return filter_node.video(0)
|
1580
|
+
|
1581
|
+
|
1582
|
+
def join(
|
1583
|
+
*streams: AudioStream,
|
1584
|
+
inputs: Int = Auto("len(streams)"),
|
1585
|
+
channel_layout: String = Default("stereo"),
|
1586
|
+
map: String = Default(None),
|
1587
|
+
extra_options: dict[str, Any] = None,
|
1588
|
+
) -> AudioStream:
|
1589
|
+
"""
|
1590
|
+
|
1591
|
+
Join multiple audio streams into multi-channel output.
|
1592
|
+
|
1593
|
+
Args:
|
1594
|
+
inputs: Number of input streams. (from 1 to INT_MAX) (default 2)
|
1595
|
+
channel_layout: Channel layout of the output stream. (default "stereo")
|
1596
|
+
map: A comma-separated list of channels maps in the format 'input_stream.input_channel-output_channel.
|
1597
|
+
|
1598
|
+
Returns:
|
1599
|
+
default: the audio stream
|
1600
|
+
|
1601
|
+
References:
|
1602
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#join)
|
1603
|
+
|
1604
|
+
"""
|
1605
|
+
filter_node = filter_node_factory(
|
1606
|
+
FFMpegFilterDef(
|
1607
|
+
name="join",
|
1608
|
+
typings_input="[StreamType.audio] * int(inputs)",
|
1609
|
+
typings_output=("audio",),
|
1610
|
+
),
|
1611
|
+
*streams,
|
1612
|
+
**{
|
1613
|
+
"inputs": inputs,
|
1614
|
+
"channel_layout": channel_layout,
|
1615
|
+
"map": map,
|
1616
|
+
}
|
1617
|
+
| (extra_options or {}),
|
1618
|
+
)
|
1619
|
+
return filter_node.audio(0)
|
1620
|
+
|
1621
|
+
|
1622
|
+
def life(
|
1623
|
+
*,
|
1624
|
+
filename: String = Default(None),
|
1625
|
+
size: Image_size = Default(None),
|
1626
|
+
rate: Video_rate = Default("25"),
|
1627
|
+
rule: String = Default("B3/S23"),
|
1628
|
+
random_fill_ratio: Double = Default(0.618034),
|
1629
|
+
random_seed: Int64 = Default(-1),
|
1630
|
+
stitch: Boolean = Default(True),
|
1631
|
+
mold: Int = Default(0),
|
1632
|
+
life_color: Color = Default("white"),
|
1633
|
+
death_color: Color = Default("black"),
|
1634
|
+
mold_color: Color = Default("black"),
|
1635
|
+
extra_options: dict[str, Any] = None,
|
1636
|
+
) -> VideoStream:
|
1637
|
+
"""
|
1638
|
+
|
1639
|
+
Create life.
|
1640
|
+
|
1641
|
+
Args:
|
1642
|
+
filename: set source file
|
1643
|
+
size: set video size
|
1644
|
+
rate: set video rate (default "25")
|
1645
|
+
rule: set rule (default "B3/S23")
|
1646
|
+
random_fill_ratio: set fill ratio for filling initial grid randomly (from 0 to 1) (default 0.618034)
|
1647
|
+
random_seed: set the seed for filling the initial grid randomly (from -1 to UINT32_MAX) (default -1)
|
1648
|
+
stitch: stitch boundaries (default true)
|
1649
|
+
mold: set mold speed for dead cells (from 0 to 255) (default 0)
|
1650
|
+
life_color: set life color (default "white")
|
1651
|
+
death_color: set death color (default "black")
|
1652
|
+
mold_color: set mold color (default "black")
|
1653
|
+
|
1654
|
+
Returns:
|
1655
|
+
default: the video stream
|
1656
|
+
|
1657
|
+
References:
|
1658
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#life)
|
1659
|
+
|
1660
|
+
"""
|
1661
|
+
filter_node = filter_node_factory(
|
1662
|
+
FFMpegFilterDef(name="life", typings_input=(), typings_output=("video",)),
|
1663
|
+
**{
|
1664
|
+
"filename": filename,
|
1665
|
+
"size": size,
|
1666
|
+
"rate": rate,
|
1667
|
+
"rule": rule,
|
1668
|
+
"random_fill_ratio": random_fill_ratio,
|
1669
|
+
"random_seed": random_seed,
|
1670
|
+
"stitch": stitch,
|
1671
|
+
"mold": mold,
|
1672
|
+
"life_color": life_color,
|
1673
|
+
"death_color": death_color,
|
1674
|
+
"mold_color": mold_color,
|
1675
|
+
}
|
1676
|
+
| (extra_options or {}),
|
1677
|
+
)
|
1678
|
+
return filter_node.video(0)
|
1679
|
+
|
1680
|
+
|
1681
|
+
def limitdiff(
|
1682
|
+
*streams: VideoStream,
|
1683
|
+
threshold: Float = Default(0.00392157),
|
1684
|
+
elasticity: Float = Default(2.0),
|
1685
|
+
reference: Boolean = Default(False),
|
1686
|
+
planes: Int = Default(15),
|
1687
|
+
enable: String = Default(None),
|
1688
|
+
extra_options: dict[str, Any] = None,
|
1689
|
+
) -> VideoStream:
|
1690
|
+
"""
|
1691
|
+
|
1692
|
+
Apply filtering with limiting difference.
|
1693
|
+
|
1694
|
+
Args:
|
1695
|
+
threshold: set the threshold (from 0 to 1) (default 0.00392157)
|
1696
|
+
elasticity: set the elasticity (from 0 to 10) (default 2)
|
1697
|
+
reference: enable reference stream (default false)
|
1698
|
+
planes: set the planes to filter (from 0 to 15) (default 15)
|
1699
|
+
enable: timeline editing
|
1700
|
+
|
1701
|
+
Returns:
|
1702
|
+
default: the video stream
|
1703
|
+
|
1704
|
+
References:
|
1705
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#limitdiff)
|
1706
|
+
|
1707
|
+
"""
|
1708
|
+
filter_node = filter_node_factory(
|
1709
|
+
FFMpegFilterDef(
|
1710
|
+
name="limitdiff",
|
1711
|
+
typings_input="[StreamType.video, StreamType.video] + ([StreamType.video] if reference else [])",
|
1712
|
+
typings_output=("video",),
|
1713
|
+
),
|
1714
|
+
*streams,
|
1715
|
+
**{
|
1716
|
+
"threshold": threshold,
|
1717
|
+
"elasticity": elasticity,
|
1718
|
+
"reference": reference,
|
1719
|
+
"planes": planes,
|
1720
|
+
"enable": enable,
|
1721
|
+
}
|
1722
|
+
| (extra_options or {}),
|
1723
|
+
)
|
1724
|
+
return filter_node.video(0)
|
1725
|
+
|
1726
|
+
|
1727
|
+
def mandelbrot(
|
1728
|
+
*,
|
1729
|
+
size: Image_size = Default("640x480"),
|
1730
|
+
rate: Video_rate = Default("25"),
|
1731
|
+
maxiter: Int = Default(7189),
|
1732
|
+
start_x: Double = Default(-0.743644),
|
1733
|
+
start_y: Double = Default(-0.131826),
|
1734
|
+
start_scale: Double = Default(3.0),
|
1735
|
+
end_scale: Double = Default(0.3),
|
1736
|
+
end_pts: Double = Default(400.0),
|
1737
|
+
bailout: Double = Default(10.0),
|
1738
|
+
morphxf: Double = Default(0.01),
|
1739
|
+
morphyf: Double = Default(0.0123),
|
1740
|
+
morphamp: Double = Default(0.0),
|
1741
|
+
outer: Int
|
1742
|
+
| Literal["iteration_count", "normalized_iteration_count", "white", "outz"]
|
1743
|
+
| Default = Default("normalized_iteration_count"),
|
1744
|
+
inner: Int
|
1745
|
+
| Literal["black", "period", "convergence", "mincol"]
|
1746
|
+
| Default = Default("mincol"),
|
1747
|
+
extra_options: dict[str, Any] = None,
|
1748
|
+
) -> VideoStream:
|
1749
|
+
"""
|
1750
|
+
|
1751
|
+
Render a Mandelbrot fractal.
|
1752
|
+
|
1753
|
+
Args:
|
1754
|
+
size: set frame size (default "640x480")
|
1755
|
+
rate: set frame rate (default "25")
|
1756
|
+
maxiter: set max iterations number (from 1 to INT_MAX) (default 7189)
|
1757
|
+
start_x: set the initial x position (from -100 to 100) (default -0.743644)
|
1758
|
+
start_y: set the initial y position (from -100 to 100) (default -0.131826)
|
1759
|
+
start_scale: set the initial scale value (from 0 to FLT_MAX) (default 3)
|
1760
|
+
end_scale: set the terminal scale value (from 0 to FLT_MAX) (default 0.3)
|
1761
|
+
end_pts: set the terminal pts value (from 0 to I64_MAX) (default 400)
|
1762
|
+
bailout: set the bailout value (from 0 to FLT_MAX) (default 10)
|
1763
|
+
morphxf: set morph x frequency (from -FLT_MAX to FLT_MAX) (default 0.01)
|
1764
|
+
morphyf: set morph y frequency (from -FLT_MAX to FLT_MAX) (default 0.0123)
|
1765
|
+
morphamp: set morph amplitude (from -FLT_MAX to FLT_MAX) (default 0)
|
1766
|
+
outer: set outer coloring mode (from 0 to INT_MAX) (default normalized_iteration_count)
|
1767
|
+
inner: set inner coloring mode (from 0 to INT_MAX) (default mincol)
|
1768
|
+
|
1769
|
+
Returns:
|
1770
|
+
default: the video stream
|
1771
|
+
|
1772
|
+
References:
|
1773
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#mandelbrot)
|
1774
|
+
|
1775
|
+
"""
|
1776
|
+
filter_node = filter_node_factory(
|
1777
|
+
FFMpegFilterDef(name="mandelbrot", typings_input=(), typings_output=("video",)),
|
1778
|
+
**{
|
1779
|
+
"size": size,
|
1780
|
+
"rate": rate,
|
1781
|
+
"maxiter": maxiter,
|
1782
|
+
"start_x": start_x,
|
1783
|
+
"start_y": start_y,
|
1784
|
+
"start_scale": start_scale,
|
1785
|
+
"end_scale": end_scale,
|
1786
|
+
"end_pts": end_pts,
|
1787
|
+
"bailout": bailout,
|
1788
|
+
"morphxf": morphxf,
|
1789
|
+
"morphyf": morphyf,
|
1790
|
+
"morphamp": morphamp,
|
1791
|
+
"outer": outer,
|
1792
|
+
"inner": inner,
|
1793
|
+
}
|
1794
|
+
| (extra_options or {}),
|
1795
|
+
)
|
1796
|
+
return filter_node.video(0)
|
1797
|
+
|
1798
|
+
|
1799
|
+
def mergeplanes(
|
1800
|
+
*streams: VideoStream,
|
1801
|
+
mapping: Int = Default(-1),
|
1802
|
+
format: Pix_fmt = Default("yuva444p"),
|
1803
|
+
map0s: Int = Default(0),
|
1804
|
+
map0p: Int = Default(0),
|
1805
|
+
map1s: Int = Default(0),
|
1806
|
+
map1p: Int = Default(0),
|
1807
|
+
map2s: Int = Default(0),
|
1808
|
+
map2p: Int = Default(0),
|
1809
|
+
map3s: Int = Default(0),
|
1810
|
+
map3p: Int = Default(0),
|
1811
|
+
extra_options: dict[str, Any] = None,
|
1812
|
+
) -> VideoStream:
|
1813
|
+
"""
|
1814
|
+
|
1815
|
+
Merge planes.
|
1816
|
+
|
1817
|
+
Args:
|
1818
|
+
mapping: set input to output plane mapping (from -1 to 8.58993e+08) (default -1)
|
1819
|
+
format: set output pixel format (default yuva444p)
|
1820
|
+
map0s: set 1st input to output stream mapping (from 0 to 3) (default 0)
|
1821
|
+
map0p: set 1st input to output plane mapping (from 0 to 3) (default 0)
|
1822
|
+
map1s: set 2nd input to output stream mapping (from 0 to 3) (default 0)
|
1823
|
+
map1p: set 2nd input to output plane mapping (from 0 to 3) (default 0)
|
1824
|
+
map2s: set 3rd input to output stream mapping (from 0 to 3) (default 0)
|
1825
|
+
map2p: set 3rd input to output plane mapping (from 0 to 3) (default 0)
|
1826
|
+
map3s: set 4th input to output stream mapping (from 0 to 3) (default 0)
|
1827
|
+
map3p: set 4th input to output plane mapping (from 0 to 3) (default 0)
|
1828
|
+
|
1829
|
+
Returns:
|
1830
|
+
default: the video stream
|
1831
|
+
|
1832
|
+
References:
|
1833
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#mergeplanes)
|
1834
|
+
|
1835
|
+
"""
|
1836
|
+
filter_node = filter_node_factory(
|
1837
|
+
FFMpegFilterDef(
|
1838
|
+
name="mergeplanes",
|
1839
|
+
typings_input="[StreamType.video] * int(max(hex(int(mapping))[2::2]))",
|
1840
|
+
typings_output=("video",),
|
1841
|
+
),
|
1842
|
+
*streams,
|
1843
|
+
**{
|
1844
|
+
"mapping": mapping,
|
1845
|
+
"format": format,
|
1846
|
+
"map0s": map0s,
|
1847
|
+
"map0p": map0p,
|
1848
|
+
"map1s": map1s,
|
1849
|
+
"map1p": map1p,
|
1850
|
+
"map2s": map2s,
|
1851
|
+
"map2p": map2p,
|
1852
|
+
"map3s": map3s,
|
1853
|
+
"map3p": map3p,
|
1854
|
+
}
|
1855
|
+
| (extra_options or {}),
|
1856
|
+
)
|
1857
|
+
return filter_node.video(0)
|
1858
|
+
|
1859
|
+
|
1860
|
+
def mix(
|
1861
|
+
*streams: VideoStream,
|
1862
|
+
inputs: Int = Auto("len(streams)"),
|
1863
|
+
weights: String = Default("1 1"),
|
1864
|
+
scale: Float = Default(0.0),
|
1865
|
+
planes: Flags = Default("F"),
|
1866
|
+
duration: Int | Literal["longest", "shortest", "first"] | Default = Default(
|
1867
|
+
"longest"
|
1868
|
+
),
|
1869
|
+
enable: String = Default(None),
|
1870
|
+
extra_options: dict[str, Any] = None,
|
1871
|
+
) -> VideoStream:
|
1872
|
+
"""
|
1873
|
+
|
1874
|
+
Mix video inputs.
|
1875
|
+
|
1876
|
+
Args:
|
1877
|
+
inputs: set number of inputs (from 2 to 32767) (default 2)
|
1878
|
+
weights: set weight for each input (default "1 1")
|
1879
|
+
scale: set scale (from 0 to 32767) (default 0)
|
1880
|
+
planes: set what planes to filter (default F)
|
1881
|
+
duration: how to determine end of stream (from 0 to 2) (default longest)
|
1882
|
+
enable: timeline editing
|
1883
|
+
|
1884
|
+
Returns:
|
1885
|
+
default: the video stream
|
1886
|
+
|
1887
|
+
References:
|
1888
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#mix)
|
1889
|
+
|
1890
|
+
"""
|
1891
|
+
filter_node = filter_node_factory(
|
1892
|
+
FFMpegFilterDef(
|
1893
|
+
name="mix",
|
1894
|
+
typings_input="[StreamType.video] * int(inputs)",
|
1895
|
+
typings_output=("video",),
|
1896
|
+
),
|
1897
|
+
*streams,
|
1898
|
+
**{
|
1899
|
+
"inputs": inputs,
|
1900
|
+
"weights": weights,
|
1901
|
+
"scale": scale,
|
1902
|
+
"planes": planes,
|
1903
|
+
"duration": duration,
|
1904
|
+
"enable": enable,
|
1905
|
+
}
|
1906
|
+
| (extra_options or {}),
|
1907
|
+
)
|
1908
|
+
return filter_node.video(0)
|
1909
|
+
|
1910
|
+
|
1911
|
+
def movie(
|
1912
|
+
*,
|
1913
|
+
filename: String = Default(None),
|
1914
|
+
format_name: String = Default(None),
|
1915
|
+
stream_index: Int = Default(-1),
|
1916
|
+
seek_point: Double = Default(0.0),
|
1917
|
+
streams: String = Default(None),
|
1918
|
+
loop: Int = Default(1),
|
1919
|
+
discontinuity: Duration = Default(0.0),
|
1920
|
+
dec_threads: Int = Default(0),
|
1921
|
+
format_opts: Dictionary = Default(None),
|
1922
|
+
extra_options: dict[str, Any] = None,
|
1923
|
+
) -> FilterNode:
|
1924
|
+
"""
|
1925
|
+
|
1926
|
+
Read from a movie source.
|
1927
|
+
|
1928
|
+
Args:
|
1929
|
+
filename:
|
1930
|
+
format_name: set format name
|
1931
|
+
stream_index: set stream index (from -1 to INT_MAX) (default -1)
|
1932
|
+
seek_point: set seekpoint (seconds) (from 0 to 9.22337e+12) (default 0)
|
1933
|
+
streams: set streams
|
1934
|
+
loop: set loop count (from 0 to INT_MAX) (default 1)
|
1935
|
+
discontinuity: set discontinuity threshold (default 0)
|
1936
|
+
dec_threads: set the number of threads for decoding (from 0 to INT_MAX) (default 0)
|
1937
|
+
format_opts: set format options for the opened file
|
1938
|
+
|
1939
|
+
Returns:
|
1940
|
+
filter_node: the filter node
|
1941
|
+
|
1942
|
+
|
1943
|
+
References:
|
1944
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#movie)
|
1945
|
+
|
1946
|
+
"""
|
1947
|
+
filter_node = filter_node_factory(
|
1948
|
+
FFMpegFilterDef(
|
1949
|
+
name="movie",
|
1950
|
+
typings_input="[StreamType.video] * len(streams.split('+'))",
|
1951
|
+
typings_output="[StreamType.video] * len(streams.split('+'))",
|
1952
|
+
),
|
1953
|
+
**{
|
1954
|
+
"filename": filename,
|
1955
|
+
"format_name": format_name,
|
1956
|
+
"stream_index": stream_index,
|
1957
|
+
"seek_point": seek_point,
|
1958
|
+
"streams": streams,
|
1959
|
+
"loop": loop,
|
1960
|
+
"discontinuity": discontinuity,
|
1961
|
+
"dec_threads": dec_threads,
|
1962
|
+
"format_opts": format_opts,
|
1963
|
+
}
|
1964
|
+
| (extra_options or {}),
|
1965
|
+
)
|
1966
|
+
|
1967
|
+
return filter_node
|
1968
|
+
|
1969
|
+
|
1970
|
+
def mptestsrc(
|
1971
|
+
*,
|
1972
|
+
rate: Video_rate = Default("25"),
|
1973
|
+
duration: Duration = Default(-1e-06),
|
1974
|
+
test: Int
|
1975
|
+
| Literal[
|
1976
|
+
"dc_luma",
|
1977
|
+
"dc_chroma",
|
1978
|
+
"freq_luma",
|
1979
|
+
"freq_chroma",
|
1980
|
+
"amp_luma",
|
1981
|
+
"amp_chroma",
|
1982
|
+
"cbp",
|
1983
|
+
"mv",
|
1984
|
+
"ring1",
|
1985
|
+
"ring2",
|
1986
|
+
"all",
|
1987
|
+
]
|
1988
|
+
| Default = Default("all"),
|
1989
|
+
max_frames: Int64 = Default(30),
|
1990
|
+
extra_options: dict[str, Any] = None,
|
1991
|
+
) -> VideoStream:
|
1992
|
+
"""
|
1993
|
+
|
1994
|
+
Generate various test pattern.
|
1995
|
+
|
1996
|
+
Args:
|
1997
|
+
rate: set video rate (default "25")
|
1998
|
+
duration: set video duration (default -0.000001)
|
1999
|
+
test: set test to perform (from 0 to INT_MAX) (default all)
|
2000
|
+
max_frames: Set the maximum number of frames generated for each test (from 1 to I64_MAX) (default 30)
|
2001
|
+
|
2002
|
+
Returns:
|
2003
|
+
default: the video stream
|
2004
|
+
|
2005
|
+
References:
|
2006
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#mptestsrc)
|
2007
|
+
|
2008
|
+
"""
|
2009
|
+
filter_node = filter_node_factory(
|
2010
|
+
FFMpegFilterDef(name="mptestsrc", typings_input=(), typings_output=("video",)),
|
2011
|
+
**{
|
2012
|
+
"rate": rate,
|
2013
|
+
"duration": duration,
|
2014
|
+
"test": test,
|
2015
|
+
"max_frames": max_frames,
|
2016
|
+
}
|
2017
|
+
| (extra_options or {}),
|
2018
|
+
)
|
2019
|
+
return filter_node.video(0)
|
2020
|
+
|
2021
|
+
|
2022
|
+
def nullsrc(
|
2023
|
+
*,
|
2024
|
+
size: Image_size = Default("320x240"),
|
2025
|
+
rate: Video_rate = Default("25"),
|
2026
|
+
duration: Duration = Default(-1e-06),
|
2027
|
+
sar: Rational = Default("1/1"),
|
2028
|
+
extra_options: dict[str, Any] = None,
|
2029
|
+
) -> VideoStream:
|
2030
|
+
"""
|
2031
|
+
|
2032
|
+
Null video source, return unprocessed video frames.
|
2033
|
+
|
2034
|
+
Args:
|
2035
|
+
size: set video size (default "320x240")
|
2036
|
+
rate: set video rate (default "25")
|
2037
|
+
duration: set video duration (default -0.000001)
|
2038
|
+
sar: set video sample aspect ratio (from 0 to INT_MAX) (default 1/1)
|
2039
|
+
|
2040
|
+
Returns:
|
2041
|
+
default: the video stream
|
2042
|
+
|
2043
|
+
References:
|
2044
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#allrgb_002c-allyuv_002c-color_002c-colorchart_002c-colorspectrum_002c-haldclutsrc_002c-nullsrc_002c-pal75bars_002c-pal100bars_002c-rgbtestsrc_002c-smptebars_002c-smptehdbars_002c-testsrc_002c-testsrc2_002c-yuvtestsrc)
|
2045
|
+
|
2046
|
+
"""
|
2047
|
+
filter_node = filter_node_factory(
|
2048
|
+
FFMpegFilterDef(name="nullsrc", typings_input=(), typings_output=("video",)),
|
2049
|
+
**{
|
2050
|
+
"size": size,
|
2051
|
+
"rate": rate,
|
2052
|
+
"duration": duration,
|
2053
|
+
"sar": sar,
|
2054
|
+
}
|
2055
|
+
| (extra_options or {}),
|
2056
|
+
)
|
2057
|
+
return filter_node.video(0)
|
2058
|
+
|
2059
|
+
|
2060
|
+
def pal100bars(
|
2061
|
+
*,
|
2062
|
+
size: Image_size = Default("320x240"),
|
2063
|
+
rate: Video_rate = Default("25"),
|
2064
|
+
duration: Duration = Default(-1e-06),
|
2065
|
+
sar: Rational = Default("1/1"),
|
2066
|
+
extra_options: dict[str, Any] = None,
|
2067
|
+
) -> VideoStream:
|
2068
|
+
"""
|
2069
|
+
|
2070
|
+
Generate PAL 100% color bars.
|
2071
|
+
|
2072
|
+
Args:
|
2073
|
+
size: set video size (default "320x240")
|
2074
|
+
rate: set video rate (default "25")
|
2075
|
+
duration: set video duration (default -0.000001)
|
2076
|
+
sar: set video sample aspect ratio (from 0 to INT_MAX) (default 1/1)
|
2077
|
+
|
2078
|
+
Returns:
|
2079
|
+
default: the video stream
|
2080
|
+
|
2081
|
+
References:
|
2082
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#allrgb_002c-allyuv_002c-color_002c-colorchart_002c-colorspectrum_002c-haldclutsrc_002c-nullsrc_002c-pal75bars_002c-pal100bars_002c-rgbtestsrc_002c-smptebars_002c-smptehdbars_002c-testsrc_002c-testsrc2_002c-yuvtestsrc)
|
2083
|
+
|
2084
|
+
"""
|
2085
|
+
filter_node = filter_node_factory(
|
2086
|
+
FFMpegFilterDef(name="pal100bars", typings_input=(), typings_output=("video",)),
|
2087
|
+
**{
|
2088
|
+
"size": size,
|
2089
|
+
"rate": rate,
|
2090
|
+
"duration": duration,
|
2091
|
+
"sar": sar,
|
2092
|
+
}
|
2093
|
+
| (extra_options or {}),
|
2094
|
+
)
|
2095
|
+
return filter_node.video(0)
|
2096
|
+
|
2097
|
+
|
2098
|
+
def pal75bars(
|
2099
|
+
*,
|
2100
|
+
size: Image_size = Default("320x240"),
|
2101
|
+
rate: Video_rate = Default("25"),
|
2102
|
+
duration: Duration = Default(-1e-06),
|
2103
|
+
sar: Rational = Default("1/1"),
|
2104
|
+
extra_options: dict[str, Any] = None,
|
2105
|
+
) -> VideoStream:
|
2106
|
+
"""
|
2107
|
+
|
2108
|
+
Generate PAL 75% color bars.
|
2109
|
+
|
2110
|
+
Args:
|
2111
|
+
size: set video size (default "320x240")
|
2112
|
+
rate: set video rate (default "25")
|
2113
|
+
duration: set video duration (default -0.000001)
|
2114
|
+
sar: set video sample aspect ratio (from 0 to INT_MAX) (default 1/1)
|
2115
|
+
|
2116
|
+
Returns:
|
2117
|
+
default: the video stream
|
2118
|
+
|
2119
|
+
References:
|
2120
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#allrgb_002c-allyuv_002c-color_002c-colorchart_002c-colorspectrum_002c-haldclutsrc_002c-nullsrc_002c-pal75bars_002c-pal100bars_002c-rgbtestsrc_002c-smptebars_002c-smptehdbars_002c-testsrc_002c-testsrc2_002c-yuvtestsrc)
|
2121
|
+
|
2122
|
+
"""
|
2123
|
+
filter_node = filter_node_factory(
|
2124
|
+
FFMpegFilterDef(name="pal75bars", typings_input=(), typings_output=("video",)),
|
2125
|
+
**{
|
2126
|
+
"size": size,
|
2127
|
+
"rate": rate,
|
2128
|
+
"duration": duration,
|
2129
|
+
"sar": sar,
|
2130
|
+
}
|
2131
|
+
| (extra_options or {}),
|
2132
|
+
)
|
2133
|
+
return filter_node.video(0)
|
2134
|
+
|
2135
|
+
|
2136
|
+
def premultiply(
|
2137
|
+
*streams: VideoStream,
|
2138
|
+
planes: Int = Default(15),
|
2139
|
+
inplace: Boolean = Default(False),
|
2140
|
+
enable: String = Default(None),
|
2141
|
+
extra_options: dict[str, Any] = None,
|
2142
|
+
) -> VideoStream:
|
2143
|
+
"""
|
2144
|
+
|
2145
|
+
PreMultiply first stream with first plane of second stream.
|
2146
|
+
|
2147
|
+
Args:
|
2148
|
+
planes: set planes (from 0 to 15) (default 15)
|
2149
|
+
inplace: enable inplace mode (default false)
|
2150
|
+
enable: timeline editing
|
2151
|
+
|
2152
|
+
Returns:
|
2153
|
+
default: the video stream
|
2154
|
+
|
2155
|
+
References:
|
2156
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#premultiply)
|
2157
|
+
|
2158
|
+
"""
|
2159
|
+
filter_node = filter_node_factory(
|
2160
|
+
FFMpegFilterDef(
|
2161
|
+
name="premultiply",
|
2162
|
+
typings_input="[StreamType.video] + [StreamType.video] if inplace else []",
|
2163
|
+
typings_output=("video",),
|
2164
|
+
),
|
2165
|
+
*streams,
|
2166
|
+
**{
|
2167
|
+
"planes": planes,
|
2168
|
+
"inplace": inplace,
|
2169
|
+
"enable": enable,
|
2170
|
+
}
|
2171
|
+
| (extra_options or {}),
|
2172
|
+
)
|
2173
|
+
return filter_node.video(0)
|
2174
|
+
|
2175
|
+
|
2176
|
+
def rgbtestsrc(
|
2177
|
+
*,
|
2178
|
+
size: Image_size = Default("320x240"),
|
2179
|
+
rate: Video_rate = Default("25"),
|
2180
|
+
duration: Duration = Default(-1e-06),
|
2181
|
+
sar: Rational = Default("1/1"),
|
2182
|
+
complement: Boolean = Default(False),
|
2183
|
+
extra_options: dict[str, Any] = None,
|
2184
|
+
) -> VideoStream:
|
2185
|
+
"""
|
2186
|
+
|
2187
|
+
Generate RGB test pattern.
|
2188
|
+
|
2189
|
+
Args:
|
2190
|
+
size: set video size (default "320x240")
|
2191
|
+
rate: set video rate (default "25")
|
2192
|
+
duration: set video duration (default -0.000001)
|
2193
|
+
sar: set video sample aspect ratio (from 0 to INT_MAX) (default 1/1)
|
2194
|
+
complement: set complement colors (default false)
|
2195
|
+
|
2196
|
+
Returns:
|
2197
|
+
default: the video stream
|
2198
|
+
|
2199
|
+
References:
|
2200
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#allrgb_002c-allyuv_002c-color_002c-colorchart_002c-colorspectrum_002c-haldclutsrc_002c-nullsrc_002c-pal75bars_002c-pal100bars_002c-rgbtestsrc_002c-smptebars_002c-smptehdbars_002c-testsrc_002c-testsrc2_002c-yuvtestsrc)
|
2201
|
+
|
2202
|
+
"""
|
2203
|
+
filter_node = filter_node_factory(
|
2204
|
+
FFMpegFilterDef(name="rgbtestsrc", typings_input=(), typings_output=("video",)),
|
2205
|
+
**{
|
2206
|
+
"size": size,
|
2207
|
+
"rate": rate,
|
2208
|
+
"duration": duration,
|
2209
|
+
"sar": sar,
|
2210
|
+
"complement": complement,
|
2211
|
+
}
|
2212
|
+
| (extra_options or {}),
|
2213
|
+
)
|
2214
|
+
return filter_node.video(0)
|
2215
|
+
|
2216
|
+
|
2217
|
+
def sierpinski(
|
2218
|
+
*,
|
2219
|
+
size: Image_size = Default("640x480"),
|
2220
|
+
rate: Video_rate = Default("25"),
|
2221
|
+
seed: Int64 = Default(-1),
|
2222
|
+
jump: Int = Default(100),
|
2223
|
+
type: Int | Literal["carpet", "triangle"] | Default = Default("carpet"),
|
2224
|
+
extra_options: dict[str, Any] = None,
|
2225
|
+
) -> VideoStream:
|
2226
|
+
"""
|
2227
|
+
|
2228
|
+
Render a Sierpinski fractal.
|
2229
|
+
|
2230
|
+
Args:
|
2231
|
+
size: set frame size (default "640x480")
|
2232
|
+
rate: set frame rate (default "25")
|
2233
|
+
seed: set the seed (from -1 to UINT32_MAX) (default -1)
|
2234
|
+
jump: set the jump (from 1 to 10000) (default 100)
|
2235
|
+
type: set fractal type (from 0 to 1) (default carpet)
|
2236
|
+
|
2237
|
+
Returns:
|
2238
|
+
default: the video stream
|
2239
|
+
|
2240
|
+
References:
|
2241
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#sierpinski)
|
2242
|
+
|
2243
|
+
"""
|
2244
|
+
filter_node = filter_node_factory(
|
2245
|
+
FFMpegFilterDef(name="sierpinski", typings_input=(), typings_output=("video",)),
|
2246
|
+
**{
|
2247
|
+
"size": size,
|
2248
|
+
"rate": rate,
|
2249
|
+
"seed": seed,
|
2250
|
+
"jump": jump,
|
2251
|
+
"type": type,
|
2252
|
+
}
|
2253
|
+
| (extra_options or {}),
|
2254
|
+
)
|
2255
|
+
return filter_node.video(0)
|
2256
|
+
|
2257
|
+
|
2258
|
+
def signature(
|
2259
|
+
*streams: VideoStream,
|
2260
|
+
detectmode: Int | Literal["off", "full", "fast"] | Default = Default("off"),
|
2261
|
+
nb_inputs: Int = Auto("len(streams)"),
|
2262
|
+
filename: String = Default(""),
|
2263
|
+
format: Int | Literal["binary", "xml"] | Default = Default("binary"),
|
2264
|
+
th_d: Int = Default(9000),
|
2265
|
+
th_dc: Int = Default(60000),
|
2266
|
+
th_xh: Int = Default(116),
|
2267
|
+
th_di: Int = Default(0),
|
2268
|
+
th_it: Double = Default(0.5),
|
2269
|
+
extra_options: dict[str, Any] = None,
|
2270
|
+
) -> VideoStream:
|
2271
|
+
"""
|
2272
|
+
|
2273
|
+
Calculate the MPEG-7 video signature
|
2274
|
+
|
2275
|
+
Args:
|
2276
|
+
detectmode: set the detectmode (from 0 to 2) (default off)
|
2277
|
+
nb_inputs: number of inputs (from 1 to INT_MAX) (default 1)
|
2278
|
+
filename: filename for output files (default "")
|
2279
|
+
format: set output format (from 0 to 1) (default binary)
|
2280
|
+
th_d: threshold to detect one word as similar (from 1 to INT_MAX) (default 9000)
|
2281
|
+
th_dc: threshold to detect all words as similar (from 1 to INT_MAX) (default 60000)
|
2282
|
+
th_xh: threshold to detect frames as similar (from 1 to INT_MAX) (default 116)
|
2283
|
+
th_di: minimum length of matching sequence in frames (from 0 to INT_MAX) (default 0)
|
2284
|
+
th_it: threshold for relation of good to all frames (from 0 to 1) (default 0.5)
|
2285
|
+
|
2286
|
+
Returns:
|
2287
|
+
default: the video stream
|
2288
|
+
|
2289
|
+
References:
|
2290
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#signature)
|
2291
|
+
|
2292
|
+
"""
|
2293
|
+
filter_node = filter_node_factory(
|
2294
|
+
FFMpegFilterDef(
|
2295
|
+
name="signature",
|
2296
|
+
typings_input="[StreamType.video] * int(nb_inputs)",
|
2297
|
+
typings_output=("video",),
|
2298
|
+
),
|
2299
|
+
*streams,
|
2300
|
+
**{
|
2301
|
+
"detectmode": detectmode,
|
2302
|
+
"nb_inputs": nb_inputs,
|
2303
|
+
"filename": filename,
|
2304
|
+
"format": format,
|
2305
|
+
"th_d": th_d,
|
2306
|
+
"th_dc": th_dc,
|
2307
|
+
"th_xh": th_xh,
|
2308
|
+
"th_di": th_di,
|
2309
|
+
"th_it": th_it,
|
2310
|
+
}
|
2311
|
+
| (extra_options or {}),
|
2312
|
+
)
|
2313
|
+
return filter_node.video(0)
|
2314
|
+
|
2315
|
+
|
2316
|
+
def sinc(
|
2317
|
+
*,
|
2318
|
+
sample_rate: Int = Default(44100),
|
2319
|
+
nb_samples: Int = Default(1024),
|
2320
|
+
hp: Float = Default(0.0),
|
2321
|
+
lp: Float = Default(0.0),
|
2322
|
+
phase: Float = Default(50.0),
|
2323
|
+
beta: Float = Default(-1.0),
|
2324
|
+
att: Float = Default(120.0),
|
2325
|
+
round: Boolean = Default(False),
|
2326
|
+
hptaps: Int = Default(0),
|
2327
|
+
lptaps: Int = Default(0),
|
2328
|
+
extra_options: dict[str, Any] = None,
|
2329
|
+
) -> AudioStream:
|
2330
|
+
"""
|
2331
|
+
|
2332
|
+
Generate a sinc kaiser-windowed low-pass, high-pass, band-pass, or band-reject FIR coefficients.
|
2333
|
+
|
2334
|
+
Args:
|
2335
|
+
sample_rate: set sample rate (from 1 to INT_MAX) (default 44100)
|
2336
|
+
nb_samples: set the number of samples per requested frame (from 1 to INT_MAX) (default 1024)
|
2337
|
+
hp: set high-pass filter frequency (from 0 to INT_MAX) (default 0)
|
2338
|
+
lp: set low-pass filter frequency (from 0 to INT_MAX) (default 0)
|
2339
|
+
phase: set filter phase response (from 0 to 100) (default 50)
|
2340
|
+
beta: set kaiser window beta (from -1 to 256) (default -1)
|
2341
|
+
att: set stop-band attenuation (from 40 to 180) (default 120)
|
2342
|
+
round: enable rounding (default false)
|
2343
|
+
hptaps: set number of taps for high-pass filter (from 0 to 32768) (default 0)
|
2344
|
+
lptaps: set number of taps for low-pass filter (from 0 to 32768) (default 0)
|
2345
|
+
|
2346
|
+
Returns:
|
2347
|
+
default: the audio stream
|
2348
|
+
|
2349
|
+
References:
|
2350
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#sinc)
|
2351
|
+
|
2352
|
+
"""
|
2353
|
+
filter_node = filter_node_factory(
|
2354
|
+
FFMpegFilterDef(name="sinc", typings_input=(), typings_output=("audio",)),
|
2355
|
+
**{
|
2356
|
+
"sample_rate": sample_rate,
|
2357
|
+
"nb_samples": nb_samples,
|
2358
|
+
"hp": hp,
|
2359
|
+
"lp": lp,
|
2360
|
+
"phase": phase,
|
2361
|
+
"beta": beta,
|
2362
|
+
"att": att,
|
2363
|
+
"round": round,
|
2364
|
+
"hptaps": hptaps,
|
2365
|
+
"lptaps": lptaps,
|
2366
|
+
}
|
2367
|
+
| (extra_options or {}),
|
2368
|
+
)
|
2369
|
+
return filter_node.audio(0)
|
2370
|
+
|
2371
|
+
|
2372
|
+
def sine(
|
2373
|
+
*,
|
2374
|
+
frequency: Double = Default(440.0),
|
2375
|
+
beep_factor: Double = Default(0.0),
|
2376
|
+
sample_rate: Int = Default(44100),
|
2377
|
+
duration: Duration = Default(0.0),
|
2378
|
+
samples_per_frame: String = Default("1024"),
|
2379
|
+
extra_options: dict[str, Any] = None,
|
2380
|
+
) -> AudioStream:
|
2381
|
+
"""
|
2382
|
+
|
2383
|
+
Generate sine wave audio signal.
|
2384
|
+
|
2385
|
+
Args:
|
2386
|
+
frequency: set the sine frequency (from 0 to DBL_MAX) (default 440)
|
2387
|
+
beep_factor: set the beep frequency factor (from 0 to DBL_MAX) (default 0)
|
2388
|
+
sample_rate: set the sample rate (from 1 to INT_MAX) (default 44100)
|
2389
|
+
duration: set the audio duration (default 0)
|
2390
|
+
samples_per_frame: set the number of samples per frame (default "1024")
|
2391
|
+
|
2392
|
+
Returns:
|
2393
|
+
default: the audio stream
|
2394
|
+
|
2395
|
+
References:
|
2396
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#sine)
|
2397
|
+
|
2398
|
+
"""
|
2399
|
+
filter_node = filter_node_factory(
|
2400
|
+
FFMpegFilterDef(name="sine", typings_input=(), typings_output=("audio",)),
|
2401
|
+
**{
|
2402
|
+
"frequency": frequency,
|
2403
|
+
"beep_factor": beep_factor,
|
2404
|
+
"sample_rate": sample_rate,
|
2405
|
+
"duration": duration,
|
2406
|
+
"samples_per_frame": samples_per_frame,
|
2407
|
+
}
|
2408
|
+
| (extra_options or {}),
|
2409
|
+
)
|
2410
|
+
return filter_node.audio(0)
|
2411
|
+
|
2412
|
+
|
2413
|
+
def smptebars(
|
2414
|
+
*,
|
2415
|
+
size: Image_size = Default("320x240"),
|
2416
|
+
rate: Video_rate = Default("25"),
|
2417
|
+
duration: Duration = Default(-1e-06),
|
2418
|
+
sar: Rational = Default("1/1"),
|
2419
|
+
extra_options: dict[str, Any] = None,
|
2420
|
+
) -> VideoStream:
|
2421
|
+
"""
|
2422
|
+
|
2423
|
+
Generate SMPTE color bars.
|
2424
|
+
|
2425
|
+
Args:
|
2426
|
+
size: set video size (default "320x240")
|
2427
|
+
rate: set video rate (default "25")
|
2428
|
+
duration: set video duration (default -0.000001)
|
2429
|
+
sar: set video sample aspect ratio (from 0 to INT_MAX) (default 1/1)
|
2430
|
+
|
2431
|
+
Returns:
|
2432
|
+
default: the video stream
|
2433
|
+
|
2434
|
+
References:
|
2435
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#allrgb_002c-allyuv_002c-color_002c-colorchart_002c-colorspectrum_002c-haldclutsrc_002c-nullsrc_002c-pal75bars_002c-pal100bars_002c-rgbtestsrc_002c-smptebars_002c-smptehdbars_002c-testsrc_002c-testsrc2_002c-yuvtestsrc)
|
2436
|
+
|
2437
|
+
"""
|
2438
|
+
filter_node = filter_node_factory(
|
2439
|
+
FFMpegFilterDef(name="smptebars", typings_input=(), typings_output=("video",)),
|
2440
|
+
**{
|
2441
|
+
"size": size,
|
2442
|
+
"rate": rate,
|
2443
|
+
"duration": duration,
|
2444
|
+
"sar": sar,
|
2445
|
+
}
|
2446
|
+
| (extra_options or {}),
|
2447
|
+
)
|
2448
|
+
return filter_node.video(0)
|
2449
|
+
|
2450
|
+
|
2451
|
+
def smptehdbars(
|
2452
|
+
*,
|
2453
|
+
size: Image_size = Default("320x240"),
|
2454
|
+
rate: Video_rate = Default("25"),
|
2455
|
+
duration: Duration = Default(-1e-06),
|
2456
|
+
sar: Rational = Default("1/1"),
|
2457
|
+
extra_options: dict[str, Any] = None,
|
2458
|
+
) -> VideoStream:
|
2459
|
+
"""
|
2460
|
+
|
2461
|
+
Generate SMPTE HD color bars.
|
2462
|
+
|
2463
|
+
Args:
|
2464
|
+
size: set video size (default "320x240")
|
2465
|
+
rate: set video rate (default "25")
|
2466
|
+
duration: set video duration (default -0.000001)
|
2467
|
+
sar: set video sample aspect ratio (from 0 to INT_MAX) (default 1/1)
|
2468
|
+
|
2469
|
+
Returns:
|
2470
|
+
default: the video stream
|
2471
|
+
|
2472
|
+
References:
|
2473
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#allrgb_002c-allyuv_002c-color_002c-colorchart_002c-colorspectrum_002c-haldclutsrc_002c-nullsrc_002c-pal75bars_002c-pal100bars_002c-rgbtestsrc_002c-smptebars_002c-smptehdbars_002c-testsrc_002c-testsrc2_002c-yuvtestsrc)
|
2474
|
+
|
2475
|
+
"""
|
2476
|
+
filter_node = filter_node_factory(
|
2477
|
+
FFMpegFilterDef(
|
2478
|
+
name="smptehdbars", typings_input=(), typings_output=("video",)
|
2479
|
+
),
|
2480
|
+
**{
|
2481
|
+
"size": size,
|
2482
|
+
"rate": rate,
|
2483
|
+
"duration": duration,
|
2484
|
+
"sar": sar,
|
2485
|
+
}
|
2486
|
+
| (extra_options or {}),
|
2487
|
+
)
|
2488
|
+
return filter_node.video(0)
|
2489
|
+
|
2490
|
+
|
2491
|
+
def streamselect(
|
2492
|
+
*streams: VideoStream,
|
2493
|
+
inputs: Int = Auto("len(streams)"),
|
2494
|
+
map: String = Default(None),
|
2495
|
+
extra_options: dict[str, Any] = None,
|
2496
|
+
) -> FilterNode:
|
2497
|
+
"""
|
2498
|
+
|
2499
|
+
Select video streams
|
2500
|
+
|
2501
|
+
Args:
|
2502
|
+
inputs: number of input streams (from 2 to INT_MAX) (default 2)
|
2503
|
+
map: input indexes to remap to outputs
|
2504
|
+
|
2505
|
+
Returns:
|
2506
|
+
filter_node: the filter node
|
2507
|
+
|
2508
|
+
|
2509
|
+
References:
|
2510
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#streamselect_002c-astreamselect)
|
2511
|
+
|
2512
|
+
"""
|
2513
|
+
filter_node = filter_node_factory(
|
2514
|
+
FFMpegFilterDef(
|
2515
|
+
name="streamselect",
|
2516
|
+
typings_input="[StreamType.video] * int(inputs)",
|
2517
|
+
typings_output="[StreamType.video] * len(re.findall(r'\\d+', str(map)))",
|
2518
|
+
),
|
2519
|
+
*streams,
|
2520
|
+
**{
|
2521
|
+
"inputs": inputs,
|
2522
|
+
"map": map,
|
2523
|
+
}
|
2524
|
+
| (extra_options or {}),
|
2525
|
+
)
|
2526
|
+
|
2527
|
+
return filter_node
|
2528
|
+
|
2529
|
+
|
2530
|
+
def testsrc(
|
2531
|
+
*,
|
2532
|
+
size: Image_size = Default("320x240"),
|
2533
|
+
rate: Video_rate = Default("25"),
|
2534
|
+
duration: Duration = Default(-1e-06),
|
2535
|
+
sar: Rational = Default("1/1"),
|
2536
|
+
decimals: Int = Default(0),
|
2537
|
+
extra_options: dict[str, Any] = None,
|
2538
|
+
) -> VideoStream:
|
2539
|
+
"""
|
2540
|
+
|
2541
|
+
Generate test pattern.
|
2542
|
+
|
2543
|
+
Args:
|
2544
|
+
size: set video size (default "320x240")
|
2545
|
+
rate: set video rate (default "25")
|
2546
|
+
duration: set video duration (default -0.000001)
|
2547
|
+
sar: set video sample aspect ratio (from 0 to INT_MAX) (default 1/1)
|
2548
|
+
decimals: set number of decimals to show (from 0 to 17) (default 0)
|
2549
|
+
|
2550
|
+
Returns:
|
2551
|
+
default: the video stream
|
2552
|
+
|
2553
|
+
References:
|
2554
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#allrgb_002c-allyuv_002c-color_002c-colorchart_002c-colorspectrum_002c-haldclutsrc_002c-nullsrc_002c-pal75bars_002c-pal100bars_002c-rgbtestsrc_002c-smptebars_002c-smptehdbars_002c-testsrc_002c-testsrc2_002c-yuvtestsrc)
|
2555
|
+
|
2556
|
+
"""
|
2557
|
+
filter_node = filter_node_factory(
|
2558
|
+
FFMpegFilterDef(name="testsrc", typings_input=(), typings_output=("video",)),
|
2559
|
+
**{
|
2560
|
+
"size": size,
|
2561
|
+
"rate": rate,
|
2562
|
+
"duration": duration,
|
2563
|
+
"sar": sar,
|
2564
|
+
"decimals": decimals,
|
2565
|
+
}
|
2566
|
+
| (extra_options or {}),
|
2567
|
+
)
|
2568
|
+
return filter_node.video(0)
|
2569
|
+
|
2570
|
+
|
2571
|
+
def testsrc2(
|
2572
|
+
*,
|
2573
|
+
size: Image_size = Default("320x240"),
|
2574
|
+
rate: Video_rate = Default("25"),
|
2575
|
+
duration: Duration = Default(-1e-06),
|
2576
|
+
sar: Rational = Default("1/1"),
|
2577
|
+
alpha: Int = Default(255),
|
2578
|
+
extra_options: dict[str, Any] = None,
|
2579
|
+
) -> VideoStream:
|
2580
|
+
"""
|
2581
|
+
|
2582
|
+
Generate another test pattern.
|
2583
|
+
|
2584
|
+
Args:
|
2585
|
+
size: set video size (default "320x240")
|
2586
|
+
rate: set video rate (default "25")
|
2587
|
+
duration: set video duration (default -0.000001)
|
2588
|
+
sar: set video sample aspect ratio (from 0 to INT_MAX) (default 1/1)
|
2589
|
+
alpha: set global alpha (opacity) (from 0 to 255) (default 255)
|
2590
|
+
|
2591
|
+
Returns:
|
2592
|
+
default: the video stream
|
2593
|
+
|
2594
|
+
References:
|
2595
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#allrgb_002c-allyuv_002c-color_002c-colorchart_002c-colorspectrum_002c-haldclutsrc_002c-nullsrc_002c-pal75bars_002c-pal100bars_002c-rgbtestsrc_002c-smptebars_002c-smptehdbars_002c-testsrc_002c-testsrc2_002c-yuvtestsrc)
|
2596
|
+
|
2597
|
+
"""
|
2598
|
+
filter_node = filter_node_factory(
|
2599
|
+
FFMpegFilterDef(name="testsrc2", typings_input=(), typings_output=("video",)),
|
2600
|
+
**{
|
2601
|
+
"size": size,
|
2602
|
+
"rate": rate,
|
2603
|
+
"duration": duration,
|
2604
|
+
"sar": sar,
|
2605
|
+
"alpha": alpha,
|
2606
|
+
}
|
2607
|
+
| (extra_options or {}),
|
2608
|
+
)
|
2609
|
+
return filter_node.video(0)
|
2610
|
+
|
2611
|
+
|
2612
|
+
def unpremultiply(
|
2613
|
+
*streams: VideoStream,
|
2614
|
+
planes: Int = Default(15),
|
2615
|
+
inplace: Boolean = Default(False),
|
2616
|
+
enable: String = Default(None),
|
2617
|
+
extra_options: dict[str, Any] = None,
|
2618
|
+
) -> VideoStream:
|
2619
|
+
"""
|
2620
|
+
|
2621
|
+
UnPreMultiply first stream with first plane of second stream.
|
2622
|
+
|
2623
|
+
Args:
|
2624
|
+
planes: set planes (from 0 to 15) (default 15)
|
2625
|
+
inplace: enable inplace mode (default false)
|
2626
|
+
enable: timeline editing
|
2627
|
+
|
2628
|
+
Returns:
|
2629
|
+
default: the video stream
|
2630
|
+
|
2631
|
+
References:
|
2632
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#unpremultiply)
|
2633
|
+
|
2634
|
+
"""
|
2635
|
+
filter_node = filter_node_factory(
|
2636
|
+
FFMpegFilterDef(
|
2637
|
+
name="unpremultiply",
|
2638
|
+
typings_input="[StreamType.video] + ([StreamType.video] if inplace else [])",
|
2639
|
+
typings_output=("video",),
|
2640
|
+
),
|
2641
|
+
*streams,
|
2642
|
+
**{
|
2643
|
+
"planes": planes,
|
2644
|
+
"inplace": inplace,
|
2645
|
+
"enable": enable,
|
2646
|
+
}
|
2647
|
+
| (extra_options or {}),
|
2648
|
+
)
|
2649
|
+
return filter_node.video(0)
|
2650
|
+
|
2651
|
+
|
2652
|
+
def vstack(
|
2653
|
+
*streams: VideoStream,
|
2654
|
+
inputs: Int = Auto("len(streams)"),
|
2655
|
+
shortest: Boolean = Default(False),
|
2656
|
+
extra_options: dict[str, Any] = None,
|
2657
|
+
) -> VideoStream:
|
2658
|
+
"""
|
2659
|
+
|
2660
|
+
Stack video inputs vertically.
|
2661
|
+
|
2662
|
+
Args:
|
2663
|
+
inputs: set number of inputs (from 2 to INT_MAX) (default 2)
|
2664
|
+
shortest: force termination when the shortest input terminates (default false)
|
2665
|
+
|
2666
|
+
Returns:
|
2667
|
+
default: the video stream
|
2668
|
+
|
2669
|
+
References:
|
2670
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#vstack)
|
2671
|
+
|
2672
|
+
"""
|
2673
|
+
filter_node = filter_node_factory(
|
2674
|
+
FFMpegFilterDef(
|
2675
|
+
name="vstack",
|
2676
|
+
typings_input="[StreamType.video] * int(inputs)",
|
2677
|
+
typings_output=("video",),
|
2678
|
+
),
|
2679
|
+
*streams,
|
2680
|
+
**{
|
2681
|
+
"inputs": inputs,
|
2682
|
+
"shortest": shortest,
|
2683
|
+
}
|
2684
|
+
| (extra_options or {}),
|
2685
|
+
)
|
2686
|
+
return filter_node.video(0)
|
2687
|
+
|
2688
|
+
|
2689
|
+
def xmedian(
|
2690
|
+
*streams: VideoStream,
|
2691
|
+
inputs: Int = Auto("len(streams)"),
|
2692
|
+
planes: Int = Default(15),
|
2693
|
+
percentile: Float = Default(0.5),
|
2694
|
+
eof_action: Int | Literal["repeat", "endall", "pass"] | Default = Default("repeat"),
|
2695
|
+
shortest: Boolean = Default(False),
|
2696
|
+
repeatlast: Boolean = Default(True),
|
2697
|
+
ts_sync_mode: Int | Literal["default", "nearest"] | Default = Default("default"),
|
2698
|
+
enable: String = Default(None),
|
2699
|
+
extra_options: dict[str, Any] = None,
|
2700
|
+
) -> VideoStream:
|
2701
|
+
"""
|
2702
|
+
|
2703
|
+
Pick median pixels from several video inputs.
|
2704
|
+
|
2705
|
+
Args:
|
2706
|
+
inputs: set number of inputs (from 3 to 255) (default 3)
|
2707
|
+
planes: set planes to filter (from 0 to 15) (default 15)
|
2708
|
+
percentile: set percentile (from 0 to 1) (default 0.5)
|
2709
|
+
eof_action: Action to take when encountering EOF from secondary input (from 0 to 2) (default repeat)
|
2710
|
+
shortest: force termination when the shortest input terminates (default false)
|
2711
|
+
repeatlast: extend last frame of secondary streams beyond EOF (default true)
|
2712
|
+
ts_sync_mode: How strictly to sync streams based on secondary input timestamps (from 0 to 1) (default default)
|
2713
|
+
enable: timeline editing
|
2714
|
+
|
2715
|
+
Returns:
|
2716
|
+
default: the video stream
|
2717
|
+
|
2718
|
+
References:
|
2719
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#xmedian)
|
2720
|
+
|
2721
|
+
"""
|
2722
|
+
filter_node = filter_node_factory(
|
2723
|
+
FFMpegFilterDef(
|
2724
|
+
name="xmedian",
|
2725
|
+
typings_input="[StreamType.video] * int(inputs)",
|
2726
|
+
typings_output=("video",),
|
2727
|
+
),
|
2728
|
+
*streams,
|
2729
|
+
**{
|
2730
|
+
"inputs": inputs,
|
2731
|
+
"planes": planes,
|
2732
|
+
"percentile": percentile,
|
2733
|
+
"eof_action": eof_action,
|
2734
|
+
"shortest": shortest,
|
2735
|
+
"repeatlast": repeatlast,
|
2736
|
+
"ts_sync_mode": ts_sync_mode,
|
2737
|
+
"enable": enable,
|
2738
|
+
}
|
2739
|
+
| (extra_options or {}),
|
2740
|
+
)
|
2741
|
+
return filter_node.video(0)
|
2742
|
+
|
2743
|
+
|
2744
|
+
def xstack(
|
2745
|
+
*streams: VideoStream,
|
2746
|
+
inputs: Int = Auto("len(streams)"),
|
2747
|
+
layout: String = Default(None),
|
2748
|
+
grid: Image_size = Default(None),
|
2749
|
+
shortest: Boolean = Default(False),
|
2750
|
+
fill: String = Default("none"),
|
2751
|
+
extra_options: dict[str, Any] = None,
|
2752
|
+
) -> VideoStream:
|
2753
|
+
"""
|
2754
|
+
|
2755
|
+
Stack video inputs into custom layout.
|
2756
|
+
|
2757
|
+
Args:
|
2758
|
+
inputs: set number of inputs (from 2 to INT_MAX) (default 2)
|
2759
|
+
layout: set custom layout
|
2760
|
+
grid: set fixed size grid layout
|
2761
|
+
shortest: force termination when the shortest input terminates (default false)
|
2762
|
+
fill: set the color for unused pixels (default "none")
|
2763
|
+
|
2764
|
+
Returns:
|
2765
|
+
default: the video stream
|
2766
|
+
|
2767
|
+
References:
|
2768
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#xstack)
|
2769
|
+
|
2770
|
+
"""
|
2771
|
+
filter_node = filter_node_factory(
|
2772
|
+
FFMpegFilterDef(
|
2773
|
+
name="xstack",
|
2774
|
+
typings_input="[StreamType.video] * int(inputs)",
|
2775
|
+
typings_output=("video",),
|
2776
|
+
),
|
2777
|
+
*streams,
|
2778
|
+
**{
|
2779
|
+
"inputs": inputs,
|
2780
|
+
"layout": layout,
|
2781
|
+
"grid": grid,
|
2782
|
+
"shortest": shortest,
|
2783
|
+
"fill": fill,
|
2784
|
+
}
|
2785
|
+
| (extra_options or {}),
|
2786
|
+
)
|
2787
|
+
return filter_node.video(0)
|
2788
|
+
|
2789
|
+
|
2790
|
+
def yuvtestsrc(
|
2791
|
+
*,
|
2792
|
+
size: Image_size = Default("320x240"),
|
2793
|
+
rate: Video_rate = Default("25"),
|
2794
|
+
duration: Duration = Default(-1e-06),
|
2795
|
+
sar: Rational = Default("1/1"),
|
2796
|
+
extra_options: dict[str, Any] = None,
|
2797
|
+
) -> VideoStream:
|
2798
|
+
"""
|
2799
|
+
|
2800
|
+
Generate YUV test pattern.
|
2801
|
+
|
2802
|
+
Args:
|
2803
|
+
size: set video size (default "320x240")
|
2804
|
+
rate: set video rate (default "25")
|
2805
|
+
duration: set video duration (default -0.000001)
|
2806
|
+
sar: set video sample aspect ratio (from 0 to INT_MAX) (default 1/1)
|
2807
|
+
|
2808
|
+
Returns:
|
2809
|
+
default: the video stream
|
2810
|
+
|
2811
|
+
References:
|
2812
|
+
[FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#allrgb_002c-allyuv_002c-color_002c-colorchart_002c-colorspectrum_002c-haldclutsrc_002c-nullsrc_002c-pal75bars_002c-pal100bars_002c-rgbtestsrc_002c-smptebars_002c-smptehdbars_002c-testsrc_002c-testsrc2_002c-yuvtestsrc)
|
2813
|
+
|
2814
|
+
"""
|
2815
|
+
filter_node = filter_node_factory(
|
2816
|
+
FFMpegFilterDef(name="yuvtestsrc", typings_input=(), typings_output=("video",)),
|
2817
|
+
**{
|
2818
|
+
"size": size,
|
2819
|
+
"rate": rate,
|
2820
|
+
"duration": duration,
|
2821
|
+
"sar": sar,
|
2822
|
+
}
|
2823
|
+
| (extra_options or {}),
|
2824
|
+
)
|
2825
|
+
return filter_node.video(0)
|