User API¶
The user-facing API is used primarily within VapourSynth scripts to register nodes for preview.
Functions:¶
set_output
¶
set_output(
node: VideoNode,
index: int = ...,
/,
*,
alpha: VideoNode | Literal[True] | None = ...,
framedurs: Sequence[SupportsFloat] | None = None,
hdr: bool | None = None,
**kwargs: Any,
) -> None
set_output(
node: VideoNode,
name: str | bool | None = ...,
/,
*,
alpha: VideoNode | Literal[True] | None = ...,
framedurs: Sequence[SupportsFloat] | None = None,
hdr: bool | None = None,
**kwargs: Any,
) -> None
set_output(
node: VideoNode,
index: int = ...,
name: str | bool | None = ...,
/,
alpha: VideoNode | Literal[True] | None = ...,
*,
framedurs: Sequence[SupportsFloat] | None = None,
hdr: bool | None = None,
**kwargs: Any,
) -> None
set_output(
node: AudioNode, index: int = ..., /, *, downmix: bool | None = None, **kwargs: Any
) -> None
set_output(
node: AudioNode,
name: str | bool | None = ...,
/,
*,
downmix: bool | None = None,
**kwargs: Any,
) -> None
set_output(
node: AudioNode,
index: int = ...,
name: str | bool | None = ...,
/,
*,
downmix: bool | None = None,
**kwargs: Any,
) -> None
set_output(
node: VideoNodeIterable | AudioNodeIterable | RawNodeIterable,
index: int | Sequence[int] = ...,
/,
**kwargs: Any,
) -> None
Register one or more VapourSynth nodes as outputs for preview.
This function sets the output(s) and registers metadata for tab naming in vsview. If no index is provided, outputs are assigned to the next available indices.
Examples:
set_output(clip) # Auto-index, auto-name ("clip")
set_output(clip, 0) # Index 0, auto-name
set_output(clip, 0, "My Clip") # Index 0, explicit name
set_output(clip, "Source") # Auto-index, explicit name
set_output([clip1, clip2]) # Multiple outputs
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
node
|
OutputNode
|
A VideoNode, AudioNode, or iterable of nodes to output. |
required |
index_or_name
|
int | Sequence[int] | str | bool | None
|
Either:
|
None
|
name
|
str | bool | None
|
Explicit name override. If provided when index_or_name is an int, this sets the display name for the output. |
None
|
alpha
|
VideoNode | Literal[True] | None
|
Optional alpha channel VideoNode or if True, fetch the |
None
|
framedurs
|
Sequence[SupportsFloat] | None
|
Optional sequence of frame durations in seconds for VFR clips (only for VideoNode outputs). |
None
|
hdr
|
bool | None
|
Optional boolean override for the HDR detection for VideoNode outputs.
If passing |
None
|
downmix
|
bool | None
|
if None (default), follows the global settings downmix of vsview if previewed through vsview. Otherwise True or False forces the behavior. |
None
|
**kwargs
|
Any
|
Additional metadata for custom configuration of this output. |
{}
|
Source code in src/vsview/api/output.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 179 180 181 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 | |
catch_output
¶
Decorator variant of set_output().
Calls the decorated function and registers its return value as an output.
Examples:
@catch_output
def source() -> vs.VideNode:
return vs.core.bs.BestSource("video.mkv")
@catch_output(name="Filtered", alpha=True)
def filtered() -> vs.VideNode:
src = vs.core.bs.BestSource("image.png")
return src.std.BoxBlur()
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
func
|
Callable[P, N] | None
|
The function to decorate (populated automatically when used as a bare decorator). |
None
|
index
|
int | Sequence[int] | None
|
An int or sequence of ints specifying output indices |
None
|
name
|
str | bool | None
|
Explicit name override. If not provided, the function name is used. |
None
|
alpha
|
VideoNode | Literal[True] | None
|
Optional alpha channel VideoNode or if True, fetch the |
None
|
framedurs
|
Sequence[SupportsFloat] | None
|
Optional sequence of frame durations in seconds for VFR clips (only for VideoNode outputs). |
None
|
downmix
|
bool | None
|
If None (default), follows the global settings downmix of vsview if previewed through vsview. Otherwise True or False forces the behavior. |
None
|
**kwargs
|
Any
|
Additional metadata passed to VSView plugins for custom configuration of this output. |
{}
|
Returns:
| Type | Description |
|---|---|
Callable[P, N] | Callable[[Callable[P, N]], Callable[P, N]]
|
The decorated function (its original return type is preserved). |
Source code in src/vsview/api/output.py
get_reload_count
¶
get_reload_count() -> int | None
Return how many times the current script has been reloaded in VSView (0 if initial load or None outside preview).
get_state
¶
get_state() -> MutableMapping[Any, Any] | None
Return the persistent state dictionary shared across script reloads, or None if outside VSView.
Note
Objects stored in this dictionary survive script reloads within the same workspace. - DO NOT store VapourSynth clips, frames, or script closures capturing 'globals()'. - DO store heavy external resources (e.g. PyTorch models, ONNX sessions, lookup tables).
Source code in src/vsview/api/info.py
get_cached
¶
Get a cached value from the persistent state, or compute and cache it if not present.
If running outside VSView, the loader is called directly without caching.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
key
|
str
|
The key to look up or store in the persistent state. |
required |
loader
|
Callable[P, R]
|
A callable to produce the value if key is not found. |
required |
*args
|
P.args
|
Positional arguments forwarded to loader. |
()
|
**kwargs
|
P.kwargs
|
Keyword arguments forwarded to loader. |
{}
|
Returns:
| Type | Description |
|---|---|
R
|
The cached or newly computed value. |