generic ¶
ChromaLocationT module-attribute
¶
ChromaLocationT: TypeAlias = Union[int, ChromaLocation, ChromaLocation]
Type alias for values that can be used to initialize a :py:attr:ChromaLocation
.
FieldBasedT module-attribute
¶
FieldBasedT: TypeAlias = Union[int, FieldBased, FieldBased]
Type alias for values that can be used to initialize a :py:attr:FieldBased
.
ChromaLocation ¶
Bases: _ChromaLocationMeta
Chroma sample position in YUV formats.
apply ¶
apply(clip: VideoNode) -> VideoNode
Applies the property to the VideoNode.
Source code
122 123 124 125 |
|
ensure_presence classmethod
¶
ensure_presence(
clip: VideoNode,
value: int | SelfPropEnum | None,
func: FuncExceptT | None = None,
) -> VideoNode
Ensure the presence of the property in the VideoNode.
Source code
112 113 114 115 116 117 118 119 120 |
|
ensure_presences staticmethod
¶
ensure_presences(
clip: VideoNode,
prop_enums: Iterable[type[SelfPropEnum] | SelfPropEnum],
func: FuncExceptT | None = None,
) -> VideoNode
Ensure the presence of multiple PropEnums at once.
Source code
127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
from_param classmethod
¶
from_param(value: None, func_except: FuncExceptT | None = None) -> None
from_param(
value: int | ChromaLocation | ChromaLocationT,
func_except: FuncExceptT | None = None,
) -> ChromaLocation
from_param(
value: int | ChromaLocation | ChromaLocationT | None,
func_except: FuncExceptT | None = None,
) -> ChromaLocation | None
from_param(value: Any, func_except: Any = None) -> ChromaLocation | None
Determine the ChromaLocation through a parameter.
Parameters:
-
value
¶Any
) –Value or ChromaLocation object.
-
func_except
¶Any
, default:None
) –Function returned for custom error handling. This should only be set by VS package developers.
Returns:
-
ChromaLocation | None
–ChromaLocation object or None.
Source code
395 396 397 398 399 400 401 402 403 404 405 |
|
from_param_or_video classmethod
¶
from_param_or_video(
value: int | ChromaLocation | ChromaLocationT | None,
src: VideoNode | VideoFrame | FrameProps,
strict: bool = False,
func_except: FuncExceptT | None = None,
) -> ChromaLocation
Source code
407 408 409 410 411 412 413 |
|
from_res classmethod
¶
from_res(frame: VideoNode | VideoFrame) -> ChromaLocation
Guess the chroma location based on the clip's resolution.
Parameters:
-
frame
¶VideoNode | VideoFrame
) –Input clip or frame.
Returns:
-
ChromaLocation
–ChromaLocation object.
Source code
43 44 45 46 47 48 49 50 51 52 53 |
|
from_video classmethod
¶
from_video(
src: VideoNode | VideoFrame | FrameProps,
strict: bool = False,
func: FuncExceptT | None = None,
) -> ChromaLocation
Obtain the chroma location of a clip from the frame properties.
Parameters:
-
src
¶VideoNode | VideoFrame | FrameProps
) –Input clip, frame, or props.
-
strict
¶bool
, default:False
) –Be strict about the properties. The result may NOT be an unknown value.
Returns:
-
ChromaLocation
–ChromaLocation object.
Raises:
-
UndefinedChromaLocationError
–Chroma location is undefined.
-
UndefinedChromaLocationError
–Chroma location can not be determined from the frame properties.
Source code
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
|
get_offsets classmethod
¶
get_offsets(chroma_loc: ChromaLocation | VideoNode) -> tuple[float, float]
Get (left,top) shift for chroma relative to luma.
This is only useful if you MUST use a pre-specified chroma location and shift the chroma yourself.
Source code
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 101 102 103 104 105 106 107 108 109 110 111 112 113 |
|
is_unknown classmethod
¶
is_unknown(value: int | SelfPropEnum) -> bool
Whether the value represents an unknown value.
Source code
24 25 26 27 28 |
|
is_valid classmethod
¶
Check if the given value is a valid int value of this enum.
Source code
153 154 155 156 |
|
FieldBased ¶
Bases: _FieldBasedMeta
Whether the frame is composed of two independent fields (interlaced) and their order if so.
BFF class-attribute
instance-attribute
¶
BFF = 1
The frame is interlaced and the field order is bottom field first.
TFF class-attribute
instance-attribute
¶
TFF = 2
The frame is interlaced and the field order is top field first.
field property
¶
field: int
Check what field the enum signifies.
Raises:
-
UnsupportedFieldBasedError
–PROGRESSIVE value is passed.
inverted_field property
¶
inverted_field: FieldBased
Get the inverted field order.
Raises:
-
UnsupportedFieldBasedError
–PROGRESSIVE value is passed.
apply ¶
apply(clip: VideoNode) -> VideoNode
Applies the property to the VideoNode.
Source code
122 123 124 125 |
|
ensure_presence classmethod
¶
ensure_presence(
clip: VideoNode,
tff: int | FieldBasedT | bool | None,
func: FuncExceptT | None = None,
) -> VideoNode
Source code
470 471 472 473 474 475 476 |
|
ensure_presences staticmethod
¶
ensure_presences(
clip: VideoNode,
prop_enums: Iterable[type[SelfPropEnum] | SelfPropEnum],
func: FuncExceptT | None = None,
) -> VideoNode
Ensure the presence of multiple PropEnums at once.
Source code
127 128 129 130 131 132 133 134 135 136 137 138 139 |
|
from_param classmethod
¶
from_param(value_or_tff: Any, func_except: Any = None) -> FieldBased | None
Source code
143 144 145 146 147 148 |
|
from_param_or_video classmethod
¶
from_param_or_video(
value: Any,
src: VideoNode | VideoFrame | FrameProps,
strict: bool = False,
func_except: FuncExceptT | None = None,
) -> SelfPropEnum
Get the enum member from a value that can be casted to this prop value or grab it from frame properties.
If strict=False
, gather the heuristics using the clip's size or format.
Parameters:
-
value
¶Any
) –Value to cast.
-
src
¶VideoNode | VideoFrame | FrameProps
) –Clip to get prop from.
-
strict
¶bool
, default:False
) –Be strict about the frame properties. Default: False.
-
func_except
¶FuncExceptT | None
, default:None
) –Function returned for custom error handling.
Source code
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 |
|
from_res classmethod
¶
from_res(frame: VideoNode | VideoFrame) -> FieldBased
Guess the Field order from the frame resolution.
Source code
150 151 152 153 154 |
|
from_video classmethod
¶
from_video(
src: VideoNode | VideoFrame | FrameProps,
strict: bool = False,
func: FuncExceptT | None = None,
) -> FieldBased
Obtain the Field order of a clip from the frame properties.
Parameters:
-
src
¶VideoNode | VideoFrame | FrameProps
) –Input clip, frame, or props.
-
strict
¶bool
, default:False
) –Be strict about the properties. Will ALWAYS error if the FieldBased is missing.
Returns:
-
FieldBased
–FieldBased object.
Raises:
-
UndefinedFieldBasedError
–Field order is undefined.
-
UndefinedFieldBasedError
–Field order can not be determined from the frame properties.
Source code
156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
|
is_unknown classmethod
¶
is_unknown(value: int | SelfPropEnum) -> bool
Whether the value represents an unknown value.
Source code
24 25 26 27 28 |
|
is_valid classmethod
¶
Check if the given value is a valid int value of this enum.
Source code
153 154 155 156 |
|