1 unstable release
0.1.0 | Jan 3, 2024 |
---|
#72 in #io-write
425KB
594 lines
ffmpeg-next-io
This is a helper library for ffmpeg-next that provides a general purpose IO implementation for bindings.
This library provides a wrapper for any struct that implements std::io::Read
and std::io::Write
, with seeking support for std::io::Seek
.
We also have a channel compatability layer for many popular channels, including std::sync::mpsc
, crossbeam-channel
and tokio
.
This library allows you to write to FFmpeg from a different thread. Meaning you can use FFmpeg in a async runtime and pass data from the async context to the sync context without blocking or having to write to a file first.
Without this libary you would be required to write to a tempory file or network socket or some unix pipe, which is not ideal. This library provides a much needed in-memory solution for ffmpeg-next.
Usage
Add this to your Cargo.toml
:
[dependencies]
ffmpeg-next-io = "0.1.0"
Example
use ffmpeg_next_io::Input;
let bytes = include_bytes!("../input.mp4"); // or any other source of bytes
let mut input = Input::seekable(std::io::Cursor::new(bytes));
// now you can use `input` as an input for ffmpeg-next
For more examples, see the examples directory.
License
This project is licensed under the MIT license (LICENSE or http://opensource.org/licenses/MIT).
Dependencies
~1–14MB
~189K SLoC