normalize ¶
Functions:
-
flatten
–Flatten an array of values, clips and frames included.
-
flatten_vnodes
–Flatten an array of VideoNodes.
-
invert_planes
–Invert a sequence of planes.
-
invert_ranges
–Invert FrameRanges.
-
normalize_param_planes
–Normalize a value or sequence to a list mapped to the clip's planes.
-
normalize_planes
–Normalize a sequence of planes.
-
normalize_ranges
–Normalize ranges to a list of positive ranges.
-
normalize_seq
–Normalize a sequence to the given length.
flatten ¶
Flatten an array of values, clips and frames included.
Source code
124 125 126 127 128 129 130 |
|
flatten_vnodes ¶
flatten_vnodes(
*clips: VideoNodeIterableT[VideoNodeT], split_planes: Literal[False] = ...
) -> Sequence[VideoNodeT]
flatten_vnodes(
*clips: VideoNodeIterableT[VideoNodeT], split_planes: Literal[True] = ...
) -> Sequence[ConstantFormatVideoNode]
flatten_vnodes(
*clips: VideoNodeIterableT[VideoNodeT], split_planes: bool = ...
) -> Sequence[VideoNodeT]
flatten_vnodes(
*clips: VideoNodeIterableT[VideoNodeT], split_planes: bool = False
) -> Sequence[VideoNode]
Flatten an array of VideoNodes.
Parameters:
-
clips
¶VideoNodeIterableT[VideoNodeT]
, default:()
) –An array of clips to flatten into a list.
-
split_planes
¶bool
, default:False
) –Optionally split the VideoNodes into their individual planes as well. Default: False.
Returns:
-
Sequence[VideoNode]
–Flattened list of VideoNodes.
Source code
153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
|
invert_planes ¶
Invert a sequence of planes.
Parameters:
-
clip
¶VideoNode
) –Input clip.
-
planes
¶PlanesT
, default:None
) –Array of planes. If None, selects all planes of the input clip's format.
Returns:
Source code
68 69 70 71 72 73 74 75 76 77 |
|
invert_ranges ¶
invert_ranges(
clipa: VideoNode,
clipb: VideoNode | None,
ranges: FrameRangeN | FrameRangesN,
) -> list[tuple[int, int]]
Invert FrameRanges.
Example:
.. code-block:: python
>>> franges = [(100, 200), 600, (1200, 2400)]
>>> invert_ranges(core.std.BlankClip(length=10000), core.std.BlankClip(length=10000), franges)
[(0, 99), (201, 599), (601, 1199), (2401, 9999)]
Parameters:
-
clipa
¶VideoNode
) –Original clip.
-
clipb
¶VideoNode | None
) –Replacement clip.
-
ranges
¶FrameRangeN | FrameRangesN
) –Ranges to replace clipa (original clip) with clipb (replacement clip). These ranges will be inverted. For more info, see
replace_ranges
.
Returns:
Source code
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
|
normalize_param_planes ¶
normalize_param_planes(
clip: VideoNode,
param: T | Sequence[T],
planes: PlanesT,
null: T,
func: FuncExceptT | None = None,
) -> list[T]
Normalize a value or sequence to a list mapped to the clip's planes.
For any plane not included in planes
, the corresponding output value is set to null
.
Parameters:
-
clip
¶VideoNode
) –The input clip whose format and number of planes will be used to determine mapping.
-
param
¶T | Sequence[T]
) –A single value or a sequence of values to normalize across the clip's planes.
-
planes
¶PlanesT
) –The planes to apply the values to. Other planes will receive
null
. -
null
¶T
) –The default value to use for planes that are not included in
planes
. -
func
¶FuncExceptT | None
, default:None
) –Function returned for custom error handling.
Returns:
-
list[T]
–A list of length equal to the number of planes in the clip, with
param
values ornull
.
Source code
80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 |
|
normalize_planes ¶
Normalize a sequence of planes.
Parameters:
-
clip
¶VideoNode
) –Input clip.
-
planes
¶PlanesT
, default:None
) –Array of planes. If None, returns all planes of the input clip's format. Default: None.
Returns:
Source code
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
|
normalize_ranges ¶
normalize_ranges(
clip: VideoNode, ranges: FrameRangeN | FrameRangesN
) -> list[tuple[int, int]]
Normalize ranges to a list of positive ranges.
Frame ranges can include None
and negative values. None will be converted to either 0 if it's the first value in a FrameRange, or the clip's length if it's the second item. Negative values will be subtracted from the clip's length.
Examples:
.. code-block:: python
>>> clip.num_frames
1000
>>> normalize_ranges(clip, (None, None))
[(0, 999)]
>>> normalize_ranges(clip, (24, -24))
[(24, 975)]
>>> normalize_ranges(clip, [(24, 100), (80, 150)])
[(24, 150)]
Parameters:
-
clip
¶VideoNode
) –Input clip.
-
ranges
¶FrameRangeN | FrameRangesN
) –Frame range or list of frame ranges.
Returns:
Source code
176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
|
normalize_seq ¶
Normalize a sequence to the given length.
Source code
41 42 43 44 |
|