info ¶
Functions:
-
expect_bits
–Expected output bitdepth for a clip.
-
get_color_family
–Get the color family of a given clip.
-
get_depth
–Get the bitdepth of a given clip or value.
-
get_framerate
–Get the framerate from any object holding it.
-
get_h
–Calculate the height given a width and an aspect ratio.
-
get_plane_sizes
–Get the size of a given clip's plane using the index.
-
get_resolutions
–Get a tuple containing the resolutions of every plane of the given clip.
-
get_sample_type
–Get the sample type of a given clip.
-
get_subsampling
–Get the subsampling of a clip as a human-readable name.
-
get_var_infos
–Get information from a variable resolution clip or frame.
-
get_video_format
–Retrieve a VapourSynth VideoFormat object from various input types.
-
get_w
–Calculate the width given a height and an aspect ratio.
expect_bits ¶
expect_bits(
clip: VideoNode, /, expected_depth: int = 16, **kwargs: Any
) -> tuple[ConstantFormatVideoNode, int]
Expected output bitdepth for a clip.
This function is meant to be used when a clip may not match the expected input bitdepth. Both the dithered clip and the original bitdepth are returned.
Parameters:
-
clip
¶VideoNode
) –Input clip.
-
expected_depth
¶int
, default:16
) –Expected bitdepth. Default: 16.
Returns:
-
tuple[ConstantFormatVideoNode, int]
–Tuple containing the clip dithered to the expected depth and the original bitdepth.
Source code in vstools/utils/info.py
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 |
|
get_color_family ¶
get_color_family(
clip: VideoFormatLike | HoldsVideoFormat | ColorFamily,
) -> ColorFamily
Get the color family of a given clip.
Source code in vstools/utils/info.py
109 110 111 112 113 114 115 116 117 |
|
get_depth ¶
get_depth(clip: VideoFormatLike | HoldsVideoFormat) -> int
Get the bitdepth of a given clip or value.
Source code in vstools/utils/info.py
90 91 92 93 94 95 |
|
get_framerate ¶
Get the framerate from any object holding it.
Source code in vstools/utils/info.py
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
|
get_h ¶
get_h(
width: float,
ar_or_ref: VideoNode | VideoFrame | SupportsFloat | Dar | Sar = 16 / 9,
/,
mod: int | None = None,
) -> int
Calculate the height given a width and an aspect ratio.
Either an aspect ratio (as a float), a reference clip, or a Dar/Sar object can be given. A mod can also be set, which will ensure the output height is MOD#.
The output is rounded by default (as fractional output resolutions are not supported anywhere).
Parameters:
-
width
¶float
) –Width to use for the calculation.
-
ar_or_ref
¶VideoNode | VideoFrame | SupportsFloat | Dar | Sar
, default:16 / 9
) –Aspect ratio, reference clip, or Dar/Sar object from which the AR will be calculated. Default: 1.778 (16 / 9).
-
mod
¶int | None
, default:None
) –Mod for the output width to comply to. If None, do not force it to comply to anything. Default: None.
Returns:
-
int
–Calculated height.
Source code in vstools/utils/info.py
305 306 307 308 309 310 311 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 |
|
get_plane_sizes ¶
Get the size of a given clip's plane using the index.
Source code in vstools/utils/info.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 |
|
get_resolutions ¶
Get a tuple containing the resolutions of every plane of the given clip.
Source code in vstools/utils/info.py
177 178 179 180 181 182 183 184 |
|
get_sample_type ¶
get_sample_type(
clip: VideoFormatLike | HoldsVideoFormat | SampleType,
) -> SampleType
Get the sample type of a given clip.
Source code in vstools/utils/info.py
98 99 100 101 102 103 104 105 106 |
|
get_subsampling ¶
get_subsampling(clip: VideoFormatLike | HoldsVideoFormat) -> str | None
Get the subsampling of a clip as a human-readable name.
Parameters:
-
clip
¶VideoFormatLike | HoldsVideoFormat
) –Input clip.
Returns:
-
str | None
–String with a human-readable name.
Raises:
-
CustomValueError
–Unknown subsampling.
Source code in vstools/utils/info.py
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 |
|
get_var_infos ¶
Get information from a variable resolution clip or frame.
Source code in vstools/utils/info.py
32 33 34 35 36 37 38 39 40 41 42 43 |
|
get_video_format ¶
get_video_format(
value: int | VideoFormatLike | HoldsVideoFormat,
/,
*,
sample_type: int | SampleType | None = None,
) -> VideoFormat
Retrieve a VapourSynth VideoFormat object from various input types.
Parameters:
-
value
¶int | VideoFormatLike | HoldsVideoFormat
) –The format source. This can be:
- A bidepth format if
value < 32
- A unique format ID
- A VideoFormat-like object
- An object holding a VideoFormat (i.e., exposing a
format
attribute)
- A bidepth format if
-
sample_type
¶int | SampleType | None
, default:None
) –Optional override for the sample type. Accepts either an integer or a SampleType. If None, the default or inferred sample type is used.
Returns:
-
VideoFormat
–A VideoFormat object derived from the input.
Source code in vstools/utils/info.py
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
|
get_w ¶
get_w(
height: float,
ar_or_ref: VideoNode | VideoFrame | SupportsFloat | Dar | Sar = 16 / 9,
/,
mod: int | None = None,
) -> int
Calculate the width given a height and an aspect ratio.
Either an aspect ratio (as a float), a reference clip, or a Dar/Sar object can be given. A mod can also be set, which will ensure the output width is MOD#.
The output is rounded by default (as fractional output resolutions are not supported anywhere).
Parameters:
-
height
¶float
) –Height to use for the calculation.
-
ar_or_ref
¶VideoNode | VideoFrame | SupportsFloat | Dar | Sar
, default:16 / 9
) –Aspect ratio, reference clip, or Dar/Sar object from which the AR will be calculated. Default: 1.778 (16 / 9).
-
mod
¶int | None
, default:None
) –Mod for the output width to comply to. If None, do not force it to comply to anything. Default: None.
Returns:
-
int
–Calculated width.
Source code in vstools/utils/info.py
243 244 245 246 247 248 249 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 |
|