Skip to content

mycrl/vtsampler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

VTSampler

Cross-platform GPU video format conversion and scaling on wgpu. One VTImage in, one out — similar in spirit to D3D11 Video Processor, but portable.

Features

  • 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)

Quick example

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.

Example program

cargo run --example simple

Requires ffmpeg on PATH (downloads a sample image).

License

MIT Copyright (c) 2025 mycrl.

About

Cross-platform & hardware-accelerated texture scaling and conversion

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors