other ¶
Classes:
-
Dar
–A Fraction representing the Display Aspect Ratio.
-
Direction
–Enum to simplify the direction argument.
-
Region
–StrEnum signifying an analog television region.
-
Resolution
–Tuple representing a resolution.
-
Sar
–A Fraction representing the Sample Aspect Ratio.
-
SceneChangeMode
–Enum for various scene change modes.
Dar ¶
Bases: _Xar
A Fraction representing the Display Aspect Ratio.
This represents the dimensions of the physical display used to view the image. For more information, see https://en.wikipedia.org/wiki/Display_aspect_ratio.
Methods:
-
from_clip
–Get the DAR from the specified clip and SAR.
-
from_param
–Get the Xar from a Xar, a boolean, a float or a None object.
-
from_res
–Get the DAR from the specified dimensions and SAR.
-
to_sar
–Convert the DAR to a SAR object.
from_clip classmethod
¶
Get the DAR from the specified clip and SAR.
Parameters:
-
clip
¶VideoNode
) –Clip or frame that holds the frame properties.
-
sar
¶bool
, default:True
) –Whether to use SAR metadata.
Returns:
-
Self
–A DAR object created using the specified clip and SAR.
Source code
100 101 102 103 104 105 106 107 108 109 110 111 |
|
from_param classmethod
¶
Get the Xar from a Xar, a boolean, a float or a None object.
Parameters:
-
value
¶Self | bool | float | None
) –Value identifier.
-
fallback
¶Self | float
) –Fallback value.
Returns:
-
Self | None
–Xar object or None.
Source code
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
from_res classmethod
¶
Get the DAR from the specified dimensions and SAR.
Parameters:
-
width
¶int
) –The width of the image.
-
height
¶int
) –The height of the image.
-
sar
¶Sar | None
, default:None
) –The SAR object. Optional.
Returns:
-
Self
–A DAR object created using the specified dimensions and SAR.
Source code
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 |
|
to_sar ¶
Convert the DAR to a SAR object.
Parameters:
-
active_area
¶int | Fraction
) –The active image area. For more information, see
Sar.from_ar
. -
height
¶int
) –The height of the image.
Returns:
-
Sar
–A SAR object created using the DAR.
Source code
113 114 115 116 117 118 119 120 121 122 123 124 125 |
|
Direction ¶
Bases: CustomIntEnum
Enum to simplify the direction argument.
Attributes:
-
DOWN
– -
HORIZONTAL
– -
LEFT
– -
RIGHT
– -
UP
– -
VERTICAL
– -
is_axis
(bool
) –Whether the Direction represents an axis (horizontal/vertical).
-
is_way
(bool
) –Whether the Direction is one of the 4 arrow directions.
-
string
(str
) –A string representation of the Direction.
Region ¶
Bases: CustomStrEnum
StrEnum signifying an analog television region.
Methods:
-
from_framerate
–Determine the Region using a given framerate.
Attributes:
-
FILM
–True 24fps content.
-
NTSC
–The first American standard for analog television broadcast was developed by
-
NTSC_FILM
–NTSC 23.976fps content.
-
NTSCi
–Interlaced NTSC.
-
PAL
–Phase Alternating Line (PAL) colour encoding system.
-
PALi
–Interlaced PAL.
-
UNKNOWN
–Unknown region.
-
framerate
(Fraction
) –Obtain the Region's framerate.
NTSC class-attribute
instance-attribute
¶
NTSC = 'NTSC'
The first American standard for analog television broadcast was developed by National Television System Committee (NTSC) in 1941.
For more information see this <https://en.wikipedia.org/wiki/NTSC>
_.
PAL class-attribute
instance-attribute
¶
PAL = 'PAL'
Phase Alternating Line (PAL) colour encoding system.
For more information see this <https://en.wikipedia.org/wiki/PAL>
_.
from_framerate classmethod
¶
Determine the Region using a given framerate.
Source code
215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
|
Resolution ¶
Bases: NamedTuple
Tuple representing a resolution.
Methods:
-
from_video
–Create a Resolution object using a given clip's dimensions.
-
transpose
–Flip the Resolution matrix over its diagonal.
Attributes:
from_video classmethod
¶
from_video(clip: VideoNode) -> Self
Create a Resolution object using a given clip's dimensions.
Source code
253 254 255 256 257 258 259 260 261 |
|
transpose ¶
transpose() -> Self
Flip the Resolution matrix over its diagonal.
Source code
263 264 265 266 |
|
Sar ¶
Bases: _Xar
A Fraction representing the Sample Aspect Ratio.
This represents the aspect ratio of the pixels or samples of an image. It may also be known as the Pixel Aspect Ratio in certain scenarios. For more information, see https://en.wikipedia.org/wiki/Pixel_aspect_ratio.
Methods:
-
apply
–Apply the SAR values as _SARNum and _SARDen frame properties to a clip.
-
from_ar
–Calculate the SAR using a DAR object & active area. See
Dar.to_sar
for more information. -
from_clip
–Get the SAR from the clip's frame properties.
-
from_param
–Get the Xar from a Xar, a boolean, a float or a None object.
apply ¶
apply(clip: VideoNodeT) -> VideoNodeT
Apply the SAR values as _SARNum and _SARDen frame properties to a clip.
Source code
170 171 172 173 |
|
from_ar classmethod
¶
Calculate the SAR using a DAR object & active area. See Dar.to_sar
for more information.
For a list of known standards, refer to the following tables: <https://docs.google.com/spreadsheets/d/1pzVHFusLCI7kys2GzK9BTk3w7G8zcLxgHs3DMsurF7g>
_
Parameters:
-
active_area
¶int | Fraction
) –The active image area.
-
height
¶int
) –The height of the image.
-
dar
¶Dar
) –The DAR object.
Returns:
-
Self
–A SAR object created using DAR and active image area information.
Source code
151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 |
|
from_clip classmethod
¶
from_clip(clip: HoldsPropValueT) -> Self
Get the SAR from the clip's frame properties.
Parameters:
-
clip
¶HoldsPropValueT
) –Clip or frame that holds the frame properties.
Returns:
-
Self
–A SAR object of the SAR properties from the given clip.
Source code
137 138 139 140 141 142 143 144 145 146 147 148 149 |
|
from_param classmethod
¶
Get the Xar from a Xar, a boolean, a float or a None object.
Parameters:
-
value
¶Self | bool | float | None
) –Value identifier.
-
fallback
¶Self | float
) –Fallback value.
Returns:
-
Self | None
–Xar object or None.
Source code
46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
|
SceneChangeMode ¶
Bases: CustomIntEnum
Enum for various scene change modes.
Methods:
-
check_cb
– -
ensure_presence
–Ensures all the frame properties necessary for scene change detection are created.
-
lambda_cb
– -
prepare_clip
–Prepare a clip for scene change metric calculations.
Attributes:
-
SCXVID
–Get the scene changes using the vapoursynth-scxvid plugin https://github.com/dubhater/vapoursynth-scxvid.
-
WWXD
–Get the scene changes using the vapoursynth-wwxd plugin https://github.com/dubhater/vapoursynth-wwxd.
-
WWXD_SCXVID_INTERSECTION
–Only get the scene changes if both wwxd and scxvid mark a frame as being a scene change.
-
WWXD_SCXVID_UNION
–Get every scene change detected by both wwxd or scxvid.
-
is_SCXVID
(bool
) –Check whether a mode that uses scxvid is used.
-
is_WWXD
(bool
) –Check whether a mode that uses wwxd is used.
-
prop_keys
(Iterator[str]
) –
SCXVID class-attribute
instance-attribute
¶
SCXVID = 2
Get the scene changes using the vapoursynth-scxvid plugin https://github.com/dubhater/vapoursynth-scxvid.
WWXD class-attribute
instance-attribute
¶
WWXD = 1
Get the scene changes using the vapoursynth-wwxd plugin https://github.com/dubhater/vapoursynth-wwxd.
WWXD_SCXVID_INTERSECTION class-attribute
instance-attribute
¶
WWXD_SCXVID_INTERSECTION = 0
Only get the scene changes if both wwxd and scxvid mark a frame as being a scene change.
WWXD_SCXVID_UNION class-attribute
instance-attribute
¶
WWXD_SCXVID_UNION = 3
Get every scene change detected by both wwxd or scxvid.
check_cb ¶
Source code
343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 |
|
ensure_presence ¶
ensure_presence(
clip: VideoNode, akarin: bool | None = None
) -> ConstantFormatVideoNode
Ensures all the frame properties necessary for scene change detection are created.
Source code
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 |
|
lambda_cb ¶
Source code
361 362 363 |
|
prepare_clip ¶
prepare_clip(
clip: VideoNode,
height: int | Literal[False] = 360,
akarin: bool | None = None,
) -> ConstantFormatVideoNode
Prepare a clip for scene change metric calculations.
The clip will always be resampled to YUV420 8bit if it's not already, as that's what the plugins support.
Parameters:
-
clip
¶VideoNode
) –Clip to process.
-
height
¶int | Literal[False]
, default:360
) –Output height of the clip. Smaller frame sizes are faster to process, but may miss more scene changes or introduce more false positives. Width is automatically calculated.
False
means no resizing operation is performed. Default: 360. -
akarin
¶bool | None
, default:None
) –Use the akarin plugin for speed optimizations.
None
means it will check if its available, and if it is, use it. Default: None.
Returns:
-
ConstantFormatVideoNode
–A prepared clip for performing scene change metric calculations on.
Source code
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 |
|