misc ¶
Classes:
-
SceneAverageStats
– -
padder
–Pad out the pixels on the sides by the given amount of pixels.
-
padder_ctx
–Context manager for the padder class.
Functions:
-
change_fps
–Convert the framerate of a clip.
-
match_clip
–Try to match the formats, dimensions, etc. of a reference clip to match the original clip.
-
pick_func_stype
–Pick the function matching the sample type of the clip's format.
-
set_output
–
SceneAverageStats ¶
SceneAverageStats(
clip: VideoNode,
keyframes: Keyframes | str,
prop: str = "SceneStats",
plane: int = 0,
cache_size: int = 5,
)
Bases: SceneBasedDynamicCache
Classes:
-
cache
–
Methods:
Attributes:
-
cache_size
– -
clip
– -
keyframes
– -
prop_keys
– -
scene_avgs
–
Source code
664 665 666 667 668 669 670 671 |
|
cache ¶
from_clip classmethod
¶
Source code
138 139 140 |
|
get_clip ¶
get_clip(key: int) -> VideoNode
Source code
673 674 |
|
get_eval ¶
get_eval() -> VideoNode
Source code
135 136 |
|
padder ¶
Pad out the pixels on the sides by the given amount of pixels.
Methods:
-
COLOR
–Pad a clip with a constant color.
-
MIRROR
–Pad a clip with reflect mode. This will reflect the clip on each side.
-
REPEAT
–Pad a clip with repeat mode. This will simply repeat the last row/column till the end.
-
mod_padding
– -
mod_padding_crop
–
Attributes:
-
ctx
–
COLOR classmethod
¶
COLOR(
clip: VideoNode,
left: int = 0,
right: int = 0,
top: int = 0,
bottom: int = 0,
color: (
int
| float
| bool
| None
| MissingT
| Sequence[int | float | bool | None | MissingT]
) = (False, MISSING),
) -> ConstantFormatVideoNode
Pad a clip with a constant color.
Visual example:
```
>>> |ABCDE
>>> padder.COLOR(left=3, color=Z)
>>> ZZZ|ABCDE
```
Parameters:
-
clip
¶VideoNode
) –Input clip.
-
left
¶int
, default:0
) –Padding added to the left side of the clip.
-
right
¶int
, default:0
) –Padding added to the right side of the clip.
-
top
¶int
, default:0
) –Padding added to the top side of the clip.
-
bottom
¶int
, default:0
) –Padding added to the bottom side of the clip.
-
color
¶int | float | bool | None | MissingT | Sequence[int | float | bool | None | MissingT]
, default:(False, MISSING)
) –Constant color that should be added on the sides: * number: This will be treated as such and not converted or clamped. * False: Lowest value for this clip format and color range. * True: Highest value for this clip format and color range. * None: Neutral value for this clip format. * MISSING: Automatically set to False if RGB, else None.
Returns:
-
ConstantFormatVideoNode
–Padded clip with colored borders.
Source code
312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 |
|
MIRROR classmethod
¶
MIRROR(
clip: VideoNodeT,
left: int = 0,
right: int = 0,
top: int = 0,
bottom: int = 0,
) -> VideoNodeT
Pad a clip with reflect mode. This will reflect the clip on each side.
Visual example:
```
>>> |ABCDE
>>> padder.MIRROR(left=3)
>>> CBA|ABCDE
```
Parameters:
-
clip
¶VideoNodeT
) –Input clip.
-
left
¶int
, default:0
) –Padding added to the left side of the clip.
-
right
¶int
, default:0
) –Padding added to the right side of the clip.
-
top
¶int
, default:0
) –Padding added to the top side of the clip.
-
bottom
¶int
, default:0
) –Padding added to the bottom side of the clip.
Returns:
-
VideoNodeT
–Padded clip with reflected borders.
Source code
216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 |
|
REPEAT classmethod
¶
REPEAT(
clip: VideoNode,
left: int = 0,
right: int = 0,
top: int = 0,
bottom: int = 0,
) -> ConstantFormatVideoNode
Pad a clip with repeat mode. This will simply repeat the last row/column till the end.
Visual example:
```
>>> |ABCDE
>>> padder.REPEAT(left=3)
>>> AAA|ABCDE
```
Parameters:
-
clip
¶VideoNode
) –Input clip.
-
left
¶int
, default:0
) –Padding added to the left side of the clip.
-
right
¶int
, default:0
) –Padding added to the right side of the clip.
-
top
¶int
, default:0
) –Padding added to the top side of the clip.
-
bottom
¶int
, default:0
) –Padding added to the bottom side of the clip.
Returns:
-
ConstantFormatVideoNode
–Padded clip with repeated borders.
Source code
250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 |
|
mod_padding classmethod
¶
mod_padding(
sizes: tuple[int, int] | VideoNode,
mod: int = 16,
min: int = 4,
align: Align = MIDDLE_CENTER,
) -> tuple[int, int, int, int]
Source code
388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 |
|
mod_padding_crop classmethod
¶
mod_padding_crop(
sizes: tuple[int, int] | VideoNode,
mod: int = 16,
min: int = 4,
crop_scale: float | tuple[float, float] = 2,
align: Align = MIDDLE_CENTER,
) -> tuple[tuple[int, int, int, int], tuple[int, int, int, int]]
Source code
413 414 415 416 417 418 419 420 |
|
padder_ctx ¶
Bases: AbstractContextManager['padder_ctx']
Context manager for the padder class.
Parameters:
-
mod
¶int
, default:8
) –The modulus used for calculations or constraints. Defaults to 8.
-
min
¶int
, default:0
) –The minimum value allowed or used as a base threshold. Defaults to 0.
-
align
¶Align
, default:MIDDLE_CENTER
) –The alignment configuration. Defaults to Align.MIDDLE_CENTER.
Methods:
-
COLOR
–Pad a clip with a constant color.
-
CROP
–Crop a clip with the padding values.
-
MIRROR
–Pad a clip with reflect mode. This will reflect the clip on each side.
-
REPEAT
–Pad a clip with repeat mode. This will simply repeat the last row/column till the end.
Attributes:
Source code
106 107 108 109 110 111 112 113 114 115 |
|
COLOR ¶
COLOR(
clip: VideoNode,
color: int | float | bool | None | Sequence[int | float | bool | None] = (
False,
None,
),
) -> ConstantFormatVideoNode
Pad a clip with a constant color.
Parameters:
-
clip
¶VideoNode
) –Input clip.
-
color
¶int | float | bool | None | Sequence[int | float | bool | None]
, default:(False, None)
) –Constant color that should be added on the sides: * number: This will be treated as such and not converted or clamped. * False: Lowest value for this clip format and color range. * True: Highest value for this clip format and color range. * None: Neutral value for this clip format. * MISSING: Automatically set to False if RGB, else None.
Returns:
-
ConstantFormatVideoNode
–Padded clip with colored borders.
Source code
158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
|
CROP ¶
CROP(
clip: VideoNode, crop_scale: float | tuple[float, float] | None = None
) -> ConstantFormatVideoNode
Crop a clip with the padding values.
Parameters:
-
clip
¶VideoNode
) –Input clip.
-
crop_scale
¶float | tuple[float, float] | None
, default:None
) –Optional scale factor for the padding values. If None, no scaling is applied.
Returns:
-
ConstantFormatVideoNode
–Cropped clip.
Source code
117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 |
|
MIRROR ¶
MIRROR(clip: VideoNodeT) -> VideoNodeT
Pad a clip with reflect mode. This will reflect the clip on each side.
Parameters:
-
clip
¶VideoNodeT
) –Input clip.
Returns:
-
VideoNodeT
–Padded clip with reflected borders.
Source code
134 135 136 137 138 139 140 141 142 143 144 |
|
REPEAT ¶
REPEAT(clip: VideoNode) -> ConstantFormatVideoNode
Pad a clip with repeat mode. This will simply repeat the last row/column till the end.
Parameters:
-
clip
¶VideoNode
) –Input clip.
Returns:
-
ConstantFormatVideoNode
–Padded clip with repeated borders.
Source code
146 147 148 149 150 151 152 153 154 155 156 |
|
change_fps ¶
Convert the framerate of a clip.
This is different from AssumeFPS as this will actively adjust the framerate of a clip, rather than simply set the framerate properties.
Parameters:
-
clip
¶VideoNode
) –Input clip.
-
fps
¶Fraction
) –Framerate to convert the clip to. Must be a Fraction.
Returns:
-
VideoNode
–Clip with the framerate converted and frames adjusted as necessary.
Source code
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
|
match_clip ¶
match_clip(
clip: VideoNode,
ref: VideoNode,
dimensions: bool = True,
vformat: bool = True,
matrices: bool = True,
length: bool = False,
) -> VideoNode
Try to match the formats, dimensions, etc. of a reference clip to match the original clip.
Parameters:
-
clip
¶VideoNode
) –Original clip.
-
ref
¶VideoNode
) –Reference clip.
-
dimensions
¶bool
, default:True
) –Whether to adjust the dimensions of the reference clip to match the original clip. If True, uses resize.Bicubic to resize the image. Default: True.
-
vformat
¶bool
, default:True
) –Whether to change the reference clip's format to match the original clip's. Default: True.
-
matrices
¶bool
, default:True
) –Whether to adjust the Matrix, Transfer, and Primaries of the reference clip to match the original clip. Default: True.
-
length
¶bool
, default:False
) –Whether to adjust the length of the reference clip to match the original clip.
Source code
65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
|
pick_func_stype ¶
pick_func_stype(
clip: VideoNode,
func_int: Callable[P, VideoNodeT],
func_float: Callable[P, VideoNodeT],
) -> Callable[P, VideoNodeT]
Pick the function matching the sample type of the clip's format.
Parameters:
-
clip
¶VideoNode
) –Input clip.
-
func_int
¶Callable[P, VideoNodeT]
) –Function to run on integer clips.
-
func_float
¶Callable[P, VideoNodeT]
) –Function to run on float clips.
Returns:
-
Callable[P, VideoNodeT]
–Function matching the sample type of your clip's format.
Source code
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 |
|
set_output ¶
set_output(
node: VideoNode,
index: int = ...,
/,
*,
alpha: VideoNode | None = ...,
**kwargs: Any,
) -> None
set_output(
node: VideoNode,
name: str | bool | None = ...,
/,
*,
alpha: VideoNode | None = ...,
**kwargs: Any,
) -> None
set_output(
node: VideoNode,
index: int = ...,
name: str | bool | None = ...,
/,
alpha: VideoNode | None = ...,
**kwargs: Any,
) -> None
set_output(
node: AudioNode,
index: int = ...,
name: str | bool | None = ...,
/,
**kwargs: Any,
) -> None
set_output(
node: Iterable[RawNode | Iterable[RawNode | Iterable[RawNode]]],
index: int | Sequence[int] = ...,
/,
**kwargs: Any,
) -> None
set_output(
node: RawNode | Iterable[RawNode | Iterable[RawNode | Iterable[RawNode]]],
index_or_name: int | Sequence[int] | str | bool | None = None,
name: str | bool | None = None,
/,
alpha: VideoNode | None = None,
**kwargs: Any,
) -> None
Source code
596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 |
|