🎬 Introduction
video-rs is a general-purpose video library for Rust that uses the
libav-family libraries from ffmpeg. It aims to provide a stable and Rusty
interface to many common video tasks such as reading, writing, muxing, encoding
and decoding.
🛠 S️️tatus
⚠️ This project is still a work-in-progress, and will contain bugs. Some parts of the API have not been flushed out yet. Use with caution.
Also check out our other video/audio project
rave. rave is still in development,
but its eventual goal is to replace video-rs and provide a fully featured
media library without depending on ffmpeg.
📦 Setup
First, install the ffmpeg libraries. The ffmpeg-next project has
excellent instructions
on this (video-rs depends on the ffmpeg-next crate).
Then, add the following to your dependencies in Cargo.toml:
= "0.11"
Use the ndarray feature to be able to use raw frames with the
ndarray crate:
= { = "0.11", = ["ndarray"] }
📖 Examples
Decode a video and print the RGB value for the top left pixel:
use Decoder;
use Url;
Encode a 🌈 video, using ndarray to create each frame:
use Path;
use Array3;
use ;
use Time;
🪲 Debugging
Ffmpeg does not always produce useful error messages directly. It is recommended to turn on tracing if you run into an issue to see if there is extra information present in the log messages.
Add the following packages to Cargo.toml:
[]
= "0.1"
= "0.3"
And add the following to your main functions:
Set the RUST_LOG environment variable to display tracing messages:
RUST_LOG=video=debug
✨ Credits
video-rs only exists thanks to the following organizations and people:
- All contributors for their work!
- Provincie Utrecht for supporting this project as part of the "Situational Awareness Software" project.
- zmwangx for maintaining rust-ffmpeg.
- The FFmpeg project for
ffmpegand theffmpeglibraries.
⚖️ License
Licensed under either of
- Apache License, Version 2.0 (LICENSE-APACHE or http://www.apache.org/licenses/LICENSE-2.0)
- MIT license (LICENSE-MIT or http://opensource.org/licenses/MIT)
at your option.
Contribution
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.