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_or_video–Get the enum member from a value that can be casted to this prop value or grab it from frame properties.
-
from_param_with_fallback–Attempts to obtain an enum member from a parameter value, returning a fallback if the value cannot be converted
-
from_res–Guess the color range from the frame resolution.
-
from_video–Try to obtain the color range of a clip from the frame props or fallback to clip's resolution
-
is_full–Check if ColorRange is full.
-
is_limited–Check if ColorRange is limited.
-
is_unspecified–Whether the value is unspecified.
-
pretty_string–Get a pretty, displayable string of the enum member.
-
prop_key–The key used in props to store the enum.
-
string–Get the string representation used in resize plugin/encoders.
Attributes:
-
FULL–Full (PC) dynamic range, 0-255 in 8 bits.
-
LIMITED–Studio (TV) legal range, 16-235 in 8 bits.
-
value_vs(int) –VapourSynth (props) value.
-
value_zimg(int) –zimg (resize plugin) value.
Source code in vstools/enums/base.py
34 35 36 | |
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
67 68 69 70 71 | |
ensure_presence classmethod ¶
ensure_presence(
clip: VideoNode, value: Any, func: FuncExcept | None = None
) -> VideoNode
Ensure the presence of the property in the VideoNode.
Source code in vstools/enums/base.py
153 154 155 156 157 158 159 160 | |
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
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
from_param_or_video classmethod ¶
from_param_or_video(
value: Any,
src: VideoNode | VideoFrame | Mapping[str, Any],
strict: bool = False,
func_except: FuncExcept | None = None,
) -> Self
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 | Mapping[str, Any]) –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/base.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
from_param_with_fallback classmethod ¶
Attempts to obtain an enum member from a parameter value, returning a fallback if the value cannot be converted or represents an unspecified enum member.
Parameters:
-
(value¶Any) –The input value to convert into an enum member.
-
(fallback¶T | None, default:None) –The value to return if the input cannot be converted. Defaults to
None.
Returns:
-
Self | T | None–The corresponding enum member if conversion succeeds, otherwise the provided
fallbackvalue.
Source code in vstools/enums/base.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
from_res classmethod ¶
from_res(frame: VideoNode | VideoFrame) -> ColorRange
Guess the color range from the frame resolution.
Source code in vstools/enums/color.py
692 693 694 695 696 697 698 699 700 701 702 703 704 | |
from_video classmethod ¶
from_video(
src: VideoNode | VideoFrame | Mapping[str, Any],
strict: bool = False,
func: FuncExcept | None = None,
) -> ColorRange
Try to obtain the color range of a clip from the frame props or fallback to clip's resolution if the prop is undefined, strict=False and src is a clip.
Parameters:
-
(src¶VideoNode | VideoFrame | Mapping[str, Any]) –Input clip, frame, or props.
-
(strict¶bool, default:False) –Be strict about the frame props. Sets the ColorRange as MISSING if prop is not there.
-
(func¶FuncExcept | None, default:None) –Function returned for custom error handling.
Returns:
-
ColorRange–ColorRange object.
Raises:
-
UndefinedColorRangeError–If the color range is undefined or can not be determined from the frameprops.
Source code in vstools/enums/color.py
706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 | |
is_full ¶
is_full() -> bool
Check if ColorRange is full.
Source code in vstools/enums/color.py
686 687 688 689 690 | |
is_limited ¶
is_limited() -> bool
Check if ColorRange is limited.
Source code in vstools/enums/color.py
680 681 682 683 684 | |
is_unspecified ¶
is_unspecified() -> bool
Whether the value is unspecified.
Source code in vstools/enums/base.py
73 74 75 76 77 | |
pretty_string ¶
pretty_string() -> str
Get a pretty, displayable string of the enum member.
Source code in vstools/enums/base.py
45 46 47 48 49 50 | |
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_or_video–Get the enum member from a value that can be casted to this prop value or grab it from frame properties.
-
from_param_with_fallback–Attempts to obtain an enum member from a parameter value, returning a fallback if the value cannot be converted
-
from_res–Guess the matrix based on the clip's resolution.
-
from_video–Try to obtain the matrix of a clip from the frame props or fallback to clip's resolution
-
is_unspecified–Check if the matrix is Matrix.UNSPECIFIED.
-
pretty_string–Get a pretty, displayable string of the enum member.
-
prop_key–The key used in props to store the enum.
-
string–Get the string representation used in resize plugin/encoders.
Attributes:
-
BT2020_CL–KR = 0.2627; KB = 0.0593
-
BT2020_NCL–KR = 0.2627; KB = 0.0593
-
BT470_BG–KR = 0.299; KB = 0.114
-
BT709–Kr = 0.2126; Kb = 0.0722
-
CHROMATICITY_DERIVED_CL–Chromaticity-derived constant luminance system
-
CHROMATICITY_DERIVED_NC–Chromaticity-derived non-constant luminance system
-
FCC–KR = 0.30; KB = 0.11
-
ICTCP–ICtCp
-
RGB–The identity matrix.
-
ST170_M–Kr = 0.299; Kb = 0.114
-
ST240_M–KR = 0.212; KB = 0.087
-
UNSPECIFIED–Unspecified.
-
YCGCO–KR = 0.2126; KB = 0.0722
Source code in vstools/enums/base.py
34 35 36 | |
BT2020_CL class-attribute instance-attribute ¶
BT2020_CL = (10, '2020cl', 'BT.2020 constant luminance')
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
BT2020_NCL class-attribute instance-attribute ¶
BT2020_NCL = (9, '2020ncl', 'BT.2020 non-constant luminance')
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
BT470_BG class-attribute instance-attribute ¶
BT470_BG = (5, '470bg', 'BT.470bg')
KR = 0.299; KB = 0.114
(Functionally the same as Matrix.ST170_M)
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, '709', 'BT.709')
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
CHROMATICITY_DERIVED_CL class-attribute instance-attribute ¶
CHROMATICITY_DERIVED_CL = (
13,
"chromacl",
"Chromaticity derived constant luminance",
)
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
CHROMATICITY_DERIVED_NC class-attribute instance-attribute ¶
CHROMATICITY_DERIVED_NC = (
12,
"chromancl",
"Chromaticity derived non-constant luminance",
)
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, 'fcc', 'FCC')
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', 'ICtCp')
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, 'rgb', 'RGB')
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
ST170_M class-attribute instance-attribute ¶
ST170_M = (6, '170m', 'SMPTE ST 170m')
Kr = 0.299; Kb = 0.114
(Functionally the same as Matrix.BT470_BG)
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
ST240_M class-attribute instance-attribute ¶
ST240_M = (7, '240m', 'SMPTE ST 240m')
KR = 0.212; KB = 0.087
SMPTE ST 240 (1999, historical)
See ITU-T H.265 Equations E-28 to E-30
UNSPECIFIED class-attribute instance-attribute ¶
UNSPECIFIED = (2, 'unspec')
Unspecified.
Image characteristics are unknown or are determined by the application.
YCGCO class-attribute instance-attribute ¶
YCGCO = (8, 'ycgco', 'YCgCo')
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
67 68 69 70 71 | |
ensure_presence classmethod ¶
ensure_presence(
clip: VideoNode, value: Any, func: FuncExcept | None = None
) -> VideoNode
Ensure the presence of the property in the VideoNode.
Source code in vstools/enums/base.py
153 154 155 156 157 158 159 160 | |
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
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
from_param_or_video classmethod ¶
from_param_or_video(
value: Any,
src: VideoNode | VideoFrame | Mapping[str, Any],
strict: bool = False,
func_except: FuncExcept | None = None,
) -> Self
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 | Mapping[str, Any]) –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/base.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
from_param_with_fallback classmethod ¶
Attempts to obtain an enum member from a parameter value, returning a fallback if the value cannot be converted or represents an unspecified enum member.
Parameters:
-
(value¶Any) –The input value to convert into an enum member.
-
(fallback¶T | None, default:None) –The value to return if the input cannot be converted. Defaults to
None.
Returns:
-
Self | T | None–The corresponding enum member if conversion succeeds, otherwise the provided
fallbackvalue.
Source code in vstools/enums/base.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
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
186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 | |
from_video classmethod ¶
from_video(
src: VideoNode | VideoFrame | Mapping[str, Any],
strict: bool = False,
func: FuncExcept | None = None,
) -> Matrix
Try to obtain the matrix of a clip from the frame props or fallback to clip's resolution if the prop is undefined, strict=False and src is a clip.
Parameters:
-
(src¶VideoNode | VideoFrame | Mapping[str, Any]) –Input clip, frame, or props.
-
(strict¶bool, default:False) –Be strict about the frame props. Will ALWAYS error with Matrix.UNKNOWN.
-
(func¶FuncExcept | None, default:None) –Function returned for custom error handling.
Returns:
-
Matrix–Matrix object.
Raises:
-
UndefinedMatrixError–If the matrix is undefined or can not be determined from the frameprops.
Source code in vstools/enums/color.py
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 | |
is_unspecified ¶
is_unspecified() -> bool
Check if the matrix is Matrix.UNSPECIFIED.
Source code in vstools/enums/color.py
180 181 182 183 184 | |
pretty_string ¶
pretty_string() -> str
Get a pretty, displayable string of the enum member.
Source code in vstools/enums/base.py
45 46 47 48 49 50 | |
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_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_param_with_fallback–Attempts to obtain an enum member from a parameter value, returning a fallback if the value cannot be converted
-
from_res–Guess the primaries based on the clip's resolution.
-
from_video–Try to obtain the primaries of a clip from the frame props or fallback to clip's resolution
-
is_unspecified–Check if the primaries are Primaries.UNSPECIFIED.
-
pretty_string–Get a pretty, displayable string of the enum member.
-
prop_key–The key used in props to store the enum.
-
string–Get the string representation used in resize plugin/encoders.
Attributes:
-
BT2020–Rec. ITU-R BT.2020-2
-
BT470_BG–Rec. ITU-R BT.470-6 System B, G (historical)
-
BT470_M–Rec. ITU-R BT.470-6 System M (historical)
-
BT709–Rec. ITU-R BT.709-6
-
EBU3213_E–EBU Tech. 3213-E (1975)
-
FILM–Generic film (colour filters using Illuminant C)
-
ST170_M–(Functionally the same as Primaries.ST240_M)
-
ST240_M–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)
-
UNSPECIFIED–Unspecified.
-
XYZ–
Source code in vstools/enums/base.py
34 35 36 | |
BT2020 class-attribute instance-attribute ¶
BT2020 = (9, '2020', 'BT.2020')
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
BT470_BG class-attribute instance-attribute ¶
BT470_BG = (5, '470bg', 'BT.470bg')
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
BT470_M class-attribute instance-attribute ¶
BT470_M = (4, '470m', 'BT.470m')
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, '709', 'BT.709')
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
EBU3213_E class-attribute instance-attribute ¶
EBU3213_E = (22, 'jedec-p22', 'JEDEC P22 (EBU 3213-E)')
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
FILM class-attribute instance-attribute ¶
FILM = (8, 'film', 'Film')
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
ST170_M class-attribute instance-attribute ¶
ST170_M = (6, '170m', 'SMPTE ST 170m')
(Functionally the same as Primaries.ST240_M)
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)
ST240_M class-attribute instance-attribute ¶
ST240_M = (7, '240m', 'SMPTE ST 240m')
SMPTE ST 240 (1999, historical)
(Functionally the same as Primaries.ST170_M)
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, 'st428', 'SMPTE ST 428 (XYZ)')
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, 'st431-2', 'DCI-P3, DCI white point')
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, 'st432-1', 'DCI-P3 D65 white point')
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"
UNSPECIFIED class-attribute instance-attribute ¶
UNSPECIFIED = (2, 'unspec')
Unspecified.
Image characteristics are unknown or are determined by the application.
apply ¶
apply(clip: VideoNode) -> VideoNode
Applies the property to the VideoNode.
Source code in vstools/enums/base.py
67 68 69 70 71 | |
ensure_presence classmethod ¶
ensure_presence(
clip: VideoNode, value: Any, func: FuncExcept | None = None
) -> VideoNode
Ensure the presence of the property in the VideoNode.
Source code in vstools/enums/base.py
153 154 155 156 157 158 159 160 | |
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
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
from_param_or_video classmethod ¶
from_param_or_video(
value: Any,
src: VideoNode | VideoFrame | Mapping[str, Any],
strict: bool = False,
func_except: FuncExcept | None = None,
) -> Self
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 | Mapping[str, Any]) –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/base.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
from_param_with_fallback classmethod ¶
Attempts to obtain an enum member from a parameter value, returning a fallback if the value cannot be converted or represents an unspecified enum member.
Parameters:
-
(value¶Any) –The input value to convert into an enum member.
-
(fallback¶T | None, default:None) –The value to return if the input cannot be converted. Defaults to
None.
Returns:
-
Self | T | None–The corresponding enum member if conversion succeeds, otherwise the provided
fallbackvalue.
Source code in vstools/enums/base.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
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
601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 | |
from_video classmethod ¶
from_video(
src: VideoNode | VideoFrame | Mapping[str, Any],
strict: bool = False,
func: FuncExcept | None = None,
) -> Primaries
Try to obtain the primaries of a clip from the frame props or fallback to clip's resolution if the prop is undefined, strict=False and src is a clip.
Parameters:
-
(src¶VideoNode | VideoFrame | Mapping[str, Any]) –Input clip, frame, or props.
-
(strict¶bool, default:False) –Be strict about the frame props. Will ALWAYS error with Primaries.UNKNOWN.
-
(func¶FuncExcept | None, default:None) –Function returned for custom error handling.
Returns:
-
Primaries–Primaries object.
Raises:
-
UndefinedPrimariesError–If the primaries are undefined or can not be determined from the frameprops.
Source code in vstools/enums/color.py
624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 | |
is_unspecified ¶
is_unspecified() -> bool
Check if the primaries are Primaries.UNSPECIFIED.
Source code in vstools/enums/color.py
595 596 597 598 599 | |
pretty_string ¶
pretty_string() -> str
Get a pretty, displayable string of the enum member.
Source code in vstools/enums/base.py
45 46 47 48 49 50 | |
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_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_param_with_fallback–Attempts to obtain an enum member from a parameter value, returning a fallback if the value cannot be converted
-
from_res–Guess the transfer based on the clip's resolution.
-
from_video–Try to obtain the transfer of a clip from the frame props or fallback to clip's resolution
-
is_unspecified–Check if the transfer is Transfer.UNSPECIFIED.
-
pretty_string–Get a pretty, displayable string of the enum member.
-
prop_key–The key used in props to store the enum.
-
string–Get the string representation used in resize plugin/encoders.
Attributes:
-
ARIB_B67–Association of Radio Industries and Businesses (ARIB) STD-B67
-
BT2020_10–(Functionally the same as Transfer.BT709, Transfer.BT601,
-
BT2020_12–(Functionally the same as Transfer.BT709, Transfer.BT601,
-
BT470_BG–Rec. ITU-R BT.470-6 System B, G (historical)
-
BT470_M–Rec. ITU-R BT.470-6 System M (historical)
-
BT601–(Functionally the same as Transfer.BT709,
-
BT709–(Functionally the same as Transfer.BT601,
-
IEC_61966_2_1–IEC 61966-2-1 sRGB when matrix is equal to Matrix.RGB
-
IEC_61966_2_4–IEC 61966-2-4.
-
LINEAR–Linear transfer characteristics.
-
LOG_100–Logarithmic transfer characteristic (100:1 range).
-
LOG_316–Logarithmic transfer characteristic (100 * sqrt(10):1 range).
-
ST2084–SMPTE ST 2084 (2014) for 10, 12, 14, and 16-bit systems
-
ST240_M–SMPTE ST 240 (1999, historical).
-
ST428–SMPTE ST 428-1
-
UNSPECIFIED–Unspecified.
Source code in vstools/enums/base.py
34 35 36 | |
ARIB_B67 class-attribute instance-attribute ¶
ARIB_B67 = (18, 'std-b67', 'ARIB std-b67 (HLG)')
Association of Radio Industries and Businesses (ARIB) STD-B67
Rec. ITU-R BT.2100-2 hybrid loggamma (HLG) system
BT2020_10 class-attribute instance-attribute ¶
BT2020_10 = (14, '2020_10', 'BT.2020 10 bits')
(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, '2020_12', 'BT.2020 12 bits')
(Functionally the same as Transfer.BT709, Transfer.BT601, and Transfer.BT2020_10)
Rec. ITU-R BT.2020-2
BT470_BG class-attribute instance-attribute ¶
BT470_BG = (5, '470bg', 'BT.470bg')
Rec. ITU-R BT.470-6 System B, G (historical) Rec. ITU-R BT.1700-0 625 PAL and 625 SECAM
BT470_M class-attribute instance-attribute ¶
BT470_M = (4, '470m', 'BT.470m')
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, '601', 'BT.601')
(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, '709', 'BT.709')
(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)
IEC_61966_2_1 class-attribute instance-attribute ¶
IEC_61966_2_1 = (13, 'srgb', 'sRGB')
IEC 61966-2-1 sRGB when matrix is equal to Matrix.RGB
IEC 61966-2-1 sYCC when matrix is equal to Matrix.BT470_BG
IEC_61966_2_4 class-attribute instance-attribute ¶
IEC_61966_2_4 = (11, 'xvycc', 'xvYCC')
IEC 61966-2-4.
LINEAR class-attribute instance-attribute ¶
LINEAR = (8, 'linear', 'Linear')
Linear transfer characteristics.
LOG_100 class-attribute instance-attribute ¶
LOG_100 = (9, 'log100', 'Log 1:100 contrast')
Logarithmic transfer characteristic (100:1 range).
LOG_316 class-attribute instance-attribute ¶
LOG_316 = (10, 'log316', 'Log 1:316 contrast')
Logarithmic transfer characteristic (100 * sqrt(10):1 range).
ST2084 class-attribute instance-attribute ¶
ST2084 = (16, 'st2084', 'SMPTE ST 2084 (PQ)')
SMPTE ST 2084 (2014) for 10, 12, 14, and 16-bit systems
Rec. ITU-R BT.2100-2 perceptual quantization (PQ) system
ST240_M class-attribute instance-attribute ¶
ST240_M = (7, '240m', 'SMPTE ST 240m')
SMPTE ST 240 (1999, historical).
UNSPECIFIED class-attribute instance-attribute ¶
UNSPECIFIED = (2, 'unspec')
Unspecified.
Image characteristics are unknown or are determined by the application.
apply ¶
apply(clip: VideoNode) -> VideoNode
Applies the property to the VideoNode.
Source code in vstools/enums/base.py
67 68 69 70 71 | |
ensure_presence classmethod ¶
ensure_presence(
clip: VideoNode, value: Any, func: FuncExcept | None = None
) -> VideoNode
Ensure the presence of the property in the VideoNode.
Source code in vstools/enums/base.py
153 154 155 156 157 158 159 160 | |
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
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 | |
from_param_or_video classmethod ¶
from_param_or_video(
value: Any,
src: VideoNode | VideoFrame | Mapping[str, Any],
strict: bool = False,
func_except: FuncExcept | None = None,
) -> Self
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 | Mapping[str, Any]) –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/base.py
126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 | |
from_param_with_fallback classmethod ¶
Attempts to obtain an enum member from a parameter value, returning a fallback if the value cannot be converted or represents an unspecified enum member.
Parameters:
-
(value¶Any) –The input value to convert into an enum member.
-
(fallback¶T | None, default:None) –The value to return if the input cannot be converted. Defaults to
None.
Returns:
-
Self | T | None–The corresponding enum member if conversion succeeds, otherwise the provided
fallbackvalue.
Source code in vstools/enums/base.py
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | |
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
351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 | |
from_video classmethod ¶
from_video(
src: VideoNode | VideoFrame | Mapping[str, Any],
strict: bool = False,
func: FuncExcept | None = None,
) -> Transfer
Try to obtain the transfer of a clip from the frame props or fallback to clip's resolution if the prop is undefined, strict=False and src is a clip.
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.
-
(func¶FuncExcept | None, default:None) –Function returned for custom error handling.
Returns:
-
Transfer–Transfer object.
Raises:
-
UndefinedTransferError–If the transfer is undefined or can not be determined from the frameprops.
Source code in vstools/enums/color.py
371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 | |
is_unspecified ¶
is_unspecified() -> bool
Check if the transfer is Transfer.UNSPECIFIED.
Source code in vstools/enums/color.py
345 346 347 348 349 | |
pretty_string ¶
pretty_string() -> str
Get a pretty, displayable string of the enum member.
Source code in vstools/enums/base.py
45 46 47 48 49 50 | |