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.
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
135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
|
combine_expr ¶
combine_expr(
n: SupportsIndex | ExprVars | 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 | ExprVars | HoldsVideoFormat | VideoFormatLike
) –Object from which to infer the number of 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
97 98 99 100 101 102 103 104 105 106 107 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 |
|
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
32 33 34 35 36 37 38 39 40 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 |
|
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
182 183 184 185 186 187 188 189 190 191 192 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 |
|