Cross-platform GPU video format conversion and scaling on wgpu. One VTImage in, one out — similar in spirit to D3D11 Video Processor, but portable.
- Formats: RGBA, BGRA, NV12, YUV420P (any → any)
- Scaling when input/output sizes differ
- Color: BT.601 / BT.709 limited range
- Backings: CPU, wgpu textures, D3D11 (Windows),
CVPixelBuffer(macOS)
use vtsampler::{PixelData, VTFormat, VTImage, VTProcessOptions, VTSamplerBuilder};
# async fn run() -> Result<(), vtsampler::VTSampleError> {
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())?;
# Ok(())
# }Share your renderer's device with VTSamplerBuilder::with_arc_device.
cargo run --example simpleRequires ffmpeg on PATH (downloads a sample image).
MIT Copyright (c) 2025 mycrl.