funcs ¶
Functions:
-
combine
–Combines multiple video clips using a specified expression operator.
-
combine_expr
–Builds a combine expression using a specified expression operator.
-
expr_func
–Calls
akarin.Expr
plugin. -
norm_expr
–Evaluate a per-pixel expression on input clip(s), normalize it based on the specified planes,
ExprLike module-attribute
¶
A recursive type representing a valid expression input.
Acceptable forms include: - A single string (or string-like object): Used as the same expression for all planes. - A list of expressions: Concatenated into a single expression for all planes. - A tuple of expressions: Interpreted as separate expressions for each plane. - A TupleExprList: will make a norm_expr call for each expression within this tuple.
bitdepth_aware_tokenize_expr ¶
bitdepth_aware_tokenize_expr(
clips: Sequence[VideoNode],
expr: str,
chroma: bool,
func: FuncExcept | None = None,
) -> str
Source code in vsexprtools/funcs.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 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 |
|
combine ¶
combine(
clips: VideoNodeIterableT[VideoNode],
operator: ExprOpBase = MAX,
suffix: SupportsString | Iterable[SupportsString] | None = None,
prefix: SupportsString | Iterable[SupportsString] | None = None,
expr_suffix: SupportsString | Iterable[SupportsString] | None = None,
expr_prefix: SupportsString | Iterable[SupportsString] | None = None,
planes: Planes = None,
split_planes: bool = False,
**kwargs: Any
) -> ConstantFormatVideoNode
Combines multiple video clips using a specified expression operator.
Parameters:
-
clips
¶VideoNodeIterableT[VideoNode]
) –Input clip(s).
-
operator
¶ExprOpBase
, default:MAX
) –An ExprOpBase enum used to join the clips.
-
suffix
¶SupportsString | Iterable[SupportsString] | None
, default:None
) –Optional suffix string(s) to append to each input variable in the expression.
-
prefix
¶SupportsString | Iterable[SupportsString] | None
, default:None
) –Optional prefix string(s) to prepend to each input variable in the expression.
-
expr_suffix
¶SupportsString | Iterable[SupportsString] | None
, default:None
) –Optional expression to append after the combined input expression.
-
expr_prefix
¶SupportsString | Iterable[SupportsString] | None
, default:None
) –Optional expression to prepend before the combined input expression.
-
planes
¶Planes
, default:None
) –Which planes to process. Defaults to all.
-
split_planes
¶bool
, default:False
) –If True, treats each plane of input clips as separate inputs.
-
**kwargs
¶Any
, default:{}
) –Additional keyword arguments forwarded to norm_expr.
Returns:
-
ConstantFormatVideoNode
–A clip representing the combined result of applying the expression.
Source code in vsexprtools/funcs.py
146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 |
|
combine_expr ¶
combine_expr(
n: (
SupportsIndex
| Sequence[SupportsString]
| HoldsVideoFormat
| VideoFormatLike
),
operator: ExprOpBase = MAX,
suffix: SupportsString | Iterable[SupportsString] | None = None,
prefix: SupportsString | Iterable[SupportsString] | None = None,
expr_suffix: SupportsString | Iterable[SupportsString] | None = None,
expr_prefix: SupportsString | Iterable[SupportsString] | None = None,
) -> ExprList
Builds a combine expression using a specified expression operator.
For combining multiple clips, see combine.
Parameters:
-
n
¶SupportsIndex | Sequence[SupportsString] | HoldsVideoFormat | VideoFormatLike
) –Object from which to infer the variables.
-
operator
¶ExprOpBase
, default:MAX
) –An ExprOpBase enum used to join the variables.
-
suffix
¶SupportsString | Iterable[SupportsString] | None
, default:None
) –Optional suffix string(s) to append to each input variable in the expression.
-
prefix
¶SupportsString | Iterable[SupportsString] | None
, default:None
) –Optional prefix string(s) to prepend to each input variable in the expression.
-
expr_suffix
¶SupportsString | Iterable[SupportsString] | None
, default:None
) –Optional expression to append after the combined input expression.
-
expr_prefix
¶SupportsString | Iterable[SupportsString] | None
, default:None
) –Optional expression to prepend before the combined input expression.
Returns:
-
ExprList
–A expression representing the combined result.
Source code in vsexprtools/funcs.py
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 |
|
expr_func ¶
expr_func(
clips: VideoNode | Sequence[VideoNode],
expr: str | Sequence[str],
format: HoldsVideoFormat | VideoFormatLike | None = None,
opt: bool = False,
boundary: bool = True,
func: FuncExcept | None = None,
) -> ConstantFormatVideoNode
Calls akarin.Expr
plugin.
For a higher-level function, see norm_expr
Web app to dissect expressions
Parameters:
-
clips
¶VideoNode | Sequence[VideoNode]
) –Input clip(s). Supports constant format clips, or one variable resolution clip.
-
expr
¶str | Sequence[str]
) –Expression to be evaluated.
-
format
¶HoldsVideoFormat | VideoFormatLike | None
, default:None
) –Output format, defaults to the first clip format.
-
opt
¶bool
, default:False
) –Forces integer evaluation as much as possible.
-
boundary
¶bool
, default:True
) –Specifies the default boundary condition for relative pixel accesses:
- True (default): Mirrored edges.
- False: Clamped edges.
-
func
¶FuncExcept | None
, default:None
) –Function returned for custom error handling. This should only be set by VS package developers.
Raises:
-
CustomRuntimeError
–If
akarin
plugin is not found. -
CustomExprError
–If the expression could not be evaluated.
Returns:
-
ConstantFormatVideoNode
–Evaluated clip.
Source code in vsexprtools/funcs.py
41 42 43 44 45 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 88 89 90 91 92 93 94 95 96 |
|
extra_op_tokenize_expr ¶
Source code in vsexprtools/funcs.py
272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 |
|
norm_expr ¶
norm_expr(
clips: VideoNodeIterableT[VideoNode],
expr: ExprLike,
planes: Planes = None,
format: HoldsVideoFormat | VideoFormatLike | None = None,
opt: bool = False,
boundary: bool = True,
func: FuncExcept | None = None,
split_planes: bool = False,
debug: bool = False,
**kwargs: Iterable[SupportsString] | SupportsString
) -> ConstantFormatVideoNode
Evaluate a per-pixel expression on input clip(s), normalize it based on the specified planes, and format tokens and placeholders using provided keyword arguments.
Web app to dissect expressions
Parameters:
-
clips
¶VideoNodeIterableT[VideoNode]
) –Input clip(s). Supports constant format clips, or one variable resolution clip.
-
expr
¶ExprLike
) –Expression to be evaluated.
- A single str will be processed for all planes.
- A list will be concatenated to form a single expr for all planes.
- A tuple of these types will allow specification of different expr for each planes.
- A TupleExprList will make a
norm_expr
call for each expression within this tuple.
-
planes
¶Planes
, default:None
) –Plane to process, defaults to all.
-
format
¶HoldsVideoFormat | VideoFormatLike | None
, default:None
) –Output format, defaults to the first clip format.
-
opt
¶bool
, default:False
) –Forces integer evaluation as much as possible.
-
boundary
¶bool
, default:True
) –Specifies the default boundary condition for relative pixel accesses:
- True (default): Mirrored edges.
- False: Clamped edges.
-
func
¶FuncExcept | None
, default:None
) –Function returned for custom error handling. This should only be set by VS package developers.
-
split_planes
¶bool
, default:False
) –Splits the VideoNodes into their individual planes.
-
debug
¶bool
, default:False
) –Print out the normalized expr.
-
**kwargs
¶Iterable[SupportsString] | SupportsString
, default:{}
) –Additional keywords arguments to be passed to the expression function. These arguments are key-value pairs, where the keys are placeholders that will be replaced in the expression string. Iterable values (except str and bytes types) will be associated with the corresponding plane.
Returns:
-
ConstantFormatVideoNode
–Evaluated clip.
Source code in vsexprtools/funcs.py
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 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 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 |
|
norm_expr_planes ¶
norm_expr_planes(
clip: VideoNode,
expr: str | list[str],
planes: Planes = None,
**kwargs: Iterable[SupportsString] | SupportsString
) -> list[str]
Source code in vsexprtools/funcs.py
337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 |
|