Crate vapoursynth [−] [src]
A safe wrapper for VapourSynth, written in Rust.
The primary goal is safety (that is, safe Rust code should not trigger undefined behavior), and secondary goals include performance and ease of use.
Functionality
Most of the VapourSynth API is covered. It's possible to evaluate .vpy
scripts, access their
properties and output, retrieve frames. A notable exception is API for creating VapourSynth
filters, which will come out next.
For an example usage see examples/vspipe.rs, a complete reimplementation of VapourSynth's vspipe in safe Rust utilizing this crate.
Short example
use vapoursynth::prelude::*; let env = Environment::from_file("test.vpy", EvalFlags::SetWorkingDir)?; let node = env.get_output(0)?.0; // Without `.0` for VSScript API 3.0 let frame = node.get_frame(0)?; println!("Resolution: {}×{}", frame.width(0), frame.height(0));
Supported Versions
Right now the x86_64 and i686 Unix and x86_64 Windows targets are supported.
All VapourSynth and VSScript API versions starting with 3.0 are supported. By default the crates use the 3.0 feature set. To enable higher API version support, enable one of the following Cargo features:
vapoursynth-api-31
for VapourSynth API 3.1vapoursynth-api-32
for VapourSynth API 3.2vapoursynth-api-33
for VapourSynth API 3.3vapoursynth-api-34
for VapourSynth API 3.4vapoursynth-api-35
for VapourSynth API 3.5vsscript-api-31
for VSScript API 3.1vsscript-api-32
for VSScript API 3.2
To enable linking to VapourSynth or VSScript functions (currently required to do anything useful), enable the following Cargo features:
vapoursynth-functions
for VapourSynth functions (getVapourSynthAPI()
)vsscript-functions
for VSScript functions (vsscript_*()
)
Building
Make sure you have the corresponding libraries available if you enable the linking features.
You can use the VAPOURSYNTH_LIB_DIR
environment variable to specify a custom directory with
the library files.
On Windows the easiest way is to install 64-bit Python, then use the VapourSynth installer
(make sure the VapourSynth SDK is checked) and set VAPOURSYNTH_LIB_DIR
to
C:\Program Files (x86)\VapourSynth\sdk\lib64
.
Modules
api |
Most general VapourSynth API functions. |
core |
VapourSynth cores. |
format |
VapourSynth frame formats. |
frame |
VapourSynth frames. |
function |
VapourSynth callable functions. |
map |
VapourSynth maps. |
node |
VapourSynth nodes. |
prelude |
The VapourSynth prelude. |
video_info |
Video clip formats. |
vsscript |
VapourSynth script-related things. |