typed-ffmpeg-compatible 3.3.1__py3-none-any.whl → 3.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/filters.py CHANGED
@@ -1,4 +1,6 @@
1
1
  # NOTE: this file is auto-generated, do not modify
2
+
3
+
2
4
  from typing import Any, Literal
3
5
 
4
6
  from .common.schema import FFMpegFilterDef
@@ -8,8 +10,10 @@ from .schema import Auto, Default
8
10
  from .streams.audio import AudioStream
9
11
  from .streams.video import VideoStream
10
12
  from .types import (
13
+ Binary,
11
14
  Boolean,
12
15
  Color,
16
+ Dictionary,
13
17
  Double,
14
18
  Duration,
15
19
  Flags,
@@ -20,6 +24,7 @@ from .types import (
20
24
  Pix_fmt,
21
25
  String,
22
26
  )
27
+ from .utils.frozendict import merge
23
28
 
24
29
 
25
30
  def acrossfade(
@@ -85,7 +90,7 @@ def acrossfade(
85
90
  "hsin2",
86
91
  ]
87
92
  | Default = Default("tri"),
88
- extra_options: dict[str, Any] = None,
93
+ extra_options: dict[str, Any] | None = None,
89
94
  ) -> AudioStream:
90
95
  """
91
96
 
@@ -113,14 +118,16 @@ def acrossfade(
113
118
  ),
114
119
  _crossfade0,
115
120
  _crossfade1,
116
- **{
117
- "nb_samples": nb_samples,
118
- "duration": duration,
119
- "overlap": overlap,
120
- "curve1": curve1,
121
- "curve2": curve2,
122
- }
123
- | (extra_options or {}),
121
+ **merge(
122
+ {
123
+ "nb_samples": nb_samples,
124
+ "duration": duration,
125
+ "overlap": overlap,
126
+ "curve1": curve1,
127
+ "curve2": curve2,
128
+ },
129
+ extra_options,
130
+ ),
124
131
  )
125
132
  return filter_node.audio(0)
126
133
 
@@ -131,7 +138,7 @@ def ainterleave(
131
138
  duration: Int | Literal["longest", "shortest", "first"] | Default = Default(
132
139
  "longest"
133
140
  ),
134
- extra_options: dict[str, Any] = None,
141
+ extra_options: dict[str, Any] | None = None,
135
142
  ) -> AudioStream:
136
143
  """
137
144
 
@@ -155,11 +162,13 @@ def ainterleave(
155
162
  typings_output=("audio",),
156
163
  ),
157
164
  *streams,
158
- **{
159
- "nb_inputs": nb_inputs,
160
- "duration": duration,
161
- }
162
- | (extra_options or {}),
165
+ **merge(
166
+ {
167
+ "nb_inputs": nb_inputs,
168
+ "duration": duration,
169
+ },
170
+ extra_options,
171
+ ),
163
172
  )
164
173
  return filter_node.audio(0)
165
174
 
@@ -173,7 +182,7 @@ def alphamerge(
173
182
  repeatlast: Boolean = Default(True),
174
183
  ts_sync_mode: Int | Literal["default", "nearest"] | Default = Default("default"),
175
184
  enable: String = Default(None),
176
- extra_options: dict[str, Any] = None,
185
+ extra_options: dict[str, Any] | None = None,
177
186
  ) -> VideoStream:
178
187
  """
179
188
 
@@ -201,14 +210,16 @@ def alphamerge(
201
210
  ),
202
211
  _main,
203
212
  _alpha,
204
- **{
205
- "eof_action": eof_action,
206
- "shortest": shortest,
207
- "repeatlast": repeatlast,
208
- "ts_sync_mode": ts_sync_mode,
209
- "enable": enable,
210
- }
211
- | (extra_options or {}),
213
+ **merge(
214
+ {
215
+ "eof_action": eof_action,
216
+ "shortest": shortest,
217
+ "repeatlast": repeatlast,
218
+ "ts_sync_mode": ts_sync_mode,
219
+ "enable": enable,
220
+ },
221
+ extra_options,
222
+ ),
212
223
  )
213
224
  return filter_node.video(0)
214
225
 
@@ -216,7 +227,7 @@ def alphamerge(
216
227
  def amerge(
217
228
  *streams: AudioStream,
218
229
  inputs: Int = Auto("len(streams)"),
219
- extra_options: dict[str, Any] = None,
230
+ extra_options: dict[str, Any] | None = None,
220
231
  ) -> AudioStream:
221
232
  """
222
233
 
@@ -239,10 +250,12 @@ def amerge(
239
250
  typings_output=("audio",),
240
251
  ),
241
252
  *streams,
242
- **{
243
- "inputs": inputs,
244
- }
245
- | (extra_options or {}),
253
+ **merge(
254
+ {
255
+ "inputs": inputs,
256
+ },
257
+ extra_options,
258
+ ),
246
259
  )
247
260
  return filter_node.audio(0)
248
261
 
@@ -256,7 +269,7 @@ def amix(
256
269
  dropout_transition: Float = Default(2.0),
257
270
  weights: String = Default("1 1"),
258
271
  normalize: Boolean = Default(True),
259
- extra_options: dict[str, Any] = None,
272
+ extra_options: dict[str, Any] | None = None,
260
273
  ) -> AudioStream:
261
274
  """
262
275
 
@@ -283,14 +296,16 @@ def amix(
283
296
  typings_output=("audio",),
284
297
  ),
285
298
  *streams,
286
- **{
287
- "inputs": inputs,
288
- "duration": duration,
289
- "dropout_transition": dropout_transition,
290
- "weights": weights,
291
- "normalize": normalize,
292
- }
293
- | (extra_options or {}),
299
+ **merge(
300
+ {
301
+ "inputs": inputs,
302
+ "duration": duration,
303
+ "dropout_transition": dropout_transition,
304
+ "weights": weights,
305
+ "normalize": normalize,
306
+ },
307
+ extra_options,
308
+ ),
294
309
  )
295
310
  return filter_node.audio(0)
296
311
 
@@ -298,7 +313,7 @@ def amix(
298
313
  def amultiply(
299
314
  _multiply0: AudioStream,
300
315
  _multiply1: AudioStream,
301
- extra_options: dict[str, Any] = None,
316
+ extra_options: dict[str, Any] | None = None,
302
317
  ) -> AudioStream:
303
318
  """
304
319
 
@@ -319,7 +334,7 @@ def amultiply(
319
334
  ),
320
335
  _multiply0,
321
336
  _multiply1,
322
- **{} | (extra_options or {}),
337
+ **merge({}, extra_options),
323
338
  )
324
339
  return filter_node.audio(0)
325
340
 
@@ -334,7 +349,7 @@ def anlmf(
334
349
  leakage: Float = Default(0.0),
335
350
  out_mode: Int | Literal["i", "d", "o", "n", "e"] | Default = Default("o"),
336
351
  enable: String = Default(None),
337
- extra_options: dict[str, Any] = None,
352
+ extra_options: dict[str, Any] | None = None,
338
353
  ) -> AudioStream:
339
354
  """
340
355
 
@@ -361,15 +376,17 @@ def anlmf(
361
376
  ),
362
377
  _input,
363
378
  _desired,
364
- **{
365
- "order": order,
366
- "mu": mu,
367
- "eps": eps,
368
- "leakage": leakage,
369
- "out_mode": out_mode,
370
- "enable": enable,
371
- }
372
- | (extra_options or {}),
379
+ **merge(
380
+ {
381
+ "order": order,
382
+ "mu": mu,
383
+ "eps": eps,
384
+ "leakage": leakage,
385
+ "out_mode": out_mode,
386
+ "enable": enable,
387
+ },
388
+ extra_options,
389
+ ),
373
390
  )
374
391
  return filter_node.audio(0)
375
392
 
@@ -384,7 +401,7 @@ def anlms(
384
401
  leakage: Float = Default(0.0),
385
402
  out_mode: Int | Literal["i", "d", "o", "n", "e"] | Default = Default("o"),
386
403
  enable: String = Default(None),
387
- extra_options: dict[str, Any] = None,
404
+ extra_options: dict[str, Any] | None = None,
388
405
  ) -> AudioStream:
389
406
  """
390
407
 
@@ -411,15 +428,17 @@ def anlms(
411
428
  ),
412
429
  _input,
413
430
  _desired,
414
- **{
415
- "order": order,
416
- "mu": mu,
417
- "eps": eps,
418
- "leakage": leakage,
419
- "out_mode": out_mode,
420
- "enable": enable,
421
- }
422
- | (extra_options or {}),
431
+ **merge(
432
+ {
433
+ "order": order,
434
+ "mu": mu,
435
+ "eps": eps,
436
+ "leakage": leakage,
437
+ "out_mode": out_mode,
438
+ "enable": enable,
439
+ },
440
+ extra_options,
441
+ ),
423
442
  )
424
443
  return filter_node.audio(0)
425
444
 
@@ -429,7 +448,7 @@ def apsnr(
429
448
  _input1: AudioStream,
430
449
  *,
431
450
  enable: String = Default(None),
432
- extra_options: dict[str, Any] = None,
451
+ extra_options: dict[str, Any] | None = None,
433
452
  ) -> AudioStream:
434
453
  """
435
454
 
@@ -451,10 +470,12 @@ def apsnr(
451
470
  ),
452
471
  _input0,
453
472
  _input1,
454
- **{
455
- "enable": enable,
456
- }
457
- | (extra_options or {}),
473
+ **merge(
474
+ {
475
+ "enable": enable,
476
+ },
477
+ extra_options,
478
+ ),
458
479
  )
459
480
  return filter_node.audio(0)
460
481
 
@@ -468,7 +489,7 @@ def arls(
468
489
  delta: Float = Default(2.0),
469
490
  out_mode: Int | Literal["i", "d", "o", "n", "e"] | Default = Default("o"),
470
491
  enable: String = Default(None),
471
- extra_options: dict[str, Any] = None,
492
+ extra_options: dict[str, Any] | None = None,
472
493
  ) -> AudioStream:
473
494
  """
474
495
 
@@ -494,14 +515,16 @@ def arls(
494
515
  ),
495
516
  _input,
496
517
  _desired,
497
- **{
498
- "order": order,
499
- "lambda": _lambda,
500
- "delta": delta,
501
- "out_mode": out_mode,
502
- "enable": enable,
503
- }
504
- | (extra_options or {}),
518
+ **merge(
519
+ {
520
+ "order": order,
521
+ "lambda": _lambda,
522
+ "delta": delta,
523
+ "out_mode": out_mode,
524
+ "enable": enable,
525
+ },
526
+ extra_options,
527
+ ),
505
528
  )
506
529
  return filter_node.audio(0)
507
530
 
@@ -511,7 +534,7 @@ def asdr(
511
534
  _input1: AudioStream,
512
535
  *,
513
536
  enable: String = Default(None),
514
- extra_options: dict[str, Any] = None,
537
+ extra_options: dict[str, Any] | None = None,
515
538
  ) -> AudioStream:
516
539
  """
517
540
 
@@ -533,10 +556,12 @@ def asdr(
533
556
  ),
534
557
  _input0,
535
558
  _input1,
536
- **{
537
- "enable": enable,
538
- }
539
- | (extra_options or {}),
559
+ **merge(
560
+ {
561
+ "enable": enable,
562
+ },
563
+ extra_options,
564
+ ),
540
565
  )
541
566
  return filter_node.audio(0)
542
567
 
@@ -546,7 +571,7 @@ def asisdr(
546
571
  _input1: AudioStream,
547
572
  *,
548
573
  enable: String = Default(None),
549
- extra_options: dict[str, Any] = None,
574
+ extra_options: dict[str, Any] | None = None,
550
575
  ) -> AudioStream:
551
576
  """
552
577
 
@@ -568,10 +593,12 @@ def asisdr(
568
593
  ),
569
594
  _input0,
570
595
  _input1,
571
- **{
572
- "enable": enable,
573
- }
574
- | (extra_options or {}),
596
+ **merge(
597
+ {
598
+ "enable": enable,
599
+ },
600
+ extra_options,
601
+ ),
575
602
  )
576
603
  return filter_node.audio(0)
577
604
 
@@ -580,7 +607,7 @@ def astreamselect(
580
607
  *streams: AudioStream,
581
608
  inputs: Int = Auto("len(streams)"),
582
609
  map: String = Default(None),
583
- extra_options: dict[str, Any] = None,
610
+ extra_options: dict[str, Any] | None = None,
584
611
  ) -> FilterNode:
585
612
  """
586
613
 
@@ -605,11 +632,13 @@ def astreamselect(
605
632
  typings_output="[StreamType.audio] * len(re.findall(r'\\d+', str(map)))",
606
633
  ),
607
634
  *streams,
608
- **{
609
- "inputs": inputs,
610
- "map": map,
611
- }
612
- | (extra_options or {}),
635
+ **merge(
636
+ {
637
+ "inputs": inputs,
638
+ "map": map,
639
+ },
640
+ extra_options,
641
+ ),
613
642
  )
614
643
 
615
644
  return filter_node
@@ -621,7 +650,7 @@ def axcorrelate(
621
650
  *,
622
651
  size: Int = Default(256),
623
652
  algo: Int | Literal["slow", "fast", "best"] | Default = Default("best"),
624
- extra_options: dict[str, Any] = None,
653
+ extra_options: dict[str, Any] | None = None,
625
654
  ) -> AudioStream:
626
655
  """
627
656
 
@@ -646,11 +675,13 @@ def axcorrelate(
646
675
  ),
647
676
  _axcorrelate0,
648
677
  _axcorrelate1,
649
- **{
650
- "size": size,
651
- "algo": algo,
652
- }
653
- | (extra_options or {}),
678
+ **merge(
679
+ {
680
+ "size": size,
681
+ "algo": algo,
682
+ },
683
+ extra_options,
684
+ ),
654
685
  )
655
686
  return filter_node.audio(0)
656
687
 
@@ -904,7 +935,7 @@ def blend(
904
935
  repeatlast: Boolean = Default(True),
905
936
  ts_sync_mode: Int | Literal["default", "nearest"] | Default = Default("default"),
906
937
  enable: String = Default(None),
907
- extra_options: dict[str, Any] = None,
938
+ extra_options: dict[str, Any] | None = None,
908
939
  ) -> VideoStream:
909
940
  """
910
941
 
@@ -945,29 +976,97 @@ def blend(
945
976
  ),
946
977
  _top,
947
978
  _bottom,
948
- **{
949
- "c0_mode": c0_mode,
950
- "c1_mode": c1_mode,
951
- "c2_mode": c2_mode,
952
- "c3_mode": c3_mode,
953
- "all_mode": all_mode,
954
- "c0_expr": c0_expr,
955
- "c1_expr": c1_expr,
956
- "c2_expr": c2_expr,
957
- "c3_expr": c3_expr,
958
- "all_expr": all_expr,
959
- "c0_opacity": c0_opacity,
960
- "c1_opacity": c1_opacity,
961
- "c2_opacity": c2_opacity,
962
- "c3_opacity": c3_opacity,
963
- "all_opacity": all_opacity,
964
- "eof_action": eof_action,
965
- "shortest": shortest,
966
- "repeatlast": repeatlast,
967
- "ts_sync_mode": ts_sync_mode,
968
- "enable": enable,
969
- }
970
- | (extra_options or {}),
979
+ **merge(
980
+ {
981
+ "c0_mode": c0_mode,
982
+ "c1_mode": c1_mode,
983
+ "c2_mode": c2_mode,
984
+ "c3_mode": c3_mode,
985
+ "all_mode": all_mode,
986
+ "c0_expr": c0_expr,
987
+ "c1_expr": c1_expr,
988
+ "c2_expr": c2_expr,
989
+ "c3_expr": c3_expr,
990
+ "all_expr": all_expr,
991
+ "c0_opacity": c0_opacity,
992
+ "c1_opacity": c1_opacity,
993
+ "c2_opacity": c2_opacity,
994
+ "c3_opacity": c3_opacity,
995
+ "all_opacity": all_opacity,
996
+ "eof_action": eof_action,
997
+ "shortest": shortest,
998
+ "repeatlast": repeatlast,
999
+ "ts_sync_mode": ts_sync_mode,
1000
+ "enable": enable,
1001
+ },
1002
+ extra_options,
1003
+ ),
1004
+ )
1005
+ return filter_node.video(0)
1006
+
1007
+
1008
+ def blend_vulkan(
1009
+ _top: VideoStream,
1010
+ _bottom: VideoStream,
1011
+ *,
1012
+ c0_mode: Int | Literal["normal", "multiply"] | Default = Default("normal"),
1013
+ c1_mode: Int | Literal["normal", "multiply"] | Default = Default("normal"),
1014
+ c2_mode: Int | Literal["normal", "multiply"] | Default = Default("normal"),
1015
+ c3_mode: Int | Literal["normal", "multiply"] | Default = Default("normal"),
1016
+ all_mode: Int | Literal["normal", "multiply"] | Default = Default(-1),
1017
+ c0_opacity: Double = Default(1.0),
1018
+ c1_opacity: Double = Default(1.0),
1019
+ c2_opacity: Double = Default(1.0),
1020
+ c3_opacity: Double = Default(1.0),
1021
+ all_opacity: Double = Default(1.0),
1022
+ extra_options: dict[str, Any] | None = None,
1023
+ ) -> VideoStream:
1024
+ """
1025
+
1026
+ Blend two video frames in Vulkan
1027
+
1028
+ Args:
1029
+ c0_mode: set component #0 blend mode (from 0 to 39) (default normal)
1030
+ c1_mode: set component #1 blend mode (from 0 to 39) (default normal)
1031
+ c2_mode: set component #2 blend mode (from 0 to 39) (default normal)
1032
+ c3_mode: set component #3 blend mode (from 0 to 39) (default normal)
1033
+ all_mode: set blend mode for all components (from -1 to 39) (default -1)
1034
+ c0_opacity: set color component #0 opacity (from 0 to 1) (default 1)
1035
+ c1_opacity: set color component #1 opacity (from 0 to 1) (default 1)
1036
+ c2_opacity: set color component #2 opacity (from 0 to 1) (default 1)
1037
+ c3_opacity: set color component #3 opacity (from 0 to 1) (default 1)
1038
+ all_opacity: set opacity for all color components (from 0 to 1) (default 1)
1039
+
1040
+ Returns:
1041
+ default: the video stream
1042
+
1043
+ References:
1044
+ [FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#blend_005fvulkan)
1045
+
1046
+ """
1047
+ filter_node = filter_node_factory(
1048
+ FFMpegFilterDef(
1049
+ name="blend_vulkan",
1050
+ typings_input=("video", "video"),
1051
+ typings_output=("video",),
1052
+ ),
1053
+ _top,
1054
+ _bottom,
1055
+ **merge(
1056
+ {
1057
+ "c0_mode": c0_mode,
1058
+ "c1_mode": c1_mode,
1059
+ "c2_mode": c2_mode,
1060
+ "c3_mode": c3_mode,
1061
+ "all_mode": all_mode,
1062
+ "c0_opacity": c0_opacity,
1063
+ "c1_opacity": c1_opacity,
1064
+ "c2_opacity": c2_opacity,
1065
+ "c3_opacity": c3_opacity,
1066
+ "all_opacity": all_opacity,
1067
+ },
1068
+ extra_options,
1069
+ ),
971
1070
  )
972
1071
  return filter_node.video(0)
973
1072
 
@@ -986,7 +1085,7 @@ def bm3d(
986
1085
  ref: Boolean = Default(False),
987
1086
  planes: Int = Default(7),
988
1087
  enable: String = Default(None),
989
- extra_options: dict[str, Any] = None,
1088
+ extra_options: dict[str, Any] | None = None,
990
1089
  ) -> VideoStream:
991
1090
  """
992
1091
 
@@ -1020,21 +1119,23 @@ def bm3d(
1020
1119
  typings_output=("video",),
1021
1120
  ),
1022
1121
  *streams,
1023
- **{
1024
- "sigma": sigma,
1025
- "block": block,
1026
- "bstep": bstep,
1027
- "group": group,
1028
- "range": range,
1029
- "mstep": mstep,
1030
- "thmse": thmse,
1031
- "hdthr": hdthr,
1032
- "estim": estim,
1033
- "ref": ref,
1034
- "planes": planes,
1035
- "enable": enable,
1036
- }
1037
- | (extra_options or {}),
1122
+ **merge(
1123
+ {
1124
+ "sigma": sigma,
1125
+ "block": block,
1126
+ "bstep": bstep,
1127
+ "group": group,
1128
+ "range": range,
1129
+ "mstep": mstep,
1130
+ "thmse": thmse,
1131
+ "hdthr": hdthr,
1132
+ "estim": estim,
1133
+ "ref": ref,
1134
+ "planes": planes,
1135
+ "enable": enable,
1136
+ },
1137
+ extra_options,
1138
+ ),
1038
1139
  )
1039
1140
  return filter_node.video(0)
1040
1141
 
@@ -1049,7 +1150,7 @@ def colormap(
1049
1150
  type: Int | Literal["relative", "absolute"] | Default = Default("absolute"),
1050
1151
  kernel: Int | Literal["euclidean", "weuclidean"] | Default = Default("euclidean"),
1051
1152
  enable: String = Default(None),
1052
- extra_options: dict[str, Any] = None,
1153
+ extra_options: dict[str, Any] | None = None,
1053
1154
  ) -> VideoStream:
1054
1155
  """
1055
1156
 
@@ -1078,14 +1179,16 @@ def colormap(
1078
1179
  _default,
1079
1180
  _source,
1080
1181
  _target,
1081
- **{
1082
- "patch_size": patch_size,
1083
- "nb_patches": nb_patches,
1084
- "type": type,
1085
- "kernel": kernel,
1086
- "enable": enable,
1087
- }
1088
- | (extra_options or {}),
1182
+ **merge(
1183
+ {
1184
+ "patch_size": patch_size,
1185
+ "nb_patches": nb_patches,
1186
+ "type": type,
1187
+ "kernel": kernel,
1188
+ "enable": enable,
1189
+ },
1190
+ extra_options,
1191
+ ),
1089
1192
  )
1090
1193
  return filter_node.video(0)
1091
1194
 
@@ -1096,7 +1199,7 @@ def concat(
1096
1199
  v: Int = Default(1),
1097
1200
  a: Int = Default(0),
1098
1201
  unsafe: Boolean = Default(False),
1099
- extra_options: dict[str, Any] = None,
1202
+ extra_options: dict[str, Any] | None = None,
1100
1203
  ) -> FilterNode:
1101
1204
  """
1102
1205
 
@@ -1123,13 +1226,15 @@ def concat(
1123
1226
  typings_output="[StreamType.video]*int(v) + [StreamType.audio]*int(a)",
1124
1227
  ),
1125
1228
  *streams,
1126
- **{
1127
- "n": n,
1128
- "v": v,
1129
- "a": a,
1130
- "unsafe": unsafe,
1131
- }
1132
- | (extra_options or {}),
1229
+ **merge(
1230
+ {
1231
+ "n": n,
1232
+ "v": v,
1233
+ "a": a,
1234
+ "unsafe": unsafe,
1235
+ },
1236
+ extra_options,
1237
+ ),
1133
1238
  )
1134
1239
 
1135
1240
  return filter_node
@@ -1147,7 +1252,7 @@ def convolve(
1147
1252
  repeatlast: Boolean = Default(True),
1148
1253
  ts_sync_mode: Int | Literal["default", "nearest"] | Default = Default("default"),
1149
1254
  enable: String = Default(None),
1150
- extra_options: dict[str, Any] = None,
1255
+ extra_options: dict[str, Any] | None = None,
1151
1256
  ) -> VideoStream:
1152
1257
  """
1153
1258
 
@@ -1176,17 +1281,19 @@ def convolve(
1176
1281
  ),
1177
1282
  _main,
1178
1283
  _impulse,
1179
- **{
1180
- "planes": planes,
1181
- "impulse": impulse,
1182
- "noise": noise,
1183
- "eof_action": eof_action,
1184
- "shortest": shortest,
1185
- "repeatlast": repeatlast,
1186
- "ts_sync_mode": ts_sync_mode,
1187
- "enable": enable,
1188
- }
1189
- | (extra_options or {}),
1284
+ **merge(
1285
+ {
1286
+ "planes": planes,
1287
+ "impulse": impulse,
1288
+ "noise": noise,
1289
+ "eof_action": eof_action,
1290
+ "shortest": shortest,
1291
+ "repeatlast": repeatlast,
1292
+ "ts_sync_mode": ts_sync_mode,
1293
+ "enable": enable,
1294
+ },
1295
+ extra_options,
1296
+ ),
1190
1297
  )
1191
1298
  return filter_node.video(0)
1192
1299
 
@@ -1200,7 +1307,7 @@ def corr(
1200
1307
  repeatlast: Boolean = Default(True),
1201
1308
  ts_sync_mode: Int | Literal["default", "nearest"] | Default = Default("default"),
1202
1309
  enable: String = Default(None),
1203
- extra_options: dict[str, Any] = None,
1310
+ extra_options: dict[str, Any] | None = None,
1204
1311
  ) -> VideoStream:
1205
1312
  """
1206
1313
 
@@ -1226,14 +1333,16 @@ def corr(
1226
1333
  ),
1227
1334
  _main,
1228
1335
  _reference,
1229
- **{
1230
- "eof_action": eof_action,
1231
- "shortest": shortest,
1232
- "repeatlast": repeatlast,
1233
- "ts_sync_mode": ts_sync_mode,
1234
- "enable": enable,
1235
- }
1236
- | (extra_options or {}),
1336
+ **merge(
1337
+ {
1338
+ "eof_action": eof_action,
1339
+ "shortest": shortest,
1340
+ "repeatlast": repeatlast,
1341
+ "ts_sync_mode": ts_sync_mode,
1342
+ "enable": enable,
1343
+ },
1344
+ extra_options,
1345
+ ),
1237
1346
  )
1238
1347
  return filter_node.video(0)
1239
1348
 
@@ -1248,7 +1357,7 @@ def decimate(
1248
1357
  ppsrc: Boolean = Default(False),
1249
1358
  chroma: Boolean = Default(True),
1250
1359
  mixed: Boolean = Default(False),
1251
- extra_options: dict[str, Any] = None,
1360
+ extra_options: dict[str, Any] | None = None,
1252
1361
  ) -> VideoStream:
1253
1362
  """
1254
1363
 
@@ -1278,17 +1387,19 @@ def decimate(
1278
1387
  typings_output=("video",),
1279
1388
  ),
1280
1389
  *streams,
1281
- **{
1282
- "cycle": cycle,
1283
- "dupthresh": dupthresh,
1284
- "scthresh": scthresh,
1285
- "blockx": blockx,
1286
- "blocky": blocky,
1287
- "ppsrc": ppsrc,
1288
- "chroma": chroma,
1289
- "mixed": mixed,
1290
- }
1291
- | (extra_options or {}),
1390
+ **merge(
1391
+ {
1392
+ "cycle": cycle,
1393
+ "dupthresh": dupthresh,
1394
+ "scthresh": scthresh,
1395
+ "blockx": blockx,
1396
+ "blocky": blocky,
1397
+ "ppsrc": ppsrc,
1398
+ "chroma": chroma,
1399
+ "mixed": mixed,
1400
+ },
1401
+ extra_options,
1402
+ ),
1292
1403
  )
1293
1404
  return filter_node.video(0)
1294
1405
 
@@ -1305,7 +1416,7 @@ def deconvolve(
1305
1416
  repeatlast: Boolean = Default(True),
1306
1417
  ts_sync_mode: Int | Literal["default", "nearest"] | Default = Default("default"),
1307
1418
  enable: String = Default(None),
1308
- extra_options: dict[str, Any] = None,
1419
+ extra_options: dict[str, Any] | None = None,
1309
1420
  ) -> VideoStream:
1310
1421
  """
1311
1422
 
@@ -1336,17 +1447,19 @@ def deconvolve(
1336
1447
  ),
1337
1448
  _main,
1338
1449
  _impulse,
1339
- **{
1340
- "planes": planes,
1341
- "impulse": impulse,
1342
- "noise": noise,
1343
- "eof_action": eof_action,
1344
- "shortest": shortest,
1345
- "repeatlast": repeatlast,
1346
- "ts_sync_mode": ts_sync_mode,
1347
- "enable": enable,
1348
- }
1349
- | (extra_options or {}),
1450
+ **merge(
1451
+ {
1452
+ "planes": planes,
1453
+ "impulse": impulse,
1454
+ "noise": noise,
1455
+ "eof_action": eof_action,
1456
+ "shortest": shortest,
1457
+ "repeatlast": repeatlast,
1458
+ "ts_sync_mode": ts_sync_mode,
1459
+ "enable": enable,
1460
+ },
1461
+ extra_options,
1462
+ ),
1350
1463
  )
1351
1464
  return filter_node.video(0)
1352
1465
 
@@ -1360,7 +1473,7 @@ def displace(
1360
1473
  "smear"
1361
1474
  ),
1362
1475
  enable: String = Default(None),
1363
- extra_options: dict[str, Any] = None,
1476
+ extra_options: dict[str, Any] | None = None,
1364
1477
  ) -> VideoStream:
1365
1478
  """
1366
1479
 
@@ -1386,11 +1499,13 @@ def displace(
1386
1499
  _source,
1387
1500
  _xmap,
1388
1501
  _ymap,
1389
- **{
1390
- "edge": edge,
1391
- "enable": enable,
1392
- }
1393
- | (extra_options or {}),
1502
+ **merge(
1503
+ {
1504
+ "edge": edge,
1505
+ "enable": enable,
1506
+ },
1507
+ extra_options,
1508
+ ),
1394
1509
  )
1395
1510
  return filter_node.video(0)
1396
1511
 
@@ -1401,7 +1516,7 @@ def feedback(
1401
1516
  *,
1402
1517
  x: Int = Default(0),
1403
1518
  w: Int = Default(0),
1404
- extra_options: dict[str, Any] = None,
1519
+ extra_options: dict[str, Any] | None = None,
1405
1520
  ) -> tuple[
1406
1521
  VideoStream,
1407
1522
  VideoStream,
@@ -1430,11 +1545,13 @@ def feedback(
1430
1545
  ),
1431
1546
  _default,
1432
1547
  _feedin,
1433
- **{
1434
- "x": x,
1435
- "w": w,
1436
- }
1437
- | (extra_options or {}),
1548
+ **merge(
1549
+ {
1550
+ "x": x,
1551
+ "w": w,
1552
+ },
1553
+ extra_options,
1554
+ ),
1438
1555
  )
1439
1556
  return (
1440
1557
  filter_node.video(0),
@@ -1460,7 +1577,7 @@ def fieldmatch(
1460
1577
  blockx: Int = Default(16),
1461
1578
  blocky: Int = Default(16),
1462
1579
  combpel: Int = Default(80),
1463
- extra_options: dict[str, Any] = None,
1580
+ extra_options: dict[str, Any] | None = None,
1464
1581
  ) -> VideoStream:
1465
1582
  """
1466
1583
 
@@ -1496,23 +1613,25 @@ def fieldmatch(
1496
1613
  typings_output=("video",),
1497
1614
  ),
1498
1615
  *streams,
1499
- **{
1500
- "order": order,
1501
- "mode": mode,
1502
- "ppsrc": ppsrc,
1503
- "field": field,
1504
- "mchroma": mchroma,
1505
- "y0": y0,
1506
- "scthresh": scthresh,
1507
- "combmatch": combmatch,
1508
- "combdbg": combdbg,
1509
- "cthresh": cthresh,
1510
- "chroma": chroma,
1511
- "blockx": blockx,
1512
- "blocky": blocky,
1513
- "combpel": combpel,
1514
- }
1515
- | (extra_options or {}),
1616
+ **merge(
1617
+ {
1618
+ "order": order,
1619
+ "mode": mode,
1620
+ "ppsrc": ppsrc,
1621
+ "field": field,
1622
+ "mchroma": mchroma,
1623
+ "y0": y0,
1624
+ "scthresh": scthresh,
1625
+ "combmatch": combmatch,
1626
+ "combdbg": combdbg,
1627
+ "cthresh": cthresh,
1628
+ "chroma": chroma,
1629
+ "blockx": blockx,
1630
+ "blocky": blocky,
1631
+ "combpel": combpel,
1632
+ },
1633
+ extra_options,
1634
+ ),
1516
1635
  )
1517
1636
  return filter_node.video(0)
1518
1637
 
@@ -1524,7 +1643,7 @@ def framepack(
1524
1643
  format: Int
1525
1644
  | Literal["sbs", "tab", "frameseq", "lines", "columns"]
1526
1645
  | Default = Default("sbs"),
1527
- extra_options: dict[str, Any] = None,
1646
+ extra_options: dict[str, Any] | None = None,
1528
1647
  ) -> VideoStream:
1529
1648
  """
1530
1649
 
@@ -1548,10 +1667,12 @@ def framepack(
1548
1667
  ),
1549
1668
  _left,
1550
1669
  _right,
1551
- **{
1552
- "format": format,
1553
- }
1554
- | (extra_options or {}),
1670
+ **merge(
1671
+ {
1672
+ "format": format,
1673
+ },
1674
+ extra_options,
1675
+ ),
1555
1676
  )
1556
1677
  return filter_node.video(0)
1557
1678
 
@@ -1563,7 +1684,7 @@ def freezeframes(
1563
1684
  first: Int64 = Default(0),
1564
1685
  last: Int64 = Default(0),
1565
1686
  replace: Int64 = Default(0),
1566
- extra_options: dict[str, Any] = None,
1687
+ extra_options: dict[str, Any] | None = None,
1567
1688
  ) -> VideoStream:
1568
1689
  """
1569
1690
 
@@ -1589,12 +1710,14 @@ def freezeframes(
1589
1710
  ),
1590
1711
  _source,
1591
1712
  _replace,
1592
- **{
1593
- "first": first,
1594
- "last": last,
1595
- "replace": replace,
1596
- }
1597
- | (extra_options or {}),
1713
+ **merge(
1714
+ {
1715
+ "first": first,
1716
+ "last": last,
1717
+ "replace": replace,
1718
+ },
1719
+ extra_options,
1720
+ ),
1598
1721
  )
1599
1722
  return filter_node.video(0)
1600
1723
 
@@ -1608,7 +1731,7 @@ def guided(
1608
1731
  guidance: Int | Literal["off", "on"] | Default = Default("off"),
1609
1732
  planes: Int = Default(1),
1610
1733
  enable: String = Default(None),
1611
- extra_options: dict[str, Any] = None,
1734
+ extra_options: dict[str, Any] | None = None,
1612
1735
  ) -> VideoStream:
1613
1736
  """
1614
1737
 
@@ -1637,16 +1760,18 @@ def guided(
1637
1760
  typings_output=("video",),
1638
1761
  ),
1639
1762
  *streams,
1640
- **{
1641
- "radius": radius,
1642
- "eps": eps,
1643
- "mode": mode,
1644
- "sub": sub,
1645
- "guidance": guidance,
1646
- "planes": planes,
1647
- "enable": enable,
1648
- }
1649
- | (extra_options or {}),
1763
+ **merge(
1764
+ {
1765
+ "radius": radius,
1766
+ "eps": eps,
1767
+ "mode": mode,
1768
+ "sub": sub,
1769
+ "guidance": guidance,
1770
+ "planes": planes,
1771
+ "enable": enable,
1772
+ },
1773
+ extra_options,
1774
+ ),
1650
1775
  )
1651
1776
  return filter_node.video(0)
1652
1777
 
@@ -1664,7 +1789,7 @@ def haldclut(
1664
1789
  repeatlast: Boolean = Default(True),
1665
1790
  ts_sync_mode: Int | Literal["default", "nearest"] | Default = Default("default"),
1666
1791
  enable: String = Default(None),
1667
- extra_options: dict[str, Any] = None,
1792
+ extra_options: dict[str, Any] | None = None,
1668
1793
  ) -> VideoStream:
1669
1794
  """
1670
1795
 
@@ -1692,16 +1817,18 @@ def haldclut(
1692
1817
  ),
1693
1818
  _main,
1694
1819
  _clut,
1695
- **{
1696
- "clut": clut,
1697
- "interp": interp,
1698
- "eof_action": eof_action,
1699
- "shortest": shortest,
1700
- "repeatlast": repeatlast,
1701
- "ts_sync_mode": ts_sync_mode,
1702
- "enable": enable,
1703
- }
1704
- | (extra_options or {}),
1820
+ **merge(
1821
+ {
1822
+ "clut": clut,
1823
+ "interp": interp,
1824
+ "eof_action": eof_action,
1825
+ "shortest": shortest,
1826
+ "repeatlast": repeatlast,
1827
+ "ts_sync_mode": ts_sync_mode,
1828
+ "enable": enable,
1829
+ },
1830
+ extra_options,
1831
+ ),
1705
1832
  )
1706
1833
  return filter_node.video(0)
1707
1834
 
@@ -1714,7 +1841,7 @@ def headphone(
1714
1841
  type: Int | Literal["time", "freq"] | Default = Default("freq"),
1715
1842
  size: Int = Default(1024),
1716
1843
  hrir: Int | Literal["stereo", "multich"] | Default = Default("stereo"),
1717
- extra_options: dict[str, Any] = None,
1844
+ extra_options: dict[str, Any] | None = None,
1718
1845
  ) -> AudioStream:
1719
1846
  """
1720
1847
 
@@ -1742,15 +1869,17 @@ def headphone(
1742
1869
  typings_output=("audio",),
1743
1870
  ),
1744
1871
  *streams,
1745
- **{
1746
- "map": map,
1747
- "gain": gain,
1748
- "lfe": lfe,
1749
- "type": type,
1750
- "size": size,
1751
- "hrir": hrir,
1752
- }
1753
- | (extra_options or {}),
1872
+ **merge(
1873
+ {
1874
+ "map": map,
1875
+ "gain": gain,
1876
+ "lfe": lfe,
1877
+ "type": type,
1878
+ "size": size,
1879
+ "hrir": hrir,
1880
+ },
1881
+ extra_options,
1882
+ ),
1754
1883
  )
1755
1884
  return filter_node.audio(0)
1756
1885
 
@@ -1759,7 +1888,7 @@ def hstack(
1759
1888
  *streams: VideoStream,
1760
1889
  inputs: Int = Auto("len(streams)"),
1761
1890
  shortest: Boolean = Default(False),
1762
- extra_options: dict[str, Any] = None,
1891
+ extra_options: dict[str, Any] | None = None,
1763
1892
  ) -> VideoStream:
1764
1893
  """
1765
1894
 
@@ -1783,11 +1912,55 @@ def hstack(
1783
1912
  typings_output=("video",),
1784
1913
  ),
1785
1914
  *streams,
1786
- **{
1787
- "inputs": inputs,
1788
- "shortest": shortest,
1789
- }
1790
- | (extra_options or {}),
1915
+ **merge(
1916
+ {
1917
+ "inputs": inputs,
1918
+ "shortest": shortest,
1919
+ },
1920
+ extra_options,
1921
+ ),
1922
+ )
1923
+ return filter_node.video(0)
1924
+
1925
+
1926
+ def hstack_vaapi(
1927
+ *streams: VideoStream,
1928
+ inputs: Int = Default(2),
1929
+ shortest: Boolean = Default(False),
1930
+ height: Int = Default(0),
1931
+ extra_options: dict[str, Any] | None = None,
1932
+ ) -> VideoStream:
1933
+ """
1934
+
1935
+ "VA-API" hstack
1936
+
1937
+ Args:
1938
+ inputs: Set number of inputs (from 2 to 65535) (default 2)
1939
+ shortest: Force termination when the shortest input terminates (default false)
1940
+ height: Set output height (0 to use the height of input 0) (from 0 to 65535) (default 0)
1941
+
1942
+ Returns:
1943
+ default: the video stream
1944
+
1945
+ References:
1946
+ [FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#hstack_005fvaapi)
1947
+
1948
+ """
1949
+ filter_node = filter_node_factory(
1950
+ FFMpegFilterDef(
1951
+ name="hstack_vaapi",
1952
+ typings_input="[StreamType.video] * int(inputs)",
1953
+ typings_output=("video",),
1954
+ ),
1955
+ *streams,
1956
+ **merge(
1957
+ {
1958
+ "inputs": inputs,
1959
+ "shortest": shortest,
1960
+ "height": height,
1961
+ },
1962
+ extra_options,
1963
+ ),
1791
1964
  )
1792
1965
  return filter_node.video(0)
1793
1966
 
@@ -1803,7 +1976,7 @@ def hysteresis(
1803
1976
  repeatlast: Boolean = Default(True),
1804
1977
  ts_sync_mode: Int | Literal["default", "nearest"] | Default = Default("default"),
1805
1978
  enable: String = Default(None),
1806
- extra_options: dict[str, Any] = None,
1979
+ extra_options: dict[str, Any] | None = None,
1807
1980
  ) -> VideoStream:
1808
1981
  """
1809
1982
 
@@ -1833,16 +2006,18 @@ def hysteresis(
1833
2006
  ),
1834
2007
  _base,
1835
2008
  _alt,
1836
- **{
1837
- "planes": planes,
1838
- "threshold": threshold,
1839
- "eof_action": eof_action,
1840
- "shortest": shortest,
1841
- "repeatlast": repeatlast,
1842
- "ts_sync_mode": ts_sync_mode,
1843
- "enable": enable,
1844
- }
1845
- | (extra_options or {}),
2009
+ **merge(
2010
+ {
2011
+ "planes": planes,
2012
+ "threshold": threshold,
2013
+ "eof_action": eof_action,
2014
+ "shortest": shortest,
2015
+ "repeatlast": repeatlast,
2016
+ "ts_sync_mode": ts_sync_mode,
2017
+ "enable": enable,
2018
+ },
2019
+ extra_options,
2020
+ ),
1846
2021
  )
1847
2022
  return filter_node.video(0)
1848
2023
 
@@ -1856,7 +2031,7 @@ def identity(
1856
2031
  repeatlast: Boolean = Default(True),
1857
2032
  ts_sync_mode: Int | Literal["default", "nearest"] | Default = Default("default"),
1858
2033
  enable: String = Default(None),
1859
- extra_options: dict[str, Any] = None,
2034
+ extra_options: dict[str, Any] | None = None,
1860
2035
  ) -> VideoStream:
1861
2036
  """
1862
2037
 
@@ -1882,14 +2057,16 @@ def identity(
1882
2057
  ),
1883
2058
  _main,
1884
2059
  _reference,
1885
- **{
1886
- "eof_action": eof_action,
1887
- "shortest": shortest,
1888
- "repeatlast": repeatlast,
1889
- "ts_sync_mode": ts_sync_mode,
1890
- "enable": enable,
1891
- }
1892
- | (extra_options or {}),
2060
+ **merge(
2061
+ {
2062
+ "eof_action": eof_action,
2063
+ "shortest": shortest,
2064
+ "repeatlast": repeatlast,
2065
+ "ts_sync_mode": ts_sync_mode,
2066
+ "enable": enable,
2067
+ },
2068
+ extra_options,
2069
+ ),
1893
2070
  )
1894
2071
  return filter_node.video(0)
1895
2072
 
@@ -1900,7 +2077,7 @@ def interleave(
1900
2077
  duration: Int | Literal["longest", "shortest", "first"] | Default = Default(
1901
2078
  "longest"
1902
2079
  ),
1903
- extra_options: dict[str, Any] = None,
2080
+ extra_options: dict[str, Any] | None = None,
1904
2081
  ) -> VideoStream:
1905
2082
  """
1906
2083
 
@@ -1924,11 +2101,13 @@ def interleave(
1924
2101
  typings_output=("video",),
1925
2102
  ),
1926
2103
  *streams,
1927
- **{
1928
- "nb_inputs": nb_inputs,
1929
- "duration": duration,
1930
- }
1931
- | (extra_options or {}),
2104
+ **merge(
2105
+ {
2106
+ "nb_inputs": nb_inputs,
2107
+ "duration": duration,
2108
+ },
2109
+ extra_options,
2110
+ ),
1932
2111
  )
1933
2112
  return filter_node.video(0)
1934
2113
 
@@ -1938,7 +2117,7 @@ def join(
1938
2117
  inputs: Int = Auto("len(streams)"),
1939
2118
  channel_layout: String = Default("stereo"),
1940
2119
  map: String = Default(None),
1941
- extra_options: dict[str, Any] = None,
2120
+ extra_options: dict[str, Any] | None = None,
1942
2121
  ) -> AudioStream:
1943
2122
  """
1944
2123
 
@@ -1963,77 +2142,421 @@ def join(
1963
2142
  typings_output=("audio",),
1964
2143
  ),
1965
2144
  *streams,
1966
- **{
1967
- "inputs": inputs,
1968
- "channel_layout": channel_layout,
1969
- "map": map,
1970
- }
1971
- | (extra_options or {}),
2145
+ **merge(
2146
+ {
2147
+ "inputs": inputs,
2148
+ "channel_layout": channel_layout,
2149
+ "map": map,
2150
+ },
2151
+ extra_options,
2152
+ ),
1972
2153
  )
1973
2154
  return filter_node.audio(0)
1974
2155
 
1975
2156
 
1976
- def libvmaf(
1977
- _main: VideoStream,
1978
- _reference: VideoStream,
1979
- *,
1980
- log_path: String = Default(None),
1981
- log_fmt: String = Default("xml"),
1982
- pool: String = Default(None),
1983
- n_threads: Int = Default(0),
1984
- n_subsample: Int = Default(1),
1985
- model: String = Default("version=vmaf_v0.6.1"),
1986
- feature: String = Default(None),
1987
- eof_action: Int | Literal["repeat", "endall", "pass"] | Default = Default("repeat"),
1988
- shortest: Boolean = Default(False),
1989
- repeatlast: Boolean = Default(True),
1990
- ts_sync_mode: Int | Literal["default", "nearest"] | Default = Default("default"),
1991
- extra_options: dict[str, Any] = None,
2157
+ def ladspa(
2158
+ *streams: AudioStream,
2159
+ file: String = Default(None),
2160
+ plugin: String = Default(None),
2161
+ controls: String = Default(None),
2162
+ sample_rate: Int = Default(44100),
2163
+ nb_samples: Int = Default(1024),
2164
+ duration: Duration = Default(-1e-06),
2165
+ latency: Boolean = Default(False),
2166
+ extra_options: dict[str, Any] | None = None,
2167
+ ) -> AudioStream:
2168
+ """
2169
+
2170
+ Apply LADSPA effect.
2171
+
2172
+ Args:
2173
+ file: set library name or full path
2174
+ plugin: set plugin name
2175
+ controls: set plugin options
2176
+ sample_rate: set sample rate (from 1 to INT_MAX) (default 44100)
2177
+ nb_samples: set the number of samples per requested frame (from 1 to INT_MAX) (default 1024)
2178
+ duration: set audio duration (default -0.000001)
2179
+ latency: enable latency compensation (default false)
2180
+
2181
+ Returns:
2182
+ default: the audio stream
2183
+
2184
+ References:
2185
+ [FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#ladspa)
2186
+
2187
+ """
2188
+ filter_node = filter_node_factory(
2189
+ FFMpegFilterDef(
2190
+ name="ladspa", typings_input="[StreamType.audio]", typings_output=("audio",)
2191
+ ),
2192
+ *streams,
2193
+ **merge(
2194
+ {
2195
+ "file": file,
2196
+ "plugin": plugin,
2197
+ "controls": controls,
2198
+ "sample_rate": sample_rate,
2199
+ "nb_samples": nb_samples,
2200
+ "duration": duration,
2201
+ "latency": latency,
2202
+ },
2203
+ extra_options,
2204
+ ),
2205
+ )
2206
+ return filter_node.audio(0)
2207
+
2208
+
2209
+ def libplacebo(
2210
+ *streams: VideoStream,
2211
+ inputs: Int = Auto("len(streams)"),
2212
+ w: String = Default("iw"),
2213
+ h: String = Default("ih"),
2214
+ fps: String = Default("none"),
2215
+ crop_x: String = Default("(iw-cw"),
2216
+ crop_y: String = Default("(ih-ch"),
2217
+ crop_w: String = Default("iw"),
2218
+ crop_h: String = Default("ih"),
2219
+ pos_x: String = Default("(ow-pw"),
2220
+ pos_y: String = Default("(oh-ph"),
2221
+ pos_w: String = Default("ow"),
2222
+ pos_h: String = Default("oh"),
2223
+ format: String = Default(None),
2224
+ force_original_aspect_ratio: Int
2225
+ | Literal["disable", "decrease", "increase"]
2226
+ | Default = Default("disable"),
2227
+ force_divisible_by: Int = Default(1),
2228
+ normalize_sar: Boolean = Default(False),
2229
+ pad_crop_ratio: Float = Default(0.0),
2230
+ fillcolor: String = Default("black"),
2231
+ corner_rounding: Float = Default(0.0),
2232
+ extra_opts: Dictionary = Default(None),
2233
+ colorspace: Int
2234
+ | Literal[
2235
+ "auto",
2236
+ "gbr",
2237
+ "bt709",
2238
+ "unknown",
2239
+ "bt470bg",
2240
+ "smpte170m",
2241
+ "smpte240m",
2242
+ "ycgco",
2243
+ "bt2020nc",
2244
+ "bt2020c",
2245
+ "ictcp",
2246
+ ]
2247
+ | Default = Default("auto"),
2248
+ range: Int
2249
+ | Literal[
2250
+ "auto", "unspecified", "unknown", "limited", "tv", "mpeg", "full", "pc", "jpeg"
2251
+ ]
2252
+ | Default = Default("auto"),
2253
+ color_primaries: Int
2254
+ | Literal[
2255
+ "auto",
2256
+ "bt709",
2257
+ "unknown",
2258
+ "bt470m",
2259
+ "bt470bg",
2260
+ "smpte170m",
2261
+ "smpte240m",
2262
+ "film",
2263
+ "bt2020",
2264
+ "smpte428",
2265
+ "smpte431",
2266
+ "smpte432",
2267
+ "p22",
2268
+ "ebu3213",
2269
+ ]
2270
+ | Default = Default("auto"),
2271
+ color_trc: Int
2272
+ | Literal[
2273
+ "auto",
2274
+ "bt709",
2275
+ "unknown",
2276
+ "bt470m",
2277
+ "bt470bg",
2278
+ "smpte170m",
2279
+ "smpte240m",
2280
+ "linear",
2281
+ "4",
2282
+ "bt1361e",
2283
+ "1",
2284
+ "10",
2285
+ "12",
2286
+ "smpte2084",
2287
+ "b67",
2288
+ ]
2289
+ | Default = Default("auto"),
2290
+ upscaler: String = Default("spline36"),
2291
+ downscaler: String = Default("mitchell"),
2292
+ frame_mixer: String = Default("none"),
2293
+ lut_entries: Int = Default(0),
2294
+ antiringing: Float = Default(0.0),
2295
+ sigmoid: Boolean = Default(True),
2296
+ apply_filmgrain: Boolean = Default(True),
2297
+ apply_dolbyvision: Boolean = Default(True),
2298
+ deband: Boolean = Default(False),
2299
+ deband_iterations: Int = Default(1),
2300
+ deband_threshold: Float = Default(4.0),
2301
+ deband_radius: Float = Default(16.0),
2302
+ deband_grain: Float = Default(6.0),
2303
+ brightness: Float = Default(0.0),
2304
+ contrast: Float = Default(1.0),
2305
+ saturation: Float = Default(1.0),
2306
+ hue: Float = Default(0.0),
2307
+ gamma: Float = Default(1.0),
2308
+ peak_detect: Boolean = Default(True),
2309
+ smoothing_period: Float = Default(100.0),
2310
+ minimum_peak: Float = Default(1.0),
2311
+ scene_threshold_low: Float = Default(5.5),
2312
+ scene_threshold_high: Float = Default(10.0),
2313
+ percentile: Float = Default(99.995),
2314
+ gamut_mode: Int
2315
+ | Literal[
2316
+ "clip",
2317
+ "perceptual",
2318
+ "relative",
2319
+ "saturation",
2320
+ "absolute",
2321
+ "desaturate",
2322
+ "darken",
2323
+ "warn",
2324
+ "linear",
2325
+ ]
2326
+ | Default = Default("perceptual"),
2327
+ tonemapping: Int
2328
+ | Literal[
2329
+ "auto",
2330
+ "clip",
2331
+ "40",
2332
+ "10",
2333
+ "2390",
2334
+ "2446a",
2335
+ "spline",
2336
+ "reinhard",
2337
+ "mobius",
2338
+ "hable",
2339
+ "gamma",
2340
+ "linear",
2341
+ ]
2342
+ | Default = Default("auto"),
2343
+ tonemapping_param: Float = Default(0.0),
2344
+ inverse_tonemapping: Boolean = Default(False),
2345
+ tonemapping_lut_size: Int = Default(256),
2346
+ contrast_recovery: Float = Default(0.3),
2347
+ contrast_smoothness: Float = Default(3.5),
2348
+ desaturation_strength: Float = Default(-1.0),
2349
+ desaturation_exponent: Float = Default(-1.0),
2350
+ gamut_warning: Boolean = Default(False),
2351
+ gamut_clipping: Boolean = Default(False),
2352
+ intent: Int
2353
+ | Literal["perceptual", "relative", "absolute", "saturation"]
2354
+ | Default = Default("perceptual"),
2355
+ tonemapping_mode: Int
2356
+ | Literal["auto", "rgb", "max", "hybrid", "luma"]
2357
+ | Default = Default("auto"),
2358
+ tonemapping_crosstalk: Float = Default(0.04),
2359
+ overshoot: Float = Default(0.05),
2360
+ hybrid_mix: Float = Default(0.2),
2361
+ dithering: Int
2362
+ | Literal["none", "blue", "ordered", "ordered_fixed", "white"]
2363
+ | Default = Default("blue"),
2364
+ dither_lut_size: Int = Default(6),
2365
+ dither_temporal: Boolean = Default(False),
2366
+ cones: Flags | Literal["l", "m", "s"] | Default = Default("0"),
2367
+ cone_strength: Float = Default(0.0),
2368
+ custom_shader_path: String = Default(None),
2369
+ custom_shader_bin: Binary = Default(None),
2370
+ skip_aa: Boolean = Default(False),
2371
+ polar_cutoff: Float = Default(0.0),
2372
+ disable_linear: Boolean = Default(False),
2373
+ disable_builtin: Boolean = Default(False),
2374
+ force_icc_lut: Boolean = Default(False),
2375
+ force_dither: Boolean = Default(False),
2376
+ disable_fbos: Boolean = Default(False),
2377
+ extra_options: dict[str, Any] | None = None,
1992
2378
  ) -> VideoStream:
1993
2379
  """
1994
2380
 
1995
- Calculate the VMAF between two video streams.
2381
+ Apply various GPU filters from libplacebo
1996
2382
 
1997
2383
  Args:
1998
- log_path: Set the file path to be used to write log.
1999
- log_fmt: Set the format of the log (csv, json, xml, or sub). (default "xml")
2000
- pool: Set the pool method to be used for computing vmaf.
2001
- n_threads: Set number of threads to be used when computing vmaf. (from 0 to UINT32_MAX) (default 0)
2002
- n_subsample: Set interval for frame subsampling used when computing vmaf. (from 1 to UINT32_MAX) (default 1)
2003
- model: Set the model to be used for computing vmaf. (default "version=vmaf_v0.6.1")
2004
- feature: Set the feature to be used for computing vmaf.
2005
- eof_action: Action to take when encountering EOF from secondary input (from 0 to 2) (default repeat)
2006
- shortest: force termination when the shortest input terminates (default false)
2007
- repeatlast: extend last frame of secondary streams beyond EOF (default true)
2008
- ts_sync_mode: How strictly to sync streams based on secondary input timestamps (from 0 to 1) (default default)
2384
+ inputs: Number of inputs (from 1 to INT_MAX) (default 1)
2385
+ w: Output video frame width (default "iw")
2386
+ h: Output video frame height (default "ih")
2387
+ fps: Output video frame rate (default "none")
2388
+ crop_x: Input video crop x (default "(iw-cw)/2")
2389
+ crop_y: Input video crop y (default "(ih-ch)/2")
2390
+ crop_w: Input video crop w (default "iw")
2391
+ crop_h: Input video crop h (default "ih")
2392
+ pos_x: Output video placement x (default "(ow-pw)/2")
2393
+ pos_y: Output video placement y (default "(oh-ph)/2")
2394
+ pos_w: Output video placement w (default "ow")
2395
+ pos_h: Output video placement h (default "oh")
2396
+ format: Output video format
2397
+ force_original_aspect_ratio: decrease or increase w/h if necessary to keep the original AR (from 0 to 2) (default disable)
2398
+ force_divisible_by: enforce that the output resolution is divisible by a defined integer when force_original_aspect_ratio is used (from 1 to 256) (default 1)
2399
+ normalize_sar: force SAR normalization to 1:1 by adjusting pos_x/y/w/h (default false)
2400
+ pad_crop_ratio: ratio between padding and cropping when normalizing SAR (0=pad, 1=crop) (from 0 to 1) (default 0)
2401
+ fillcolor: Background fill color (default "black")
2402
+ corner_rounding: Corner rounding radius (from 0 to 1) (default 0)
2403
+ extra_opts: Pass extra libplacebo-specific options using a :-separated list of key=value pairs
2404
+ colorspace: select colorspace (from -1 to 14) (default auto)
2405
+ range: select color range (from -1 to 2) (default auto)
2406
+ color_primaries: select color primaries (from -1 to 22) (default auto)
2407
+ color_trc: select color transfer (from -1 to 18) (default auto)
2408
+ upscaler: Upscaler function (default "spline36")
2409
+ downscaler: Downscaler function (default "mitchell")
2410
+ frame_mixer: Frame mixing function (default "none")
2411
+ lut_entries: Number of scaler LUT entries (from 0 to 256) (default 0)
2412
+ antiringing: Antiringing strength (for non-EWA filters) (from 0 to 1) (default 0)
2413
+ sigmoid: Enable sigmoid upscaling (default true)
2414
+ apply_filmgrain: Apply film grain metadata (default true)
2415
+ apply_dolbyvision: Apply Dolby Vision metadata (default true)
2416
+ deband: Enable debanding (default false)
2417
+ deband_iterations: Deband iterations (from 0 to 16) (default 1)
2418
+ deband_threshold: Deband threshold (from 0 to 1024) (default 4)
2419
+ deband_radius: Deband radius (from 0 to 1024) (default 16)
2420
+ deband_grain: Deband grain (from 0 to 1024) (default 6)
2421
+ brightness: Brightness boost (from -1 to 1) (default 0)
2422
+ contrast: Contrast gain (from 0 to 16) (default 1)
2423
+ saturation: Saturation gain (from 0 to 16) (default 1)
2424
+ hue: Hue shift (from -3.14159 to 3.14159) (default 0)
2425
+ gamma: Gamma adjustment (from 0 to 16) (default 1)
2426
+ peak_detect: Enable dynamic peak detection for HDR tone-mapping (default true)
2427
+ smoothing_period: Peak detection smoothing period (from 0 to 1000) (default 100)
2428
+ minimum_peak: Peak detection minimum peak (from 0 to 100) (default 1)
2429
+ scene_threshold_low: Scene change low threshold (from -1 to 100) (default 5.5)
2430
+ scene_threshold_high: Scene change high threshold (from -1 to 100) (default 10)
2431
+ percentile: Peak detection percentile (from 0 to 100) (default 99.995)
2432
+ gamut_mode: Gamut-mapping mode (from 0 to 8) (default perceptual)
2433
+ tonemapping: Tone-mapping algorithm (from 0 to 11) (default auto)
2434
+ tonemapping_param: Tunable parameter for some tone-mapping functions (from 0 to 100) (default 0)
2435
+ inverse_tonemapping: Inverse tone mapping (range expansion) (default false)
2436
+ tonemapping_lut_size: Tone-mapping LUT size (from 2 to 1024) (default 256)
2437
+ contrast_recovery: HDR contrast recovery strength (from 0 to 3) (default 0.3)
2438
+ contrast_smoothness: HDR contrast recovery smoothness (from 1 to 32) (default 3.5)
2439
+ desaturation_strength: Desaturation strength (from -1 to 1) (default -1)
2440
+ desaturation_exponent: Desaturation exponent (from -1 to 10) (default -1)
2441
+ gamut_warning: Highlight out-of-gamut colors (default false)
2442
+ gamut_clipping: Enable desaturating colorimetric gamut clipping (default false)
2443
+ intent: Rendering intent (from 0 to 3) (default perceptual)
2444
+ tonemapping_mode: Tone-mapping mode (from 0 to 4) (default auto)
2445
+ tonemapping_crosstalk: Crosstalk factor for tone-mapping (from 0 to 0.3) (default 0.04)
2446
+ overshoot: Tone-mapping overshoot margin (from 0 to 1) (default 0.05)
2447
+ hybrid_mix: Tone-mapping hybrid LMS mixing coefficient (from 0 to 1) (default 0.2)
2448
+ dithering: Dither method to use (from -1 to 3) (default blue)
2449
+ dither_lut_size: Dithering LUT size (from 1 to 8) (default 6)
2450
+ dither_temporal: Enable temporal dithering (default false)
2451
+ cones: Colorblindness adaptation model (default 0)
2452
+ cone_strength: Colorblindness adaptation strength (from 0 to 10) (default 0)
2453
+ custom_shader_path: Path to custom user shader (mpv .hook format)
2454
+ custom_shader_bin: Custom user shader as binary (mpv .hook format)
2455
+ skip_aa: Skip anti-aliasing (default false)
2456
+ polar_cutoff: Polar LUT cutoff (from 0 to 1) (default 0)
2457
+ disable_linear: Disable linear scaling (default false)
2458
+ disable_builtin: Disable built-in scalers (default false)
2459
+ force_icc_lut: Deprecated, does nothing (default false)
2460
+ force_dither: Force dithering (default false)
2461
+ disable_fbos: Force-disable FBOs (default false)
2009
2462
 
2010
2463
  Returns:
2011
2464
  default: the video stream
2012
2465
 
2013
2466
  References:
2014
- [FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#libvmaf)
2467
+ [FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#libplacebo)
2015
2468
 
2016
2469
  """
2017
2470
  filter_node = filter_node_factory(
2018
2471
  FFMpegFilterDef(
2019
- name="libvmaf", typings_input=("video", "video"), typings_output=("video",)
2472
+ name="libplacebo",
2473
+ typings_input="[StreamType.video] * int(inputs)",
2474
+ typings_output=("video",),
2475
+ ),
2476
+ *streams,
2477
+ **merge(
2478
+ {
2479
+ "inputs": inputs,
2480
+ "w": w,
2481
+ "h": h,
2482
+ "fps": fps,
2483
+ "crop_x": crop_x,
2484
+ "crop_y": crop_y,
2485
+ "crop_w": crop_w,
2486
+ "crop_h": crop_h,
2487
+ "pos_x": pos_x,
2488
+ "pos_y": pos_y,
2489
+ "pos_w": pos_w,
2490
+ "pos_h": pos_h,
2491
+ "format": format,
2492
+ "force_original_aspect_ratio": force_original_aspect_ratio,
2493
+ "force_divisible_by": force_divisible_by,
2494
+ "normalize_sar": normalize_sar,
2495
+ "pad_crop_ratio": pad_crop_ratio,
2496
+ "fillcolor": fillcolor,
2497
+ "corner_rounding": corner_rounding,
2498
+ "extra_opts": extra_opts,
2499
+ "colorspace": colorspace,
2500
+ "range": range,
2501
+ "color_primaries": color_primaries,
2502
+ "color_trc": color_trc,
2503
+ "upscaler": upscaler,
2504
+ "downscaler": downscaler,
2505
+ "frame_mixer": frame_mixer,
2506
+ "lut_entries": lut_entries,
2507
+ "antiringing": antiringing,
2508
+ "sigmoid": sigmoid,
2509
+ "apply_filmgrain": apply_filmgrain,
2510
+ "apply_dolbyvision": apply_dolbyvision,
2511
+ "deband": deband,
2512
+ "deband_iterations": deband_iterations,
2513
+ "deband_threshold": deband_threshold,
2514
+ "deband_radius": deband_radius,
2515
+ "deband_grain": deband_grain,
2516
+ "brightness": brightness,
2517
+ "contrast": contrast,
2518
+ "saturation": saturation,
2519
+ "hue": hue,
2520
+ "gamma": gamma,
2521
+ "peak_detect": peak_detect,
2522
+ "smoothing_period": smoothing_period,
2523
+ "minimum_peak": minimum_peak,
2524
+ "scene_threshold_low": scene_threshold_low,
2525
+ "scene_threshold_high": scene_threshold_high,
2526
+ "percentile": percentile,
2527
+ "gamut_mode": gamut_mode,
2528
+ "tonemapping": tonemapping,
2529
+ "tonemapping_param": tonemapping_param,
2530
+ "inverse_tonemapping": inverse_tonemapping,
2531
+ "tonemapping_lut_size": tonemapping_lut_size,
2532
+ "contrast_recovery": contrast_recovery,
2533
+ "contrast_smoothness": contrast_smoothness,
2534
+ "desaturation_strength": desaturation_strength,
2535
+ "desaturation_exponent": desaturation_exponent,
2536
+ "gamut_warning": gamut_warning,
2537
+ "gamut_clipping": gamut_clipping,
2538
+ "intent": intent,
2539
+ "tonemapping_mode": tonemapping_mode,
2540
+ "tonemapping_crosstalk": tonemapping_crosstalk,
2541
+ "overshoot": overshoot,
2542
+ "hybrid_mix": hybrid_mix,
2543
+ "dithering": dithering,
2544
+ "dither_lut_size": dither_lut_size,
2545
+ "dither_temporal": dither_temporal,
2546
+ "cones": cones,
2547
+ "cone-strength": cone_strength,
2548
+ "custom_shader_path": custom_shader_path,
2549
+ "custom_shader_bin": custom_shader_bin,
2550
+ "skip_aa": skip_aa,
2551
+ "polar_cutoff": polar_cutoff,
2552
+ "disable_linear": disable_linear,
2553
+ "disable_builtin": disable_builtin,
2554
+ "force_icc_lut": force_icc_lut,
2555
+ "force_dither": force_dither,
2556
+ "disable_fbos": disable_fbos,
2557
+ },
2558
+ extra_options,
2020
2559
  ),
2021
- _main,
2022
- _reference,
2023
- **{
2024
- "log_path": log_path,
2025
- "log_fmt": log_fmt,
2026
- "pool": pool,
2027
- "n_threads": n_threads,
2028
- "n_subsample": n_subsample,
2029
- "model": model,
2030
- "feature": feature,
2031
- "eof_action": eof_action,
2032
- "shortest": shortest,
2033
- "repeatlast": repeatlast,
2034
- "ts_sync_mode": ts_sync_mode,
2035
- }
2036
- | (extra_options or {}),
2037
2560
  )
2038
2561
  return filter_node.video(0)
2039
2562
 
@@ -2045,7 +2568,7 @@ def limitdiff(
2045
2568
  reference: Boolean = Default(False),
2046
2569
  planes: Int = Default(15),
2047
2570
  enable: String = Default(None),
2048
- extra_options: dict[str, Any] = None,
2571
+ extra_options: dict[str, Any] | None = None,
2049
2572
  ) -> VideoStream:
2050
2573
  """
2051
2574
 
@@ -2072,14 +2595,16 @@ def limitdiff(
2072
2595
  typings_output=("video",),
2073
2596
  ),
2074
2597
  *streams,
2075
- **{
2076
- "threshold": threshold,
2077
- "elasticity": elasticity,
2078
- "reference": reference,
2079
- "planes": planes,
2080
- "enable": enable,
2081
- }
2082
- | (extra_options or {}),
2598
+ **merge(
2599
+ {
2600
+ "threshold": threshold,
2601
+ "elasticity": elasticity,
2602
+ "reference": reference,
2603
+ "planes": planes,
2604
+ "enable": enable,
2605
+ },
2606
+ extra_options,
2607
+ ),
2083
2608
  )
2084
2609
  return filter_node.video(0)
2085
2610
 
@@ -2098,7 +2623,7 @@ def lut2(
2098
2623
  repeatlast: Boolean = Default(True),
2099
2624
  ts_sync_mode: Int | Literal["default", "nearest"] | Default = Default("default"),
2100
2625
  enable: String = Default(None),
2101
- extra_options: dict[str, Any] = None,
2626
+ extra_options: dict[str, Any] | None = None,
2102
2627
  ) -> VideoStream:
2103
2628
  """
2104
2629
 
@@ -2129,23 +2654,71 @@ def lut2(
2129
2654
  ),
2130
2655
  _srcx,
2131
2656
  _srcy,
2132
- **{
2133
- "c0": c0,
2134
- "c1": c1,
2135
- "c2": c2,
2136
- "c3": c3,
2137
- "d": d,
2138
- "eof_action": eof_action,
2139
- "shortest": shortest,
2140
- "repeatlast": repeatlast,
2141
- "ts_sync_mode": ts_sync_mode,
2142
- "enable": enable,
2143
- }
2144
- | (extra_options or {}),
2657
+ **merge(
2658
+ {
2659
+ "c0": c0,
2660
+ "c1": c1,
2661
+ "c2": c2,
2662
+ "c3": c3,
2663
+ "d": d,
2664
+ "eof_action": eof_action,
2665
+ "shortest": shortest,
2666
+ "repeatlast": repeatlast,
2667
+ "ts_sync_mode": ts_sync_mode,
2668
+ "enable": enable,
2669
+ },
2670
+ extra_options,
2671
+ ),
2145
2672
  )
2146
2673
  return filter_node.video(0)
2147
2674
 
2148
2675
 
2676
+ def lv2(
2677
+ *streams: AudioStream,
2678
+ plugin: String = Default(None),
2679
+ controls: String = Default(None),
2680
+ sample_rate: Int = Default(44100),
2681
+ nb_samples: Int = Default(1024),
2682
+ duration: Duration = Default(-1e-06),
2683
+ extra_options: dict[str, Any] | None = None,
2684
+ ) -> AudioStream:
2685
+ """
2686
+
2687
+ Apply LV2 effect.
2688
+
2689
+ Args:
2690
+ plugin: set plugin uri
2691
+ controls: set plugin options
2692
+ sample_rate: set sample rate (from 1 to INT_MAX) (default 44100)
2693
+ nb_samples: set the number of samples per requested frame (from 1 to INT_MAX) (default 1024)
2694
+ duration: set audio duration (default -0.000001)
2695
+
2696
+ Returns:
2697
+ default: the audio stream
2698
+
2699
+ References:
2700
+ [FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#lv2)
2701
+
2702
+ """
2703
+ filter_node = filter_node_factory(
2704
+ FFMpegFilterDef(
2705
+ name="lv2", typings_input="[StreamType.audio]", typings_output=("audio",)
2706
+ ),
2707
+ *streams,
2708
+ **merge(
2709
+ {
2710
+ "plugin": plugin,
2711
+ "controls": controls,
2712
+ "sample_rate": sample_rate,
2713
+ "nb_samples": nb_samples,
2714
+ "duration": duration,
2715
+ },
2716
+ extra_options,
2717
+ ),
2718
+ )
2719
+ return filter_node.audio(0)
2720
+
2721
+
2149
2722
  def maskedclamp(
2150
2723
  _base: VideoStream,
2151
2724
  _dark: VideoStream,
@@ -2155,7 +2728,7 @@ def maskedclamp(
2155
2728
  overshoot: Int = Default(0),
2156
2729
  planes: Int = Default(15),
2157
2730
  enable: String = Default(None),
2158
- extra_options: dict[str, Any] = None,
2731
+ extra_options: dict[str, Any] | None = None,
2159
2732
  ) -> VideoStream:
2160
2733
  """
2161
2734
 
@@ -2183,13 +2756,15 @@ def maskedclamp(
2183
2756
  _base,
2184
2757
  _dark,
2185
2758
  _bright,
2186
- **{
2187
- "undershoot": undershoot,
2188
- "overshoot": overshoot,
2189
- "planes": planes,
2190
- "enable": enable,
2191
- }
2192
- | (extra_options or {}),
2759
+ **merge(
2760
+ {
2761
+ "undershoot": undershoot,
2762
+ "overshoot": overshoot,
2763
+ "planes": planes,
2764
+ "enable": enable,
2765
+ },
2766
+ extra_options,
2767
+ ),
2193
2768
  )
2194
2769
  return filter_node.video(0)
2195
2770
 
@@ -2201,7 +2776,7 @@ def maskedmax(
2201
2776
  *,
2202
2777
  planes: Int = Default(15),
2203
2778
  enable: String = Default(None),
2204
- extra_options: dict[str, Any] = None,
2779
+ extra_options: dict[str, Any] | None = None,
2205
2780
  ) -> VideoStream:
2206
2781
  """
2207
2782
 
@@ -2227,11 +2802,13 @@ def maskedmax(
2227
2802
  _source,
2228
2803
  _filter1,
2229
2804
  _filter2,
2230
- **{
2231
- "planes": planes,
2232
- "enable": enable,
2233
- }
2234
- | (extra_options or {}),
2805
+ **merge(
2806
+ {
2807
+ "planes": planes,
2808
+ "enable": enable,
2809
+ },
2810
+ extra_options,
2811
+ ),
2235
2812
  )
2236
2813
  return filter_node.video(0)
2237
2814
 
@@ -2243,7 +2820,7 @@ def maskedmerge(
2243
2820
  *,
2244
2821
  planes: Int = Default(15),
2245
2822
  enable: String = Default(None),
2246
- extra_options: dict[str, Any] = None,
2823
+ extra_options: dict[str, Any] | None = None,
2247
2824
  ) -> VideoStream:
2248
2825
  """
2249
2826
 
@@ -2269,11 +2846,13 @@ def maskedmerge(
2269
2846
  _base,
2270
2847
  _overlay,
2271
2848
  _mask,
2272
- **{
2273
- "planes": planes,
2274
- "enable": enable,
2275
- }
2276
- | (extra_options or {}),
2849
+ **merge(
2850
+ {
2851
+ "planes": planes,
2852
+ "enable": enable,
2853
+ },
2854
+ extra_options,
2855
+ ),
2277
2856
  )
2278
2857
  return filter_node.video(0)
2279
2858
 
@@ -2285,7 +2864,7 @@ def maskedmin(
2285
2864
  *,
2286
2865
  planes: Int = Default(15),
2287
2866
  enable: String = Default(None),
2288
- extra_options: dict[str, Any] = None,
2867
+ extra_options: dict[str, Any] | None = None,
2289
2868
  ) -> VideoStream:
2290
2869
  """
2291
2870
 
@@ -2311,11 +2890,13 @@ def maskedmin(
2311
2890
  _source,
2312
2891
  _filter1,
2313
2892
  _filter2,
2314
- **{
2315
- "planes": planes,
2316
- "enable": enable,
2317
- }
2318
- | (extra_options or {}),
2893
+ **merge(
2894
+ {
2895
+ "planes": planes,
2896
+ "enable": enable,
2897
+ },
2898
+ extra_options,
2899
+ ),
2319
2900
  )
2320
2901
  return filter_node.video(0)
2321
2902
 
@@ -2328,7 +2909,7 @@ def maskedthreshold(
2328
2909
  planes: Int = Default(15),
2329
2910
  mode: Int | Literal["abs", "diff"] | Default = Default("abs"),
2330
2911
  enable: String = Default(None),
2331
- extra_options: dict[str, Any] = None,
2912
+ extra_options: dict[str, Any] | None = None,
2332
2913
  ) -> VideoStream:
2333
2914
  """
2334
2915
 
@@ -2355,13 +2936,15 @@ def maskedthreshold(
2355
2936
  ),
2356
2937
  _source,
2357
2938
  _reference,
2358
- **{
2359
- "threshold": threshold,
2360
- "planes": planes,
2361
- "mode": mode,
2362
- "enable": enable,
2363
- }
2364
- | (extra_options or {}),
2939
+ **merge(
2940
+ {
2941
+ "threshold": threshold,
2942
+ "planes": planes,
2943
+ "mode": mode,
2944
+ "enable": enable,
2945
+ },
2946
+ extra_options,
2947
+ ),
2365
2948
  )
2366
2949
  return filter_node.video(0)
2367
2950
 
@@ -2378,7 +2961,7 @@ def mergeplanes(
2378
2961
  map2p: Int = Default(0),
2379
2962
  map3s: Int = Default(0),
2380
2963
  map3p: Int = Default(0),
2381
- extra_options: dict[str, Any] = None,
2964
+ extra_options: dict[str, Any] | None = None,
2382
2965
  ) -> VideoStream:
2383
2966
  """
2384
2967
 
@@ -2410,19 +2993,21 @@ def mergeplanes(
2410
2993
  typings_output=("video",),
2411
2994
  ),
2412
2995
  *streams,
2413
- **{
2414
- "mapping": mapping,
2415
- "format": format,
2416
- "map0s": map0s,
2417
- "map0p": map0p,
2418
- "map1s": map1s,
2419
- "map1p": map1p,
2420
- "map2s": map2s,
2421
- "map2p": map2p,
2422
- "map3s": map3s,
2423
- "map3p": map3p,
2424
- }
2425
- | (extra_options or {}),
2996
+ **merge(
2997
+ {
2998
+ "mapping": mapping,
2999
+ "format": format,
3000
+ "map0s": map0s,
3001
+ "map0p": map0p,
3002
+ "map1s": map1s,
3003
+ "map1p": map1p,
3004
+ "map2s": map2s,
3005
+ "map2p": map2p,
3006
+ "map3s": map3s,
3007
+ "map3p": map3p,
3008
+ },
3009
+ extra_options,
3010
+ ),
2426
3011
  )
2427
3012
  return filter_node.video(0)
2428
3013
 
@@ -2433,7 +3018,7 @@ def midequalizer(
2433
3018
  *,
2434
3019
  planes: Int = Default(15),
2435
3020
  enable: String = Default(None),
2436
- extra_options: dict[str, Any] = None,
3021
+ extra_options: dict[str, Any] | None = None,
2437
3022
  ) -> VideoStream:
2438
3023
  """
2439
3024
 
@@ -2458,11 +3043,13 @@ def midequalizer(
2458
3043
  ),
2459
3044
  _in0,
2460
3045
  _in1,
2461
- **{
2462
- "planes": planes,
2463
- "enable": enable,
2464
- }
2465
- | (extra_options or {}),
3046
+ **merge(
3047
+ {
3048
+ "planes": planes,
3049
+ "enable": enable,
3050
+ },
3051
+ extra_options,
3052
+ ),
2466
3053
  )
2467
3054
  return filter_node.video(0)
2468
3055
 
@@ -2477,7 +3064,7 @@ def mix(
2477
3064
  "longest"
2478
3065
  ),
2479
3066
  enable: String = Default(None),
2480
- extra_options: dict[str, Any] = None,
3067
+ extra_options: dict[str, Any] | None = None,
2481
3068
  ) -> VideoStream:
2482
3069
  """
2483
3070
 
@@ -2505,15 +3092,17 @@ def mix(
2505
3092
  typings_output=("video",),
2506
3093
  ),
2507
3094
  *streams,
2508
- **{
2509
- "inputs": inputs,
2510
- "weights": weights,
2511
- "scale": scale,
2512
- "planes": planes,
2513
- "duration": duration,
2514
- "enable": enable,
2515
- }
2516
- | (extra_options or {}),
3095
+ **merge(
3096
+ {
3097
+ "inputs": inputs,
3098
+ "weights": weights,
3099
+ "scale": scale,
3100
+ "planes": planes,
3101
+ "duration": duration,
3102
+ "enable": enable,
3103
+ },
3104
+ extra_options,
3105
+ ),
2517
3106
  )
2518
3107
  return filter_node.video(0)
2519
3108
 
@@ -2532,7 +3121,7 @@ def morpho(
2532
3121
  repeatlast: Boolean = Default(True),
2533
3122
  ts_sync_mode: Int | Literal["default", "nearest"] | Default = Default("default"),
2534
3123
  enable: String = Default(None),
2535
- extra_options: dict[str, Any] = None,
3124
+ extra_options: dict[str, Any] | None = None,
2536
3125
  ) -> VideoStream:
2537
3126
  """
2538
3127
 
@@ -2561,17 +3150,19 @@ def morpho(
2561
3150
  ),
2562
3151
  _default,
2563
3152
  _structure,
2564
- **{
2565
- "mode": mode,
2566
- "planes": planes,
2567
- "structure": structure,
2568
- "eof_action": eof_action,
2569
- "shortest": shortest,
2570
- "repeatlast": repeatlast,
2571
- "ts_sync_mode": ts_sync_mode,
2572
- "enable": enable,
2573
- }
2574
- | (extra_options or {}),
3153
+ **merge(
3154
+ {
3155
+ "mode": mode,
3156
+ "planes": planes,
3157
+ "structure": structure,
3158
+ "eof_action": eof_action,
3159
+ "shortest": shortest,
3160
+ "repeatlast": repeatlast,
3161
+ "ts_sync_mode": ts_sync_mode,
3162
+ "enable": enable,
3163
+ },
3164
+ extra_options,
3165
+ ),
2575
3166
  )
2576
3167
  return filter_node.video(0)
2577
3168
 
@@ -2585,7 +3176,7 @@ def msad(
2585
3176
  repeatlast: Boolean = Default(True),
2586
3177
  ts_sync_mode: Int | Literal["default", "nearest"] | Default = Default("default"),
2587
3178
  enable: String = Default(None),
2588
- extra_options: dict[str, Any] = None,
3179
+ extra_options: dict[str, Any] | None = None,
2589
3180
  ) -> VideoStream:
2590
3181
  """
2591
3182
 
@@ -2611,14 +3202,16 @@ def msad(
2611
3202
  ),
2612
3203
  _main,
2613
3204
  _reference,
2614
- **{
2615
- "eof_action": eof_action,
2616
- "shortest": shortest,
2617
- "repeatlast": repeatlast,
2618
- "ts_sync_mode": ts_sync_mode,
2619
- "enable": enable,
2620
- }
2621
- | (extra_options or {}),
3205
+ **merge(
3206
+ {
3207
+ "eof_action": eof_action,
3208
+ "shortest": shortest,
3209
+ "repeatlast": repeatlast,
3210
+ "ts_sync_mode": ts_sync_mode,
3211
+ "enable": enable,
3212
+ },
3213
+ extra_options,
3214
+ ),
2622
3215
  )
2623
3216
  return filter_node.video(0)
2624
3217
 
@@ -2631,7 +3224,7 @@ def multiply(
2631
3224
  offset: Float = Default(0.5),
2632
3225
  planes: Flags = Default("F"),
2633
3226
  enable: String = Default(None),
2634
- extra_options: dict[str, Any] = None,
3227
+ extra_options: dict[str, Any] | None = None,
2635
3228
  ) -> VideoStream:
2636
3229
  """
2637
3230
 
@@ -2656,13 +3249,15 @@ def multiply(
2656
3249
  ),
2657
3250
  _source,
2658
3251
  _factor,
2659
- **{
2660
- "scale": scale,
2661
- "offset": offset,
2662
- "planes": planes,
2663
- "enable": enable,
2664
- }
2665
- | (extra_options or {}),
3252
+ **merge(
3253
+ {
3254
+ "scale": scale,
3255
+ "offset": offset,
3256
+ "planes": planes,
3257
+ "enable": enable,
3258
+ },
3259
+ extra_options,
3260
+ ),
2666
3261
  )
2667
3262
  return filter_node.video(0)
2668
3263
 
@@ -2695,7 +3290,7 @@ def overlay(
2695
3290
  alpha: Int | Literal["straight", "premultiplied"] | Default = Default("straight"),
2696
3291
  ts_sync_mode: Int | Literal["default", "nearest"] | Default = Default("default"),
2697
3292
  enable: String = Default(None),
2698
- extra_options: dict[str, Any] = None,
3293
+ extra_options: dict[str, Any] | None = None,
2699
3294
  ) -> VideoStream:
2700
3295
  """
2701
3296
 
@@ -2726,19 +3321,170 @@ def overlay(
2726
3321
  ),
2727
3322
  _main,
2728
3323
  _overlay,
2729
- **{
2730
- "x": x,
2731
- "y": y,
2732
- "eof_action": eof_action,
2733
- "eval": eval,
2734
- "shortest": shortest,
2735
- "format": format,
2736
- "repeatlast": repeatlast,
2737
- "alpha": alpha,
2738
- "ts_sync_mode": ts_sync_mode,
2739
- "enable": enable,
2740
- }
2741
- | (extra_options or {}),
3324
+ **merge(
3325
+ {
3326
+ "x": x,
3327
+ "y": y,
3328
+ "eof_action": eof_action,
3329
+ "eval": eval,
3330
+ "shortest": shortest,
3331
+ "format": format,
3332
+ "repeatlast": repeatlast,
3333
+ "alpha": alpha,
3334
+ "ts_sync_mode": ts_sync_mode,
3335
+ "enable": enable,
3336
+ },
3337
+ extra_options,
3338
+ ),
3339
+ )
3340
+ return filter_node.video(0)
3341
+
3342
+
3343
+ def overlay_opencl(
3344
+ _main: VideoStream,
3345
+ _overlay: VideoStream,
3346
+ *,
3347
+ x: Int = Default(0),
3348
+ y: Int = Default(0),
3349
+ extra_options: dict[str, Any] | None = None,
3350
+ ) -> VideoStream:
3351
+ """
3352
+
3353
+ Overlay one video on top of another
3354
+
3355
+ Args:
3356
+ x: Overlay x position (from 0 to INT_MAX) (default 0)
3357
+ y: Overlay y position (from 0 to INT_MAX) (default 0)
3358
+
3359
+ Returns:
3360
+ default: the video stream
3361
+
3362
+ References:
3363
+ [FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#overlay_005fopencl)
3364
+
3365
+ """
3366
+ filter_node = filter_node_factory(
3367
+ FFMpegFilterDef(
3368
+ name="overlay_opencl",
3369
+ typings_input=("video", "video"),
3370
+ typings_output=("video",),
3371
+ ),
3372
+ _main,
3373
+ _overlay,
3374
+ **merge(
3375
+ {
3376
+ "x": x,
3377
+ "y": y,
3378
+ },
3379
+ extra_options,
3380
+ ),
3381
+ )
3382
+ return filter_node.video(0)
3383
+
3384
+
3385
+ def overlay_vaapi(
3386
+ _main: VideoStream,
3387
+ _overlay: VideoStream,
3388
+ *,
3389
+ x: String = Default("0"),
3390
+ y: String = Default("0"),
3391
+ w: String = Default("overlay_iw"),
3392
+ h: String = Default("overlay_ih*w/overlay_iw"),
3393
+ alpha: Float = Default(1.0),
3394
+ eof_action: Int
3395
+ | Literal["repeat", "endall", "pass", "repeat", "endall", "pass"]
3396
+ | Default = Default("repeat"),
3397
+ shortest: Boolean = Default(False),
3398
+ repeatlast: Boolean = Default(True),
3399
+ ts_sync_mode: Int | Literal["default", "nearest"] | Default = Default("default"),
3400
+ extra_options: dict[str, Any] | None = None,
3401
+ ) -> VideoStream:
3402
+ """
3403
+
3404
+ Overlay one video on top of another
3405
+
3406
+ Args:
3407
+ x: Overlay x position (default "0")
3408
+ y: Overlay y position (default "0")
3409
+ w: Overlay width (default "overlay_iw")
3410
+ h: Overlay height (default "overlay_ih*w/overlay_iw")
3411
+ alpha: Overlay global alpha (from 0 to 1) (default 1)
3412
+ eof_action: Action to take when encountering EOF from secondary input (from 0 to 2) (default repeat)
3413
+ shortest: force termination when the shortest input terminates (default false)
3414
+ repeatlast: repeat overlay of the last overlay frame (default true)
3415
+ ts_sync_mode: How strictly to sync streams based on secondary input timestamps (from 0 to 1) (default default)
3416
+
3417
+ Returns:
3418
+ default: the video stream
3419
+
3420
+ References:
3421
+ [FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#overlay_005fvaapi)
3422
+
3423
+ """
3424
+ filter_node = filter_node_factory(
3425
+ FFMpegFilterDef(
3426
+ name="overlay_vaapi",
3427
+ typings_input=("video", "video"),
3428
+ typings_output=("video",),
3429
+ ),
3430
+ _main,
3431
+ _overlay,
3432
+ **merge(
3433
+ {
3434
+ "x": x,
3435
+ "y": y,
3436
+ "w": w,
3437
+ "h": h,
3438
+ "alpha": alpha,
3439
+ "eof_action": eof_action,
3440
+ "shortest": shortest,
3441
+ "repeatlast": repeatlast,
3442
+ "ts_sync_mode": ts_sync_mode,
3443
+ },
3444
+ extra_options,
3445
+ ),
3446
+ )
3447
+ return filter_node.video(0)
3448
+
3449
+
3450
+ def overlay_vulkan(
3451
+ _main: VideoStream,
3452
+ _overlay: VideoStream,
3453
+ *,
3454
+ x: Int = Default(0),
3455
+ y: Int = Default(0),
3456
+ extra_options: dict[str, Any] | None = None,
3457
+ ) -> VideoStream:
3458
+ """
3459
+
3460
+ Overlay a source on top of another
3461
+
3462
+ Args:
3463
+ x: Set horizontal offset (from 0 to INT_MAX) (default 0)
3464
+ y: Set vertical offset (from 0 to INT_MAX) (default 0)
3465
+
3466
+ Returns:
3467
+ default: the video stream
3468
+
3469
+ References:
3470
+ [FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#overlay_005fvulkan)
3471
+
3472
+ """
3473
+ filter_node = filter_node_factory(
3474
+ FFMpegFilterDef(
3475
+ name="overlay_vulkan",
3476
+ typings_input=("video", "video"),
3477
+ typings_output=("video",),
3478
+ ),
3479
+ _main,
3480
+ _overlay,
3481
+ **merge(
3482
+ {
3483
+ "x": x,
3484
+ "y": y,
3485
+ },
3486
+ extra_options,
3487
+ ),
2742
3488
  )
2743
3489
  return filter_node.video(0)
2744
3490
 
@@ -2764,7 +3510,7 @@ def paletteuse(
2764
3510
  new: Boolean = Default(False),
2765
3511
  alpha_threshold: Int = Default(128),
2766
3512
  debug_kdtree: String = Default(None),
2767
- extra_options: dict[str, Any] = None,
3513
+ extra_options: dict[str, Any] | None = None,
2768
3514
  ) -> VideoStream:
2769
3515
  """
2770
3516
 
@@ -2793,15 +3539,17 @@ def paletteuse(
2793
3539
  ),
2794
3540
  _default,
2795
3541
  _palette,
2796
- **{
2797
- "dither": dither,
2798
- "bayer_scale": bayer_scale,
2799
- "diff_mode": diff_mode,
2800
- "new": new,
2801
- "alpha_threshold": alpha_threshold,
2802
- "debug_kdtree": debug_kdtree,
2803
- }
2804
- | (extra_options or {}),
3542
+ **merge(
3543
+ {
3544
+ "dither": dither,
3545
+ "bayer_scale": bayer_scale,
3546
+ "diff_mode": diff_mode,
3547
+ "new": new,
3548
+ "alpha_threshold": alpha_threshold,
3549
+ "debug_kdtree": debug_kdtree,
3550
+ },
3551
+ extra_options,
3552
+ ),
2805
3553
  )
2806
3554
  return filter_node.video(0)
2807
3555
 
@@ -2811,7 +3559,7 @@ def premultiply(
2811
3559
  planes: Int = Default(15),
2812
3560
  inplace: Boolean = Default(False),
2813
3561
  enable: String = Default(None),
2814
- extra_options: dict[str, Any] = None,
3562
+ extra_options: dict[str, Any] | None = None,
2815
3563
  ) -> VideoStream:
2816
3564
  """
2817
3565
 
@@ -2836,12 +3584,71 @@ def premultiply(
2836
3584
  typings_output=("video",),
2837
3585
  ),
2838
3586
  *streams,
2839
- **{
2840
- "planes": planes,
2841
- "inplace": inplace,
2842
- "enable": enable,
2843
- }
2844
- | (extra_options or {}),
3587
+ **merge(
3588
+ {
3589
+ "planes": planes,
3590
+ "inplace": inplace,
3591
+ "enable": enable,
3592
+ },
3593
+ extra_options,
3594
+ ),
3595
+ )
3596
+ return filter_node.video(0)
3597
+
3598
+
3599
+ def program_opencl(
3600
+ *streams: VideoStream,
3601
+ source: String = Default(None),
3602
+ kernel: String = Default(None),
3603
+ inputs: Int = Default(1),
3604
+ size: Image_size = Default(None),
3605
+ eof_action: Int | Literal["repeat", "endall", "pass"] | Default = Default("repeat"),
3606
+ shortest: Boolean = Default(False),
3607
+ repeatlast: Boolean = Default(True),
3608
+ ts_sync_mode: Int | Literal["default", "nearest"] | Default = Default("default"),
3609
+ extra_options: dict[str, Any] | None = None,
3610
+ ) -> VideoStream:
3611
+ """
3612
+
3613
+ Filter video using an OpenCL program
3614
+
3615
+ Args:
3616
+ source: OpenCL program source file
3617
+ kernel: Kernel name in program
3618
+ inputs: Number of inputs (from 1 to INT_MAX) (default 1)
3619
+ size: Video size
3620
+ eof_action: Action to take when encountering EOF from secondary input (from 0 to 2) (default repeat)
3621
+ shortest: force termination when the shortest input terminates (default false)
3622
+ repeatlast: extend last frame of secondary streams beyond EOF (default true)
3623
+ ts_sync_mode: How strictly to sync streams based on secondary input timestamps (from 0 to 1) (default default)
3624
+
3625
+ Returns:
3626
+ default: the video stream
3627
+
3628
+ References:
3629
+ [FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#program_005fopencl)
3630
+
3631
+ """
3632
+ filter_node = filter_node_factory(
3633
+ FFMpegFilterDef(
3634
+ name="program_opencl",
3635
+ typings_input="[StreamType.video] * int(inputs)",
3636
+ typings_output=("video",),
3637
+ ),
3638
+ *streams,
3639
+ **merge(
3640
+ {
3641
+ "source": source,
3642
+ "kernel": kernel,
3643
+ "inputs": inputs,
3644
+ "size": size,
3645
+ "eof_action": eof_action,
3646
+ "shortest": shortest,
3647
+ "repeatlast": repeatlast,
3648
+ "ts_sync_mode": ts_sync_mode,
3649
+ },
3650
+ extra_options,
3651
+ ),
2845
3652
  )
2846
3653
  return filter_node.video(0)
2847
3654
 
@@ -2858,7 +3665,7 @@ def psnr(
2858
3665
  repeatlast: Boolean = Default(True),
2859
3666
  ts_sync_mode: Int | Literal["default", "nearest"] | Default = Default("default"),
2860
3667
  enable: String = Default(None),
2861
- extra_options: dict[str, Any] = None,
3668
+ extra_options: dict[str, Any] | None = None,
2862
3669
  ) -> VideoStream:
2863
3670
  """
2864
3671
 
@@ -2887,17 +3694,19 @@ def psnr(
2887
3694
  ),
2888
3695
  _main,
2889
3696
  _reference,
2890
- **{
2891
- "stats_file": stats_file,
2892
- "stats_version": stats_version,
2893
- "output_max": output_max,
2894
- "eof_action": eof_action,
2895
- "shortest": shortest,
2896
- "repeatlast": repeatlast,
2897
- "ts_sync_mode": ts_sync_mode,
2898
- "enable": enable,
2899
- }
2900
- | (extra_options or {}),
3697
+ **merge(
3698
+ {
3699
+ "stats_file": stats_file,
3700
+ "stats_version": stats_version,
3701
+ "output_max": output_max,
3702
+ "eof_action": eof_action,
3703
+ "shortest": shortest,
3704
+ "repeatlast": repeatlast,
3705
+ "ts_sync_mode": ts_sync_mode,
3706
+ "enable": enable,
3707
+ },
3708
+ extra_options,
3709
+ ),
2901
3710
  )
2902
3711
  return filter_node.video(0)
2903
3712
 
@@ -2909,7 +3718,7 @@ def remap(
2909
3718
  *,
2910
3719
  format: Int | Literal["color", "gray"] | Default = Default("color"),
2911
3720
  fill: Color = Default("black"),
2912
- extra_options: dict[str, Any] = None,
3721
+ extra_options: dict[str, Any] | None = None,
2913
3722
  ) -> VideoStream:
2914
3723
  """
2915
3724
 
@@ -2935,11 +3744,57 @@ def remap(
2935
3744
  _source,
2936
3745
  _xmap,
2937
3746
  _ymap,
2938
- **{
2939
- "format": format,
2940
- "fill": fill,
2941
- }
2942
- | (extra_options or {}),
3747
+ **merge(
3748
+ {
3749
+ "format": format,
3750
+ "fill": fill,
3751
+ },
3752
+ extra_options,
3753
+ ),
3754
+ )
3755
+ return filter_node.video(0)
3756
+
3757
+
3758
+ def remap_opencl(
3759
+ _source: VideoStream,
3760
+ _xmap: VideoStream,
3761
+ _ymap: VideoStream,
3762
+ *,
3763
+ interp: Int | Literal["near", "linear"] | Default = Default("linear"),
3764
+ fill: Color = Default("black"),
3765
+ extra_options: dict[str, Any] | None = None,
3766
+ ) -> VideoStream:
3767
+ """
3768
+
3769
+ Remap pixels using OpenCL.
3770
+
3771
+ Args:
3772
+ interp: set interpolation method (from 0 to 1) (default linear)
3773
+ fill: set the color of the unmapped pixels (default "black")
3774
+
3775
+ Returns:
3776
+ default: the video stream
3777
+
3778
+ References:
3779
+ [FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#remap_005fopencl)
3780
+
3781
+ """
3782
+ filter_node = filter_node_factory(
3783
+ FFMpegFilterDef(
3784
+ name="remap_opencl",
3785
+ typings_input=("video", "video", "video"),
3786
+ typings_output=("video",),
3787
+ ),
3788
+ _source,
3789
+ _xmap,
3790
+ _ymap,
3791
+ **merge(
3792
+ {
3793
+ "interp": interp,
3794
+ "fill": fill,
3795
+ },
3796
+ extra_options,
3797
+ ),
2943
3798
  )
2944
3799
  return filter_node.video(0)
2945
3800
 
@@ -2960,7 +3815,7 @@ def sidechaincompress(
2960
3815
  detection: Int | Literal["peak", "rms"] | Default = Default("rms"),
2961
3816
  level_sc: Double = Default(1.0),
2962
3817
  mix: Double = Default(1.0),
2963
- extra_options: dict[str, Any] = None,
3818
+ extra_options: dict[str, Any] | None = None,
2964
3819
  ) -> AudioStream:
2965
3820
  """
2966
3821
 
@@ -2995,21 +3850,23 @@ def sidechaincompress(
2995
3850
  ),
2996
3851
  _main,
2997
3852
  _sidechain,
2998
- **{
2999
- "level_in": level_in,
3000
- "mode": mode,
3001
- "threshold": threshold,
3002
- "ratio": ratio,
3003
- "attack": attack,
3004
- "release": release,
3005
- "makeup": makeup,
3006
- "knee": knee,
3007
- "link": link,
3008
- "detection": detection,
3009
- "level_sc": level_sc,
3010
- "mix": mix,
3011
- }
3012
- | (extra_options or {}),
3853
+ **merge(
3854
+ {
3855
+ "level_in": level_in,
3856
+ "mode": mode,
3857
+ "threshold": threshold,
3858
+ "ratio": ratio,
3859
+ "attack": attack,
3860
+ "release": release,
3861
+ "makeup": makeup,
3862
+ "knee": knee,
3863
+ "link": link,
3864
+ "detection": detection,
3865
+ "level_sc": level_sc,
3866
+ "mix": mix,
3867
+ },
3868
+ extra_options,
3869
+ ),
3013
3870
  )
3014
3871
  return filter_node.audio(0)
3015
3872
 
@@ -3031,7 +3888,7 @@ def sidechaingate(
3031
3888
  link: Int | Literal["average", "maximum"] | Default = Default("average"),
3032
3889
  level_sc: Double = Default(1.0),
3033
3890
  enable: String = Default(None),
3034
- extra_options: dict[str, Any] = None,
3891
+ extra_options: dict[str, Any] | None = None,
3035
3892
  ) -> AudioStream:
3036
3893
  """
3037
3894
 
@@ -3067,22 +3924,24 @@ def sidechaingate(
3067
3924
  ),
3068
3925
  _main,
3069
3926
  _sidechain,
3070
- **{
3071
- "level_in": level_in,
3072
- "mode": mode,
3073
- "range": range,
3074
- "threshold": threshold,
3075
- "ratio": ratio,
3076
- "attack": attack,
3077
- "release": release,
3078
- "makeup": makeup,
3079
- "knee": knee,
3080
- "detection": detection,
3081
- "link": link,
3082
- "level_sc": level_sc,
3083
- "enable": enable,
3084
- }
3085
- | (extra_options or {}),
3927
+ **merge(
3928
+ {
3929
+ "level_in": level_in,
3930
+ "mode": mode,
3931
+ "range": range,
3932
+ "threshold": threshold,
3933
+ "ratio": ratio,
3934
+ "attack": attack,
3935
+ "release": release,
3936
+ "makeup": makeup,
3937
+ "knee": knee,
3938
+ "detection": detection,
3939
+ "link": link,
3940
+ "level_sc": level_sc,
3941
+ "enable": enable,
3942
+ },
3943
+ extra_options,
3944
+ ),
3086
3945
  )
3087
3946
  return filter_node.audio(0)
3088
3947
 
@@ -3098,7 +3957,7 @@ def signature(
3098
3957
  th_xh: Int = Default(116),
3099
3958
  th_di: Int = Default(0),
3100
3959
  th_it: Double = Default(0.5),
3101
- extra_options: dict[str, Any] = None,
3960
+ extra_options: dict[str, Any] | None = None,
3102
3961
  ) -> VideoStream:
3103
3962
  """
3104
3963
 
@@ -3129,18 +3988,20 @@ def signature(
3129
3988
  typings_output=("video",),
3130
3989
  ),
3131
3990
  *streams,
3132
- **{
3133
- "detectmode": detectmode,
3134
- "nb_inputs": nb_inputs,
3135
- "filename": filename,
3136
- "format": format,
3137
- "th_d": th_d,
3138
- "th_dc": th_dc,
3139
- "th_xh": th_xh,
3140
- "th_di": th_di,
3141
- "th_it": th_it,
3142
- }
3143
- | (extra_options or {}),
3991
+ **merge(
3992
+ {
3993
+ "detectmode": detectmode,
3994
+ "nb_inputs": nb_inputs,
3995
+ "filename": filename,
3996
+ "format": format,
3997
+ "th_d": th_d,
3998
+ "th_dc": th_dc,
3999
+ "th_xh": th_xh,
4000
+ "th_di": th_di,
4001
+ "th_it": th_it,
4002
+ },
4003
+ extra_options,
4004
+ ),
3144
4005
  )
3145
4006
  return filter_node.video(0)
3146
4007
 
@@ -3185,7 +4046,7 @@ def spectrumsynth(
3185
4046
  orientation: Int | Literal["vertical", "horizontal"] | Default = Default(
3186
4047
  "vertical"
3187
4048
  ),
3188
- extra_options: dict[str, Any] = None,
4049
+ extra_options: dict[str, Any] | None = None,
3189
4050
  ) -> AudioStream:
3190
4051
  """
3191
4052
 
@@ -3215,16 +4076,18 @@ def spectrumsynth(
3215
4076
  ),
3216
4077
  _magnitude,
3217
4078
  _phase,
3218
- **{
3219
- "sample_rate": sample_rate,
3220
- "channels": channels,
3221
- "scale": scale,
3222
- "slide": slide,
3223
- "win_func": win_func,
3224
- "overlap": overlap,
3225
- "orientation": orientation,
3226
- }
3227
- | (extra_options or {}),
4079
+ **merge(
4080
+ {
4081
+ "sample_rate": sample_rate,
4082
+ "channels": channels,
4083
+ "scale": scale,
4084
+ "slide": slide,
4085
+ "win_func": win_func,
4086
+ "overlap": overlap,
4087
+ "orientation": orientation,
4088
+ },
4089
+ extra_options,
4090
+ ),
3228
4091
  )
3229
4092
  return filter_node.audio(0)
3230
4093
 
@@ -3239,7 +4102,7 @@ def ssim(
3239
4102
  repeatlast: Boolean = Default(True),
3240
4103
  ts_sync_mode: Int | Literal["default", "nearest"] | Default = Default("default"),
3241
4104
  enable: String = Default(None),
3242
- extra_options: dict[str, Any] = None,
4105
+ extra_options: dict[str, Any] | None = None,
3243
4106
  ) -> VideoStream:
3244
4107
  """
3245
4108
 
@@ -3266,15 +4129,17 @@ def ssim(
3266
4129
  ),
3267
4130
  _main,
3268
4131
  _reference,
3269
- **{
3270
- "stats_file": stats_file,
3271
- "eof_action": eof_action,
3272
- "shortest": shortest,
3273
- "repeatlast": repeatlast,
3274
- "ts_sync_mode": ts_sync_mode,
3275
- "enable": enable,
3276
- }
3277
- | (extra_options or {}),
4132
+ **merge(
4133
+ {
4134
+ "stats_file": stats_file,
4135
+ "eof_action": eof_action,
4136
+ "shortest": shortest,
4137
+ "repeatlast": repeatlast,
4138
+ "ts_sync_mode": ts_sync_mode,
4139
+ "enable": enable,
4140
+ },
4141
+ extra_options,
4142
+ ),
3278
4143
  )
3279
4144
  return filter_node.video(0)
3280
4145
 
@@ -3283,7 +4148,7 @@ def streamselect(
3283
4148
  *streams: VideoStream,
3284
4149
  inputs: Int = Auto("len(streams)"),
3285
4150
  map: String = Default(None),
3286
- extra_options: dict[str, Any] = None,
4151
+ extra_options: dict[str, Any] | None = None,
3287
4152
  ) -> FilterNode:
3288
4153
  """
3289
4154
 
@@ -3308,11 +4173,13 @@ def streamselect(
3308
4173
  typings_output="[StreamType.video] * len(re.findall(r'\\d+', str(map)))",
3309
4174
  ),
3310
4175
  *streams,
3311
- **{
3312
- "inputs": inputs,
3313
- "map": map,
3314
- }
3315
- | (extra_options or {}),
4176
+ **merge(
4177
+ {
4178
+ "inputs": inputs,
4179
+ "map": map,
4180
+ },
4181
+ extra_options,
4182
+ ),
3316
4183
  )
3317
4184
 
3318
4185
  return filter_node
@@ -3326,7 +4193,7 @@ def threshold(
3326
4193
  *,
3327
4194
  planes: Int = Default(15),
3328
4195
  enable: String = Default(None),
3329
- extra_options: dict[str, Any] = None,
4196
+ extra_options: dict[str, Any] | None = None,
3330
4197
  ) -> VideoStream:
3331
4198
  """
3332
4199
 
@@ -3353,11 +4220,13 @@ def threshold(
3353
4220
  _threshold,
3354
4221
  _min,
3355
4222
  _max,
3356
- **{
3357
- "planes": planes,
3358
- "enable": enable,
3359
- }
3360
- | (extra_options or {}),
4223
+ **merge(
4224
+ {
4225
+ "planes": planes,
4226
+ "enable": enable,
4227
+ },
4228
+ extra_options,
4229
+ ),
3361
4230
  )
3362
4231
  return filter_node.video(0)
3363
4232
 
@@ -3367,7 +4236,7 @@ def unpremultiply(
3367
4236
  planes: Int = Default(15),
3368
4237
  inplace: Boolean = Default(False),
3369
4238
  enable: String = Default(None),
3370
- extra_options: dict[str, Any] = None,
4239
+ extra_options: dict[str, Any] | None = None,
3371
4240
  ) -> VideoStream:
3372
4241
  """
3373
4242
 
@@ -3392,12 +4261,14 @@ def unpremultiply(
3392
4261
  typings_output=("video",),
3393
4262
  ),
3394
4263
  *streams,
3395
- **{
3396
- "planes": planes,
3397
- "inplace": inplace,
3398
- "enable": enable,
3399
- }
3400
- | (extra_options or {}),
4264
+ **merge(
4265
+ {
4266
+ "planes": planes,
4267
+ "inplace": inplace,
4268
+ "enable": enable,
4269
+ },
4270
+ extra_options,
4271
+ ),
3401
4272
  )
3402
4273
  return filter_node.video(0)
3403
4274
 
@@ -3414,7 +4285,7 @@ def varblur(
3414
4285
  repeatlast: Boolean = Default(True),
3415
4286
  ts_sync_mode: Int | Literal["default", "nearest"] | Default = Default("default"),
3416
4287
  enable: String = Default(None),
3417
- extra_options: dict[str, Any] = None,
4288
+ extra_options: dict[str, Any] | None = None,
3418
4289
  ) -> VideoStream:
3419
4290
  """
3420
4291
 
@@ -3443,17 +4314,19 @@ def varblur(
3443
4314
  ),
3444
4315
  _default,
3445
4316
  _radius,
3446
- **{
3447
- "min_r": min_r,
3448
- "max_r": max_r,
3449
- "planes": planes,
3450
- "eof_action": eof_action,
3451
- "shortest": shortest,
3452
- "repeatlast": repeatlast,
3453
- "ts_sync_mode": ts_sync_mode,
3454
- "enable": enable,
3455
- }
3456
- | (extra_options or {}),
4317
+ **merge(
4318
+ {
4319
+ "min_r": min_r,
4320
+ "max_r": max_r,
4321
+ "planes": planes,
4322
+ "eof_action": eof_action,
4323
+ "shortest": shortest,
4324
+ "repeatlast": repeatlast,
4325
+ "ts_sync_mode": ts_sync_mode,
4326
+ "enable": enable,
4327
+ },
4328
+ extra_options,
4329
+ ),
3457
4330
  )
3458
4331
  return filter_node.video(0)
3459
4332
 
@@ -3467,7 +4340,7 @@ def vif(
3467
4340
  repeatlast: Boolean = Default(True),
3468
4341
  ts_sync_mode: Int | Literal["default", "nearest"] | Default = Default("default"),
3469
4342
  enable: String = Default(None),
3470
- extra_options: dict[str, Any] = None,
4343
+ extra_options: dict[str, Any] | None = None,
3471
4344
  ) -> VideoStream:
3472
4345
  """
3473
4346
 
@@ -3493,14 +4366,16 @@ def vif(
3493
4366
  ),
3494
4367
  _main,
3495
4368
  _reference,
3496
- **{
3497
- "eof_action": eof_action,
3498
- "shortest": shortest,
3499
- "repeatlast": repeatlast,
3500
- "ts_sync_mode": ts_sync_mode,
3501
- "enable": enable,
3502
- }
3503
- | (extra_options or {}),
4369
+ **merge(
4370
+ {
4371
+ "eof_action": eof_action,
4372
+ "shortest": shortest,
4373
+ "repeatlast": repeatlast,
4374
+ "ts_sync_mode": ts_sync_mode,
4375
+ "enable": enable,
4376
+ },
4377
+ extra_options,
4378
+ ),
3504
4379
  )
3505
4380
  return filter_node.video(0)
3506
4381
 
@@ -3509,7 +4384,7 @@ def vstack(
3509
4384
  *streams: VideoStream,
3510
4385
  inputs: Int = Auto("len(streams)"),
3511
4386
  shortest: Boolean = Default(False),
3512
- extra_options: dict[str, Any] = None,
4387
+ extra_options: dict[str, Any] | None = None,
3513
4388
  ) -> VideoStream:
3514
4389
  """
3515
4390
 
@@ -3533,11 +4408,55 @@ def vstack(
3533
4408
  typings_output=("video",),
3534
4409
  ),
3535
4410
  *streams,
3536
- **{
3537
- "inputs": inputs,
3538
- "shortest": shortest,
3539
- }
3540
- | (extra_options or {}),
4411
+ **merge(
4412
+ {
4413
+ "inputs": inputs,
4414
+ "shortest": shortest,
4415
+ },
4416
+ extra_options,
4417
+ ),
4418
+ )
4419
+ return filter_node.video(0)
4420
+
4421
+
4422
+ def vstack_vaapi(
4423
+ *streams: VideoStream,
4424
+ inputs: Int = Default(2),
4425
+ shortest: Boolean = Default(False),
4426
+ width: Int = Default(0),
4427
+ extra_options: dict[str, Any] | None = None,
4428
+ ) -> VideoStream:
4429
+ """
4430
+
4431
+ "VA-API" vstack
4432
+
4433
+ Args:
4434
+ inputs: Set number of inputs (from 2 to 65535) (default 2)
4435
+ shortest: Force termination when the shortest input terminates (default false)
4436
+ width: Set output width (0 to use the width of input 0) (from 0 to 65535) (default 0)
4437
+
4438
+ Returns:
4439
+ default: the video stream
4440
+
4441
+ References:
4442
+ [FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#vstack_005fvaapi)
4443
+
4444
+ """
4445
+ filter_node = filter_node_factory(
4446
+ FFMpegFilterDef(
4447
+ name="vstack_vaapi",
4448
+ typings_input="[StreamType.video] * int(inputs)",
4449
+ typings_output=("video",),
4450
+ ),
4451
+ *streams,
4452
+ **merge(
4453
+ {
4454
+ "inputs": inputs,
4455
+ "shortest": shortest,
4456
+ "width": width,
4457
+ },
4458
+ extra_options,
4459
+ ),
3541
4460
  )
3542
4461
  return filter_node.video(0)
3543
4462
 
@@ -3553,7 +4472,7 @@ def xcorrelate(
3553
4472
  repeatlast: Boolean = Default(True),
3554
4473
  ts_sync_mode: Int | Literal["default", "nearest"] | Default = Default("default"),
3555
4474
  enable: String = Default(None),
3556
- extra_options: dict[str, Any] = None,
4475
+ extra_options: dict[str, Any] | None = None,
3557
4476
  ) -> VideoStream:
3558
4477
  """
3559
4478
 
@@ -3583,16 +4502,18 @@ def xcorrelate(
3583
4502
  ),
3584
4503
  _primary,
3585
4504
  _secondary,
3586
- **{
3587
- "planes": planes,
3588
- "secondary": secondary,
3589
- "eof_action": eof_action,
3590
- "shortest": shortest,
3591
- "repeatlast": repeatlast,
3592
- "ts_sync_mode": ts_sync_mode,
3593
- "enable": enable,
3594
- }
3595
- | (extra_options or {}),
4505
+ **merge(
4506
+ {
4507
+ "planes": planes,
4508
+ "secondary": secondary,
4509
+ "eof_action": eof_action,
4510
+ "shortest": shortest,
4511
+ "repeatlast": repeatlast,
4512
+ "ts_sync_mode": ts_sync_mode,
4513
+ "enable": enable,
4514
+ },
4515
+ extra_options,
4516
+ ),
3596
4517
  )
3597
4518
  return filter_node.video(0)
3598
4519
 
@@ -3667,7 +4588,7 @@ def xfade(
3667
4588
  duration: Duration = Default(1.0),
3668
4589
  offset: Duration = Default(0.0),
3669
4590
  expr: String = Default(None),
3670
- extra_options: dict[str, Any] = None,
4591
+ extra_options: dict[str, Any] | None = None,
3671
4592
  ) -> VideoStream:
3672
4593
  """
3673
4594
 
@@ -3692,13 +4613,79 @@ def xfade(
3692
4613
  ),
3693
4614
  _main,
3694
4615
  _xfade,
3695
- **{
3696
- "transition": transition,
3697
- "duration": duration,
3698
- "offset": offset,
3699
- "expr": expr,
3700
- }
3701
- | (extra_options or {}),
4616
+ **merge(
4617
+ {
4618
+ "transition": transition,
4619
+ "duration": duration,
4620
+ "offset": offset,
4621
+ "expr": expr,
4622
+ },
4623
+ extra_options,
4624
+ ),
4625
+ )
4626
+ return filter_node.video(0)
4627
+
4628
+
4629
+ def xfade_opencl(
4630
+ _main: VideoStream,
4631
+ _xfade: VideoStream,
4632
+ *,
4633
+ transition: Int
4634
+ | Literal[
4635
+ "custom",
4636
+ "fade",
4637
+ "wipeleft",
4638
+ "wiperight",
4639
+ "wipeup",
4640
+ "wipedown",
4641
+ "slideleft",
4642
+ "slideright",
4643
+ "slideup",
4644
+ "slidedown",
4645
+ ]
4646
+ | Default = Default("fade"),
4647
+ source: String = Default(None),
4648
+ kernel: String = Default(None),
4649
+ duration: Duration = Default(1.0),
4650
+ offset: Duration = Default(0.0),
4651
+ extra_options: dict[str, Any] | None = None,
4652
+ ) -> VideoStream:
4653
+ """
4654
+
4655
+ Cross fade one video with another video.
4656
+
4657
+ Args:
4658
+ transition: set cross fade transition (from 0 to 9) (default fade)
4659
+ source: set OpenCL program source file for custom transition
4660
+ kernel: set kernel name in program file for custom transition
4661
+ duration: set cross fade duration (default 1)
4662
+ offset: set cross fade start relative to first input stream (default 0)
4663
+
4664
+ Returns:
4665
+ default: the video stream
4666
+
4667
+ References:
4668
+ [FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#xfade_005fopencl)
4669
+
4670
+ """
4671
+ filter_node = filter_node_factory(
4672
+ FFMpegFilterDef(
4673
+ name="xfade_opencl",
4674
+ typings_input=("video", "video"),
4675
+ typings_output=("video",),
4676
+ ),
4677
+ _main,
4678
+ _xfade,
4679
+ **merge(
4680
+ {
4681
+ "transition": transition,
4682
+ "source": source,
4683
+ "kernel": kernel,
4684
+ "duration": duration,
4685
+ "offset": offset,
4686
+ },
4687
+ extra_options,
4688
+ ),
3702
4689
  )
3703
4690
  return filter_node.video(0)
3704
4691
 
@@ -3713,7 +4700,7 @@ def xmedian(
3713
4700
  repeatlast: Boolean = Default(True),
3714
4701
  ts_sync_mode: Int | Literal["default", "nearest"] | Default = Default("default"),
3715
4702
  enable: String = Default(None),
3716
- extra_options: dict[str, Any] = None,
4703
+ extra_options: dict[str, Any] | None = None,
3717
4704
  ) -> VideoStream:
3718
4705
  """
3719
4706
 
@@ -3743,17 +4730,19 @@ def xmedian(
3743
4730
  typings_output=("video",),
3744
4731
  ),
3745
4732
  *streams,
3746
- **{
3747
- "inputs": inputs,
3748
- "planes": planes,
3749
- "percentile": percentile,
3750
- "eof_action": eof_action,
3751
- "shortest": shortest,
3752
- "repeatlast": repeatlast,
3753
- "ts_sync_mode": ts_sync_mode,
3754
- "enable": enable,
3755
- }
3756
- | (extra_options or {}),
4733
+ **merge(
4734
+ {
4735
+ "inputs": inputs,
4736
+ "planes": planes,
4737
+ "percentile": percentile,
4738
+ "eof_action": eof_action,
4739
+ "shortest": shortest,
4740
+ "repeatlast": repeatlast,
4741
+ "ts_sync_mode": ts_sync_mode,
4742
+ "enable": enable,
4743
+ },
4744
+ extra_options,
4745
+ ),
3757
4746
  )
3758
4747
  return filter_node.video(0)
3759
4748
 
@@ -3765,7 +4754,7 @@ def xstack(
3765
4754
  grid: Image_size = Default(None),
3766
4755
  shortest: Boolean = Default(False),
3767
4756
  fill: String = Default("none"),
3768
- extra_options: dict[str, Any] = None,
4757
+ extra_options: dict[str, Any] | None = None,
3769
4758
  ) -> VideoStream:
3770
4759
  """
3771
4760
 
@@ -3792,13 +4781,66 @@ def xstack(
3792
4781
  typings_output=("video",),
3793
4782
  ),
3794
4783
  *streams,
3795
- **{
3796
- "inputs": inputs,
3797
- "layout": layout,
3798
- "grid": grid,
3799
- "shortest": shortest,
3800
- "fill": fill,
3801
- }
3802
- | (extra_options or {}),
4784
+ **merge(
4785
+ {
4786
+ "inputs": inputs,
4787
+ "layout": layout,
4788
+ "grid": grid,
4789
+ "shortest": shortest,
4790
+ "fill": fill,
4791
+ },
4792
+ extra_options,
4793
+ ),
4794
+ )
4795
+ return filter_node.video(0)
4796
+
4797
+
4798
+ def xstack_vaapi(
4799
+ *streams: VideoStream,
4800
+ inputs: Int = Default(2),
4801
+ shortest: Boolean = Default(False),
4802
+ layout: String = Default(None),
4803
+ grid: Image_size = Default(None),
4804
+ grid_tile_size: Image_size = Default(None),
4805
+ fill: String = Default("none"),
4806
+ extra_options: dict[str, Any] | None = None,
4807
+ ) -> VideoStream:
4808
+ """
4809
+
4810
+ "VA-API" xstack
4811
+
4812
+ Args:
4813
+ inputs: Set number of inputs (from 2 to 65535) (default 2)
4814
+ shortest: Force termination when the shortest input terminates (default false)
4815
+ layout: Set custom layout
4816
+ grid: set fixed size grid layout
4817
+ grid_tile_size: set tile size in grid layout
4818
+ fill: Set the color for unused pixels (default "none")
4819
+
4820
+ Returns:
4821
+ default: the video stream
4822
+
4823
+ References:
4824
+ [FFmpeg Documentation](https://ffmpeg.org/ffmpeg-filters.html#xstack_005fvaapi)
4825
+
4826
+ """
4827
+ filter_node = filter_node_factory(
4828
+ FFMpegFilterDef(
4829
+ name="xstack_vaapi",
4830
+ typings_input="[StreamType.video] * int(inputs)",
4831
+ typings_output=("video",),
4832
+ ),
4833
+ *streams,
4834
+ **merge(
4835
+ {
4836
+ "inputs": inputs,
4837
+ "shortest": shortest,
4838
+ "layout": layout,
4839
+ "grid": grid,
4840
+ "grid_tile_size": grid_tile_size,
4841
+ "fill": fill,
4842
+ },
4843
+ extra_options,
4844
+ ),
3803
4845
  )
3804
4846
  return filter_node.video(0)