| Crates.io | video-toolbox-sys |
| lib.rs | video-toolbox-sys |
| version | 0.2.0 |
| created_at | 2026-01-22 11:58:23.984809+00 |
| updated_at | 2026-01-22 11:58:23.984809+00 |
| description | FFI bindings and helpers for Apple VideoToolbox framework |
| homepage | https://github.com/luozijun/rust-videotoolbox-sys |
| repository | https://github.com/luozijun/rust-videotoolbox-sys |
| max_upload_size | |
| id | 2061411 |
| size | 213,097 |
FFI bindings and helpers for Apple VideoToolbox framework.
VideoToolbox is a low-level framework that provides direct access to hardware encoders and decoders on macOS and iOS. It provides services for video compression and decompression, and for conversion between raster image formats stored in CoreVideo pixel buffers.
helpers feature)Add to your Cargo.toml:
[dependencies]
video-toolbox-sys = "0.2"
# Optional: Enable high-level helpers
video-toolbox-sys = { version = "0.2", features = ["helpers"] }
use video_toolbox_sys::codecs;
use video_toolbox_sys::compression::*;
use video_toolbox_sys::errors::vt_error_to_string;
// Use codec constants
let codec = codecs::video::H264;
let pixel_format = codecs::pixel::BGRA32;
use video_toolbox_sys::helpers::CompressionSessionBuilder;
use video_toolbox_sys::codecs;
let session = CompressionSessionBuilder::new(1920, 1080, codecs::video::H264)
.hardware_accelerated(true)
.bitrate(8_000_000)
.frame_rate(30.0)
.build(|_, _, status, _, sample_buffer| {
if status == 0 && !sample_buffer.is_null() {
// Handle encoded frame
}
})
.expect("Failed to create compression session");
See the examples/ directory for complete working examples:
encode_dummy_image.rs - Encode synthetic frames to H.264camera_to_mp4.rs - Capture from camera and save to MP4av_record.rs - Record audio + video to MOVRun an example:
cargo run --example encode_dummy_image
MIT