Crates.io | essi-ffmpeg |
lib.rs | essi-ffmpeg |
version | 0.2.0 |
source | src |
created_at | 2024-02-26 11:33:17.624138 |
updated_at | 2024-02-26 23:15:07.916343 |
description | An easy to use FFmpeg CLI wrapper |
homepage | |
repository | https://github.com/MrAdhit/essi-ffmpeg |
max_upload_size | |
id | 1153452 |
size | 52,562 |
Use FFmpeg easily, includes downloading FFmpeg binaries, executing FFmpeg commands, and handling I/O processing tasks. Provides a simplified interface for utilizing the power of FFmpeg.
Add essi-ffmpeg
to your Cargo.toml
dependencies:
[dependencies]
essi-ffmpeg = { git = "https://github.com/MrAdhit/essi-ffmpeg" }
use essi_ffmpeg::FFmpeg;
#[tokio::main]
async fn main() -> anyhow::Result<()> {
// Automatically download FFmpeg if not found
if let Some((handle, mut progress)) = FFmpeg::auto_download().await.unwrap() {
tokio::spawn(async move {
while let Some(state) = progress.recv().await {
println!("{:?}", state);
}
});
handle.await.unwrap().unwrap();
} else {
println!("FFmpeg is downloaded, using existing installation");
}
// Build and execute an FFmpeg command
let mut ffmpeg = FFmpeg::new()
.stderr(std::process::Stdio::inherit())
.input_with_file("input_file.flv".into()).done()
.output_as_file("output_file.mp4".into()).done()
.start().unwrap();
ffmpeg.wait().unwrap();
Ok(())
}
This crate includes several examples demonstrating different use cases:
basic_usage.rs
: Shows the basic usage of using this library.muxing_hardware_accelerated.rs
: Demonstrates muxing with hardware acceleration.muxing_multiple_output.rs
: Shows how to mux multiple outputs.override_ffmpeg_download_directory.rs
: Illustrates how to override the default FFmpeg download directory.windows_screen_recorder.rs
: Provides an example of a simple screen recorder on Windows using FFmpeg.To run an example, use:
cargo run --example example_name
Contributions are welcome! Here are several ways you can contribute:
essi-ffmpeg
project.This project is licensed under the MIT License. See the LICENSE file for details.