1个不稳定版本
0.1.0 | 2024年1月3日 |
---|
#9 在 #channels
425KB
594 行
ffmpeg-next-io
这是一个辅助库,用于 ffmpeg-next,它为绑定提供了通用的IO实现。
此库为实现了 std::io::Read
和 std::io::Write
的任何结构体提供了包装器,支持 std::io::Seek
寻找。
我们还提供了许多流行通道的通道兼容层,包括 std::sync::mpsc
,crossbeam-channel
和 tokio
。
此库允许您从不同的线程写入FFmpeg。这意味着您可以在异步运行时中使用FFmpeg,并将数据从异步上下文传递到同步上下文,而无需阻塞或首先写入文件。
没有这个库,您将需要写入临时文件或网络套接字或某些Unix管道,这并不是理想的选择。此库为ffmpeg-next提供了所需的内存解决方案。
用法
将此添加到您的 Cargo.toml
[dependencies]
ffmpeg-next-io = "0.1.0"
示例
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
有关更多示例,请参阅 示例 目录。
许可证
本项目采用MIT许可证 (LICENSE 或 https://open-source.org.cn/licenses/MIT)。
依赖项
~1–14MB
~185K SLoC