vtsampler 0.1.0

A pure Rust implementation similar to ID3D11VideoProcessor
Documentation

VTSampler

A pure Rust implementation similar to ID3D11VideoProcessor, but cross-platform and cross-graphics API, with all tasks executed on the GPU, which is very fast!

ID3D11VideoProcessor is an implementation that handles tasks such as color space conversion and texture scaling, specifically designed for video stream-related tasks.


Since it is still under development, it is not currently available on crates.io, but it is already usable.

This library currently supports conversion between RGBA, BGRA, NV12, and YUV420P, and also supports texture scaling.

However, there are currently some limitations, such as the color space being fixed (BT.601) and the scaling sampling mode being Nearest, which is the simplest sampling implementation. Additionally, it only supports copying from CPU to GPU and does not support writing back from GPU to CPU.

These limitations are related to the current simple implementation of the shader generator. Future plans include developing a more feature-rich shader generator.

Furthermore, future plans also include supporting native textures from certain graphics APIs, such as ID3D11Texture2D, MTLTexture, and CVPixelBuffer, allowing these texture types to be used directly without manual conversion to wgpu Texture.

Example

use vtsampler::{PixelData, VTFormat, VTImage, VTProcessOptions, VTSamplerBuilder};

let mut sampler = VTSamplerBuilder::default().build().await?;

let input = VTImage::from_cpu(&pixel_data, 1920, 1080);
let output = VTImage::from_render_target(&gpu_texture, VTFormat::BGRA);

sampler.process(&input, &output, VTProcessOptions::default())?;

License

MIT Copyright (c) 2025 mycrl.