color ¶
Type Aliases:
-
ColorRangeLike
–Type alias for values that can be used to initialize a ColorRange.
-
MatrixLike
–Type alias for values that can be used to initialize a Matrix.
-
PrimariesLike
–Type alias for values that can be used to initialize a Primaries.
-
TransferLike
–Type alias for values that can be used to initialize a Transfer.
Classes:
-
ColorRange
–Pixel Range (ITU-T H.265 Equations E-10 through E-20.
-
Matrix
–Matrix coefficients (ITU-T H.265 Table E.5).
-
Primaries
–Color primaries (ITU-T H.265 Table E.3).
-
Transfer
–Transfer characteristics (ITU-T H.265 Table E.4).
Attributes:
-
ColorRangeT
–Deprecated alias of ColorRangeLike
-
MatrixT
–Deprecated alias of MatrixLike
-
PrimariesT
–Deprecated alias of PrimariesLike
-
TransferT
–Deprecated alias of TransferLike
ColorRangeLike ¶
ColorRangeLike = int | ColorRange | ColorRange | HoldsPropValue
Type alias for values that can be used to initialize a ColorRange.
MatrixLike ¶
MatrixLike = int | MatrixCoefficients | Matrix | HoldsPropValue
Type alias for values that can be used to initialize a Matrix.
PrimariesLike ¶
PrimariesLike = int | ColorPrimaries | Primaries | HoldsPropValue
Type alias for values that can be used to initialize a Primaries.
TransferLike ¶
TransferLike = int | TransferCharacteristics | Transfer | HoldsPropValue
Type alias for values that can be used to initialize a Transfer.
ColorRange ¶
Bases: PropEnum
Pixel Range (ITU-T H.265 Equations E-10 through E-20.
Methods:
-
apply
–Applies the property to the VideoNode.
-
ensure_presence
–Ensure the presence of the property in the VideoNode.
-
ensure_presences
–Ensure the presence of multiple PropEnums at once.
-
from_param
–Determine the ColorRange through a parameter.
-
from_param_or_video
–Get the enum member from a value that can be casted to this prop value or grab it from frame properties.
-
from_res
–Guess the color range from the frame resolution.
-
from_video
–Obtain the color range of a clip from the frame properties.
-
is_unknown
–Whether the value represents an unknown value.
-
is_valid
–Check if the given value is a valid int value of this enum.
-
prop_key
–The key used in props to store the enum.
Attributes:
-
FULL
–Full (PC) dynamic range, 0-255 in 8 bits.
-
LIMITED
–Studio (TV) legal range, 16-235 in 8 bits.
-
PC
– -
TV
– -
is_full
(bool
) –Check if ColorRange is full.
-
is_limited
(bool
) –Check if ColorRange is limited.
-
pretty_string
(str
) –Get a pretty, displayable string of the enum member.
-
string
(str
) –Get the string representation used in resize plugin/encoders.
-
value_vs
(int
) –VapourSynth (props) value.
-
value_zimg
(int
) –zimg (resize plugin) value.
FULL class-attribute
instance-attribute
¶
FULL = 0
Full (PC) dynamic range, 0-255 in 8 bits.
Note that float clips should ALWAYS be FULL range! RGB clips will ALWAYS be FULL range!
LIMITED class-attribute
instance-attribute
¶
LIMITED = 1
Studio (TV) legal range, 16-235 in 8 bits.
This is primarily used with YUV integer formats.
apply ¶
apply(clip: VideoNode) -> VideoNode
Applies the property to the VideoNode.
Source code in vstools/enums/base.py
102 103 104 105 106 107 |
|
ensure_presence classmethod
¶
ensure_presence(
clip: VideoNode, value: int | Self | None, /, func: FuncExcept | None = None
) -> VideoNode
Ensure the presence of the property in the VideoNode.
Source code in vstools/enums/base.py
90 91 92 93 94 95 96 97 98 99 100 |
|
ensure_presences staticmethod
¶
ensure_presences(
clip: VideoNode,
prop_enums: Iterable[type[PropEnum] | PropEnum],
func: FuncExcept | None = None,
) -> VideoNode
Ensure the presence of multiple PropEnums at once.
Source code in vstools/enums/base.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
from_param classmethod
¶
from_param(value: None, func_except: FuncExcept | None = None) -> None
from_param(
value: ColorRangeLike, func_except: FuncExcept | None = None
) -> Self
from_param(
value: ColorRangeLike | None, func_except: FuncExcept | None = None
) -> Self | None
from_param(value: Any, func_except: Any = None) -> Self | None
Determine the ColorRange through a parameter.
Parameters:
-
value
¶Any
) –Value or ColorRange object.
-
func_except
¶Any
, default:None
) –Function returned for custom error handling. This should only be set by VS package developers.
Returns:
-
Self | None
–ColorRange object or None.
Source code in vstools/enums/color.py
1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 |
|
from_param_or_video classmethod
¶
from_param_or_video(
value: ColorRangeLike | None,
src: VideoNode | VideoFrame | Mapping[str, Any],
strict: bool = False,
func_except: FuncExcept | None = None,
) -> ColorRange
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
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Source code in vstools/enums/color.py
1239 1240 1241 1242 1243 1244 1245 1246 |
|
from_res classmethod
¶
from_res(frame: VideoNode | VideoFrame) -> ColorRange
Guess the color range from the frame resolution.
Source code in vstools/enums/color.py
1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 |
|
from_video classmethod
¶
from_video(
src: VideoNode | VideoFrame | Mapping[str, Any],
strict: bool = False,
func: FuncExcept | None = None,
) -> ColorRange
Obtain the color range of a clip from the frame properties.
Parameters:
-
src
¶VideoNode | VideoFrame | Mapping[str, Any]
) –Input clip, frame, or props.
-
strict
¶bool
, default:False
) –Be strict about the frame properties. Sets the ColorRange as MISSING if prop is not there.
Returns:
-
ColorRange
–ColorRange object.
Source code in vstools/enums/color.py
1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 |
|
is_unknown classmethod
¶
Whether the value represents an unknown value.
Source code in vstools/enums/base.py
19 20 21 22 23 24 25 |
|
is_valid classmethod
¶
Check if the given value is a valid int value of this enum.
Source code in vstools/enums/base.py
145 146 147 148 149 150 |
|
Matrix ¶
Bases: PropEnum
Matrix coefficients (ITU-T H.265 Table E.5).
Methods:
-
apply
–Applies the property to the VideoNode.
-
ensure_presence
–Ensure the presence of the property in the VideoNode.
-
ensure_presences
–Ensure the presence of multiple PropEnums at once.
-
from_param
–Determine the Matrix through a parameter.
-
from_param_or_video
–Get the enum member from a value that can be casted to this prop value or grab it from frame properties.
-
from_primaries
–Obtain the matrix from a Primaries object.
-
from_res
–Guess the matrix based on the clip's resolution.
-
from_transfer
–Obtain the matrix from a Transfer object.
-
from_video
–Obtain the matrix of a clip from the frame properties.
-
is_unknown
–Check if Matrix is Matrix.UNKNOWN.
-
is_valid
–Check if the given value is a valid int value of this enum.
-
prop_key
–The key used in props to store the enum.
Attributes:
-
BT2020CL
–KR = 0.2627; KB = 0.0593
-
BT2020NCL
–KR = 0.2627; KB = 0.0593
-
BT470BG
–KR = 0.299; KB = 0.114
-
BT601_525
– -
BT601_625
– -
BT709
–Kr = 0.2126; Kb = 0.0722
-
CHROMACL
–Chromaticity-derived constant luminance system
-
CHROMANCL
–Chromaticity-derived non-constant luminance system
-
FCC
–KR = 0.30; KB = 0.11
-
GBR
– -
ICTCP
–ICtCp
-
RGB
–The identity matrix.
-
SMPTE170M
–Kr = 0.299; Kb = 0.114
-
SMPTE240M
–KR = 0.212; KB = 0.087
-
UNKNOWN
–Image characteristics are unknown or are determined by the application.
-
YCGCO
–KR = 0.2126; KB = 0.0722
-
pretty_string
(str
) –Get a pretty, displayable string of the enum member.
-
string
(str
) –Get the string representation used in resize plugin/encoders.
BT2020CL class-attribute
instance-attribute
¶
BT2020CL = 10
KR = 0.2627; KB = 0.0593
Rec. ITU-R BT.2020-2 constant luminance system
See ITU-T H.265 Equations E-49 to E-58
BT2020NCL class-attribute
instance-attribute
¶
BT2020NCL = 9
KR = 0.2627; KB = 0.0593
Rec. ITU-R BT.2020-2 non-constant luminance system
Rec. ITU-R BT.2100-2 Y'CbCr
See ITU-T H.265 Equations E-28 to E-30
BT470BG class-attribute
instance-attribute
¶
BT470BG = 5
KR = 0.299; KB = 0.114
(Functionally the same as Matrix.SMPTE170M)
Rec. ITU-R BT.470-6 System B, G (historical)
Rec. ITU-R BT.601-7 625
Rec. ITU-R BT.1358-0 625 (historical)
Rec. ITU-R BT.1700-0 625 PAL and 625 SECAM
IEC 61966-2-1 sYCC
IEC 61966-2-4 xvYCC601
See ITU-T H.265 Equations E-28 to E-30
BT709 class-attribute
instance-attribute
¶
BT709 = 1
Kr = 0.2126; Kb = 0.0722
Rec. ITU-R BT.709-6
Rec. ITU-R BT.1361-0 conventional colour gamut system and extended colour gamut system (historical)
IEC 61966-2-4 xvYCC709
SMPTE RP 177 (1993) Annex B
CHROMACL class-attribute
instance-attribute
¶
CHROMACL = 13
Chromaticity-derived constant luminance system
See ITU-T H.265 Equations E-22 to E-27
See ITU-T H.265 Equations E-49 to E-58
CHROMANCL class-attribute
instance-attribute
¶
CHROMANCL = 12
Chromaticity-derived non-constant luminance system
See ITU-T H.265 Equations E-22 to E-27 See ITU-T H.265 Equations E-28 to E-30
FCC class-attribute
instance-attribute
¶
FCC = 4
KR = 0.30; KB = 0.11
FCC Title 47 Code of Federal Regulations (2003) 73.682 (a) (20)
See ITU-T H.265 Equations E-28 to E-30
ICTCP class-attribute
instance-attribute
¶
ICTCP = 14
ICtCp
Rec. ITU-R BT.2100-2 ICTCP
See ITU-T H.265 Equations E-62 to E-64 for transfer_characteristics
value 16 (PQ)
See ITU-T H.265 Equations E-65 to E-67 for transfer_characteristics
value 18 (HLG)
RGB class-attribute
instance-attribute
¶
RGB = 0
The identity matrix.
Typically used for GBR (often referred to as RGB); however, may also be used for YZX (often referred to as XYZ)
IEC 61966-2-1 sRGB
SMPTE ST 428-1 (2006)
See ITU-T H.265 Equations E-31 to E-33
SMPTE170M class-attribute
instance-attribute
¶
SMPTE170M = 6
Kr = 0.299; Kb = 0.114
(Functionally the same as Matrix.BT470BG)
Rec. ITU-R BT.601-7 525
Rec. ITU-R BT.1358-1 525 or 625 (historical)
Rec. ITU-R BT.1700-0 NTSC
SMPTE ST 170 (2004)
See ITU-T H.265 Equations E-28 to E-30
SMPTE240M class-attribute
instance-attribute
¶
SMPTE240M = 7
KR = 0.212; KB = 0.087
SMPTE ST 240 (1999, historical)
See ITU-T H.265 Equations E-28 to E-30
UNKNOWN class-attribute
instance-attribute
¶
UNKNOWN = 2
Image characteristics are unknown or are determined by the application.
YCGCO class-attribute
instance-attribute
¶
YCGCO = 8
KR = 0.2126; KB = 0.0722
See Implementation And Evaluation Of Residual Color Transform For 4:4:4 RGB Lossless Coding
apply ¶
apply(clip: VideoNode) -> VideoNode
Applies the property to the VideoNode.
Source code in vstools/enums/base.py
102 103 104 105 106 107 |
|
ensure_presence classmethod
¶
ensure_presence(
clip: VideoNode, value: int | Self | None, /, func: FuncExcept | None = None
) -> VideoNode
Ensure the presence of the property in the VideoNode.
Source code in vstools/enums/base.py
90 91 92 93 94 95 96 97 98 99 100 |
|
ensure_presences staticmethod
¶
ensure_presences(
clip: VideoNode,
prop_enums: Iterable[type[PropEnum] | PropEnum],
func: FuncExcept | None = None,
) -> VideoNode
Ensure the presence of multiple PropEnums at once.
Source code in vstools/enums/base.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
from_param classmethod
¶
from_param(value: None, func_except: FuncExcept | None = None) -> None
from_param(value: MatrixLike, func_except: FuncExcept | None = None) -> Self
from_param(
value: MatrixLike | None, func_except: FuncExcept | None = None
) -> Self | None
from_param(value: Any, func_except: Any = None) -> Self | None
Determine the Matrix through a parameter.
Parameters:
-
value
¶Any
) –Value or Matrix object.
-
func_except
¶Any
, default:None
) –Function returned for custom error handling.
Returns:
-
Self | None
–Matrix object or None.
Source code in vstools/enums/color.py
230 231 232 233 234 235 236 237 238 239 240 241 |
|
from_param_or_video classmethod
¶
from_param_or_video(
value: MatrixLike | None,
src: VideoNode | VideoFrame | Mapping[str, Any],
strict: bool = False,
func_except: FuncExcept | None = None,
) -> Matrix
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
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Source code in vstools/enums/color.py
243 244 245 246 247 248 249 250 |
|
from_primaries classmethod
¶
Obtain the matrix from a Primaries object.
Parameters:
-
primaries
¶Primaries
) –Primaries object.
-
strict
¶bool
, default:False
) –Be strict about the primaries-matrix mapping. Will ALWAYS error with Primaries.UNKNOWN.
Returns:
-
Matrix
–Matrix object.
Raises:
-
UnsupportedPrimariesError
–Primaries is not supported.
Source code in vstools/enums/color.py
332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
|
from_res classmethod
¶
Guess the matrix based on the clip's resolution.
Parameters:
-
frame
¶VideoNode | VideoFrame
) –Input clip or frame.
Returns:
-
Matrix
–Matrix object.
Source code in vstools/enums/color.py
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 |
|
from_transfer classmethod
¶
Obtain the matrix from a Transfer object.
Parameters:
-
transfer
¶Transfer
) –Transfer object.
-
strict
¶bool
, default:False
) –Be strict about the transfer-matrix mapping. Will ALWAYS error with Transfer.UNKNOWN.
Returns:
-
Matrix
–Matrix object.
Raises:
-
UnsupportedTransferError
–Transfer is not supported.
Source code in vstools/enums/color.py
308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 |
|
from_video classmethod
¶
from_video(
src: VideoNode | VideoFrame | Mapping[str, Any],
strict: bool = False,
func: FuncExcept | None = None,
) -> Matrix
Obtain the matrix of a clip from the frame properties.
Parameters:
-
src
¶VideoNode | VideoFrame | Mapping[str, Any]
) –Input clip, frame, or props.
-
strict
¶bool
, default:False
) –Be strict about the frame properties. Will ALWAYS error with Matrix.UNKNOWN.
Returns:
-
Matrix
–Matrix object.
Raises:
-
UndefinedMatrixError
–Matrix is undefined.
-
UndefinedMatrixError
–Matrix can not be determined from the frameprops.
Source code in vstools/enums/color.py
287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 |
|
is_unknown classmethod
¶
Check if Matrix is Matrix.UNKNOWN.
Source code in vstools/enums/color.py
252 253 254 255 256 257 258 |
|
is_valid classmethod
¶
Check if the given value is a valid int value of this enum.
Source code in vstools/enums/base.py
145 146 147 148 149 150 |
|
Primaries ¶
Bases: PropEnum
Color primaries (ITU-T H.265 Table E.3).
Methods:
-
apply
–Applies the property to the VideoNode.
-
ensure_presence
–Ensure the presence of the property in the VideoNode.
-
ensure_presences
–Ensure the presence of multiple PropEnums at once.
-
from_libplacebo
–Obtain the primaries from libplacebo.
-
from_matrix
–Obtain the primaries from a Matrix object.
-
from_param
–Determine the Primaries through a parameter.
-
from_param_or_video
–Get the enum member from a value that can be casted to this prop value or grab it from frame properties.
-
from_res
–Guess the primaries based on the clip's resolution.
-
from_transfer
–Obtain the primaries from a Transfer object.
-
from_video
–Obtain the primaries of a clip from the frame properties.
-
is_unknown
–Check if Primaries is unknown.
-
is_valid
–Check if the given value is a valid int value of this enum.
-
prop_key
–The key used in props to store the enum.
Attributes:
-
ACES_0
–ACES Primaries #0 (ultra wide)
-
ACES_1
–ACES Primaries #1
-
ADOBE
–Adobe RGB (1998).
-
APPLE
–Apple RGB.
-
BT2020
–Rec. ITU-R BT.2020-2
-
BT470BG
–Rec. ITU-R BT.470-6 System B, G (historical)
-
BT470M
–Rec. ITU-R BT.470-6 System M (historical)
-
BT601_525
– -
BT601_625
– -
BT709
–Rec. ITU-R BT.709-6
-
CIE1931
– -
DCI_P3
– -
DISPLAY_P3
– -
EBU3213
– -
FILM
–Generic film (colour filters using Illuminant C)
-
JEDEC_P22
–EBU Tech. 3213-E (1975)
-
PROPHOTO
–ProPhoto RGB (ROMM).
-
ROMM
– -
SGAMUT
–Sony S-Gamut.
-
SMPTE170M
–(Functionally the same as Primaries.SMPTE240M)
-
SMPTE240M
–SMPTE ST 240 (1999, historical)
-
ST428
–SMPTE ST 428-1 (2006)
-
ST431_2
–SMPTE RP 431-2 (2011)
-
ST432_1
–SMPTE EG 432-1 (2010)
-
UNKNOWN
–Unspecified image characteristics are unknown or are determined by the application.
-
VARICAM
– -
VGAMUT
–Panasonic V-Gamut (VARICAM).
-
XYZ
– -
pretty_string
(str
) –Get a pretty, displayable string of the enum member.
-
string
(str
) –Get the string representation used in resize plugin/encoders.
-
value_libplacebo
(int
) –libplacebo value.
-
value_vs
(int
) –VapourSynth value.
BT2020 class-attribute
instance-attribute
¶
BT2020 = 9
Rec. ITU-R BT.2020-2
Primary x y
Green 0.1700 0.7970
Blue 0.1310 0.0460
Red 0.7080 0.2920
White D65 0.3127 0.3290
Rec. ITU-R BT.2020-2
Rec. ITU-R BT.2100-2
BT470BG class-attribute
instance-attribute
¶
BT470BG = 5
Rec. ITU-R BT.470-6 System B, G (historical)
Primary x y
Green 0.2900 0.6000
Blue 0.1500 0.0600
Red 0.6400 0.3300
White D65 0.3127 0.3290
Rec. ITU-R BT.470-6 System B, G (historical) Rec. ITU-R BT.601-7 625 Rec. ITU-R BT.1358-0 625 (historical) Rec. ITU-R BT.1700-0 625 PAL and 625 SECAM
BT470M class-attribute
instance-attribute
¶
BT470M = 4
Rec. ITU-R BT.470-6 System M (historical)
Primary x y
Green 0.2100 0.7100
Blue 0.1400 0.0800
Red 0.6700 0.3300
White C 0.3100 0.3160
Rec. ITU-R BT.470-6 System M (historical) NTSC Recommendation for transmission standards for colour television (1953) FCC Title 47 Code of Federal Regulations (2003) 73.682 (a) (20)
BT709 class-attribute
instance-attribute
¶
BT709 = 1
Rec. ITU-R BT.709-6
Primary x y
Green 0.3000 0.6000
Blue 0.1500 0.0600
Red 0.6400 0.3300
White D65 0.3127 0.3290
Rec. ITU-R BT.709-6
Rec. ITU-R BT.1361-0 conventional colour gamutsystem and extended colour gamut system (historical)
IEC 61966-2-1 sRGB or sYCC
IEC 61966-2-4
SMPTE RP 177 (1993) Annex B
FILM class-attribute
instance-attribute
¶
FILM = 8
Generic film (colour filters using Illuminant C)
Primary x y
Green 0.2430 0.6920 #(Wratten 58)
Blue 0.1450 0.0490 #(Wratten 47)
Red 0.6810 0.3190 #(Wratten 25)
White C 0.3100 0.3160
JEDEC_P22 class-attribute
instance-attribute
¶
JEDEC_P22 = 22
EBU Tech. 3213-E (1975)
Primary x y
Green 0.2950 0.6050
Blue 0.1550 0.0770
Red 0.6300 0.3400
White D65 0.3127 0.3290
SMPTE170M class-attribute
instance-attribute
¶
SMPTE170M = 6
(Functionally the same as Primaries.SMPTE240M)
Primary x y
Green 0.3100 0.5950
Blue 0.1550 0.0700
Red 0.6300 0.3400
White D65 0.3127 0.3290
Rec. ITU-R BT.601-7 525
Rec. ITU-R BT.1358-1 525 or 625 (historical)
Rec. ITU-R BT.1700-0 NTSC
SMPTE ST 170 (2004)
SMPTE240M class-attribute
instance-attribute
¶
SMPTE240M = 7
SMPTE ST 240 (1999, historical)
(Functionally the same as Primaries.SMPTE170M)
Primary x y
Green 0.3100 0.5950
Blue 0.1550 0.0700
Red 0.6300 0.3400
White D65 0.3127 0.3290
SMPTE ST 240 (1999, historical)
ST428 class-attribute
instance-attribute
¶
ST428 = 10
SMPTE ST 428-1 (2006)
Primary x y
Green (Y) 0.0 1.0
Blue (Z) 0.0 0.0
Red (X) 1.0 0.0
Centre White 1/3 1/3
(CIE 1931 XYZ)
ST431_2 class-attribute
instance-attribute
¶
ST431_2 = 11
SMPTE RP 431-2 (2011)
Primary x y
Green 0.2650 0.6900
Blue 0.1500 0.0600
Red 0.6800 0.3200
White 0.3140 0.3510
SMPTE ST 2113 (2019) "P3DCI"
ST432_1 class-attribute
instance-attribute
¶
ST432_1 = 12
SMPTE EG 432-1 (2010)
Primary x y
Green 0.2650 0.6900
Blue 0.1500 0.0600
Red 0.6800 0.3200
White D65 0.3127 0.3290
SMPTE EG 432-1 (2010)
SMPTE ST 2113 (2019) "P3D65"
UNKNOWN class-attribute
instance-attribute
¶
UNKNOWN = 2
Unspecified image characteristics are unknown or are determined by the application.
value_vs property
¶
value_vs: int
VapourSynth value.
Raises:
-
ReservedPrimariesError
–Primaries are not an internal primaries, but a libplacebo one.
apply ¶
apply(clip: VideoNode) -> VideoNode
Applies the property to the VideoNode.
Source code in vstools/enums/base.py
102 103 104 105 106 107 |
|
ensure_presence classmethod
¶
ensure_presence(
clip: VideoNode, value: int | Self | None, /, func: FuncExcept | None = None
) -> VideoNode
Ensure the presence of the property in the VideoNode.
Source code in vstools/enums/base.py
90 91 92 93 94 95 96 97 98 99 100 |
|
ensure_presences staticmethod
¶
ensure_presences(
clip: VideoNode,
prop_enums: Iterable[type[PropEnum] | PropEnum],
func: FuncExcept | None = None,
) -> VideoNode
Ensure the presence of multiple PropEnums at once.
Source code in vstools/enums/base.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
from_libplacebo classmethod
¶
Obtain the primaries from libplacebo.
Source code in vstools/enums/color.py
1131 1132 1133 1134 1135 1136 1137 |
|
from_matrix classmethod
¶
Obtain the primaries from a Matrix object.
Parameters:
-
matrix
¶Matrix
) –Matrix object.
-
strict
¶bool
, default:False
) –Be strict about the matrix-primaries mapping. Will ALWAYS error with Matrix.UNKNOWN.
Returns:
-
Primaries
–Primaries object.
Raises:
-
UnsupportedMatrixError
–Matrix is not supported.
Source code in vstools/enums/color.py
1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 |
|
from_param classmethod
¶
from_param(value: None, func_except: FuncExcept | None = None) -> None
from_param(value: PrimariesLike, func_except: FuncExcept | None = None) -> Self
from_param(
value: PrimariesLike | None, func_except: FuncExcept | None = None
) -> Self | None
from_param(value: Any, func_except: Any = None) -> Self | None
Determine the Primaries through a parameter.
Parameters:
-
value
¶Any
) –Value or Primaries object.
-
func_except
¶Any
, default:None
) –Function returned for custom error handling. This should only be set by VS package developers.
Returns:
-
Self | None
–Primaries object or None.
Source code in vstools/enums/color.py
1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 |
|
from_param_or_video classmethod
¶
from_param_or_video(
value: PrimariesLike | None,
src: VideoNode | VideoFrame | Mapping[str, Any],
strict: bool = False,
func_except: FuncExcept | None = None,
) -> Primaries
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
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Source code in vstools/enums/color.py
1018 1019 1020 1021 1022 1023 1024 1025 |
|
from_res classmethod
¶
Guess the primaries based on the clip's resolution.
Parameters:
-
frame
¶VideoNode | VideoFrame
) –Input clip or frame.
Returns:
-
Primaries
–Primaries object.
Source code in vstools/enums/color.py
1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 |
|
from_transfer classmethod
¶
Obtain the primaries from a Transfer object.
Parameters:
-
transfer
¶Transfer
) –Transfer object.
-
strict
¶bool
, default:False
) –Be strict about the transfer-primaries mapping. Will ALWAYS error with Transfer.UNKNOWN.
Returns:
-
Primaries
–Matrix object.
Raises:
-
UnsupportedTransferError
–Transfer is not supported.
Source code in vstools/enums/color.py
1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 |
|
from_video classmethod
¶
from_video(
src: VideoNode | VideoFrame | Mapping[str, Any],
strict: bool = False,
func: FuncExcept | None = None,
) -> Primaries
Obtain the primaries of a clip from the frame properties.
Parameters:
-
src
¶VideoNode | VideoFrame | Mapping[str, Any]
) –Input clip, frame, or props.
-
strict
¶bool
, default:False
) –Be strict about the frame properties. Will ALWAYS error with Primaries.UNKNOWN.
Returns:
-
Primaries
–Primaries object.
Raises:
-
UndefinedPrimariesError
–Primaries is undefined.
-
UndefinedPrimariesError
–Primaries can not be determined from the frame properties.
Source code in vstools/enums/color.py
1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 |
|
is_unknown classmethod
¶
Check if Primaries is unknown.
Source code in vstools/enums/color.py
1027 1028 1029 1030 1031 1032 1033 |
|
is_valid classmethod
¶
Check if the given value is a valid int value of this enum.
Source code in vstools/enums/base.py
145 146 147 148 149 150 |
|
Transfer ¶
Bases: PropEnum
Transfer characteristics (ITU-T H.265 Table E.4).
Methods:
-
apply
–Applies the property to the VideoNode.
-
ensure_presence
–Ensure the presence of the property in the VideoNode.
-
ensure_presences
–Ensure the presence of multiple PropEnums at once.
-
from_libplacebo
–Obtain the transfer from libplacebo.
-
from_matrix
–Obtain the transfer from a Matrix object.
-
from_param
–Determine the Transfer through a parameter.
-
from_param_or_video
–Get the enum member from a value that can be casted to this prop value or grab it from frame properties.
-
from_primaries
–Obtain the transfer from a Primaries object.
-
from_res
–Guess the transfer based on the clip's resolution.
-
from_video
–Obtain the transfer of a clip from the frame properties.
-
is_unknown
–Check if Transfer is unknown.
-
is_valid
–Check if the given value is a valid int value of this enum.
-
prop_key
–The key used in props to store the enum.
Attributes:
-
BT1886
– -
BT2020_10
–(Functionally the same as Transfer.BT709, Transfer.BT601,
-
BT2020_12
–(Functionally the same as Transfer.BT709, Transfer.BT601,
-
BT470BG
–Rec. ITU-R BT.470-6 System B, G (historical)
-
BT470M
–Rec. ITU-R BT.470-6 System M (historical)
-
BT601
–(Functionally the same as Transfer.BT709,
-
BT709
–(Functionally the same as Transfer.BT601,
-
GAMMA18
–Pure power gamma 1.8
-
GAMMA20
–Pure power gamma 2.0
-
GAMMA22
– -
GAMMA24
– -
GAMMA26
–Pure power gamma 2.6
-
GAMMA28
– -
HLG
– -
LINEAR
–Linear transfer characteristics.
-
LOG100
–Logarithmic transfer characteristic (100:1 range).
-
LOG316
–Logarithmic transfer characteristic (100 * sqrt(10):1 range).
-
PQ
– -
PROPHOTO
–ProPhoto RGB (ROMM)
-
ROMM
– -
SLOG_1
–Sony S-Log1
-
SLOG_2
–Sony S-Log2
-
SMPTE240M
–SMPTE ST 240 (1999, historical).
-
SRGB
–IEC 61966-2-1 sRGB when matrix is equal to Matrix.RGB
-
ST2084
–SMPTE ST 2084 (2014) for 10, 12, 14, and 16-bit systems
-
ST428
–Digital Cinema Distribution Master (XYZ)
-
STD_B67
–Association of Radio Industries and Businesses (ARIB) STD-B67
-
UNKNOWN
–Image characteristics are unknown or are determined by the application.
-
VARICAM
– -
VLOG
–Panasonic V-Log (VARICAM)
-
XVYCC
–IEC 61966-2-4.
-
XYZ
– -
pretty_string
(str
) –Get a pretty, displayable string of the enum member.
-
string
(str
) –Get the string representation used in resize plugin/encoders.
-
value_libplacebo
(int
) –libplacebo value.
-
value_vs
(int
) –VapourSynth value.
BT2020_10 class-attribute
instance-attribute
¶
BT2020_10 = 14
(Functionally the same as Transfer.BT709, Transfer.BT601, and Transfer.BT2020_12) Rec. ITU-R BT.2020-2
BT2020_12 class-attribute
instance-attribute
¶
BT2020_12 = 15
(Functionally the same as Transfer.BT709, Transfer.BT601, and Transfer.BT2020_10) Rec. ITU-R BT.2020-2
BT470BG class-attribute
instance-attribute
¶
BT470BG = 5
Rec. ITU-R BT.470-6 System B, G (historical) Rec. ITU-R BT.1700-0 625 PAL and 625 SECAM
BT470M class-attribute
instance-attribute
¶
BT470M = 4
Rec. ITU-R BT.470-6 System M (historical) NTSC Recommendation for transmission standards for colour television (1953) FCC, Title 47 Code of Federal Regulations (2003) 73.682 (a) (20)
BT601 class-attribute
instance-attribute
¶
BT601 = 6
(Functionally the same as Transfer.BT709, Transfer.BT2020_10, and Transfer.BT2020_12) Rec. ITU-R BT.601-7 525 or 625 Rec. ITU-R BT.1358-1 525 or 625 (historical) Rec. ITU-R BT.1700-0 NTSC SMPTE ST 170 (2004)
BT709 class-attribute
instance-attribute
¶
BT709 = 1
(Functionally the same as Transfer.BT601, Transfer.BT2020_10, and Transfer.BT2020_12) Rec. ITU-R BT.709-6 Rec. ITU-R BT.1361-0 conventional Colour gamut system (historical)
LOG100 class-attribute
instance-attribute
¶
LOG100 = 9
Logarithmic transfer characteristic (100:1 range).
LOG316 class-attribute
instance-attribute
¶
LOG316 = 10
Logarithmic transfer characteristic (100 * sqrt(10):1 range).
SRGB class-attribute
instance-attribute
¶
SRGB = 13
IEC 61966-2-1 sRGB when matrix is equal to Matrix.RGB IEC 61966-2-1 sYCC when matrix is equal to Matrix.BT470BG
ST2084 class-attribute
instance-attribute
¶
ST2084 = 16
SMPTE ST 2084 (2014) for 10, 12, 14, and 16-bit systems Rec. ITU-R BT.2100-2 perceptual quantization (PQ) system
STD_B67 class-attribute
instance-attribute
¶
STD_B67 = 18
Association of Radio Industries and Businesses (ARIB) STD-B67 Rec. ITU-R BT.2100-2 hybrid loggamma (HLG) system
UNKNOWN class-attribute
instance-attribute
¶
UNKNOWN = 2
Image characteristics are unknown or are determined by the application.
value_vs property
¶
value_vs: int
VapourSynth value.
Raises:
-
ReservedTransferError
–Transfer is not an internal transfer, but a libplacebo one.
apply ¶
apply(clip: VideoNode) -> VideoNode
Applies the property to the VideoNode.
Source code in vstools/enums/base.py
102 103 104 105 106 107 |
|
ensure_presence classmethod
¶
ensure_presence(
clip: VideoNode, value: int | Self | None, /, func: FuncExcept | None = None
) -> VideoNode
Ensure the presence of the property in the VideoNode.
Source code in vstools/enums/base.py
90 91 92 93 94 95 96 97 98 99 100 |
|
ensure_presences staticmethod
¶
ensure_presences(
clip: VideoNode,
prop_enums: Iterable[type[PropEnum] | PropEnum],
func: FuncExcept | None = None,
) -> VideoNode
Ensure the presence of multiple PropEnums at once.
Source code in vstools/enums/base.py
109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 |
|
from_libplacebo classmethod
¶
Obtain the transfer from libplacebo.
Source code in vstools/enums/color.py
680 681 682 683 684 685 686 |
|
from_matrix classmethod
¶
Obtain the transfer from a Matrix object.
Parameters:
-
matrix
¶Matrix
) –Matrix object.
-
strict
¶bool
, default:False
) –Be strict about the matrix-transfer mapping. Will ALWAYS error with Matrix.UNKNOWN.
Returns:
-
Transfer
–Transfer object.
Raises:
-
UnsupportedMatrixError
–Matrix is not supported.
Source code in vstools/enums/color.py
632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 |
|
from_param classmethod
¶
from_param(value: None, func_except: FuncExcept | None = None) -> None
from_param(value: TransferLike, func_except: FuncExcept | None = None) -> Self
from_param(
value: TransferLike | None, func_except: FuncExcept | None = None
) -> Self | None
from_param(value: Any, func_except: Any = None) -> Self | None
Determine the Transfer through a parameter.
Parameters:
-
value
¶Any
) –Value or Transfer object.
-
func_except
¶Any
, default:None
) –Function returned for custom error handling. This should only be set by VS package developers.
Returns:
-
Self | None
–Transfer object or None.
Source code in vstools/enums/color.py
556 557 558 559 560 561 562 563 564 565 566 567 568 |
|
from_param_or_video classmethod
¶
from_param_or_video(
value: TransferLike | None,
src: VideoNode | VideoFrame | Mapping[str, Any],
strict: bool = False,
func_except: FuncExcept | None = None,
) -> Transfer
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
¶FuncExcept | None
, default:None
) –Function returned for custom error handling.
Source code in vstools/enums/color.py
570 571 572 573 574 575 576 577 |
|
from_primaries classmethod
¶
Obtain the transfer from a Primaries object.
Parameters:
-
primaries
¶Primaries
) –Primaries object.
-
strict
¶bool
, default:False
) –Be strict about the primaries-transfer mapping. Will ALWAYS error with Primaries.UNKNOWN.
Returns:
-
Transfer
–Transfer object.
Raises:
-
UnsupportedPrimariesError
–Primaries is not supported.
Source code in vstools/enums/color.py
656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 |
|
from_res classmethod
¶
Guess the transfer based on the clip's resolution.
Parameters:
-
frame
¶VideoNode | VideoFrame
) –Input clip or frame.
Returns:
-
Transfer
–Transfer object.
Source code in vstools/enums/color.py
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 |
|
from_video classmethod
¶
from_video(
src: VideoNode | VideoFrame | Mapping[str, Any],
strict: bool = False,
func: FuncExcept | None = None,
) -> Transfer
Obtain the transfer of a clip from the frame properties.
Parameters:
-
src
¶VideoNode | VideoFrame | Mapping[str, Any]
) –Input clip, frame, or props.
-
strict
¶bool
, default:False
) –Be strict about the properties. The result may NOT be Transfer.UNKNOWN.
Returns:
-
Transfer
–Transfer object.
Raises:
-
UndefinedTransferError
–Transfer is undefined.
-
UndefinedTransferError
–Transfer can not be determined from the frameprops.
Source code in vstools/enums/color.py
611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 |
|
is_unknown classmethod
¶
Check if Transfer is unknown.
Source code in vstools/enums/color.py
579 580 581 582 583 584 585 |
|
is_valid classmethod
¶
Check if the given value is a valid int value of this enum.
Source code in vstools/enums/base.py
145 146 147 148 149 150 |
|