https://github.com/yeautyye/ez-ffmpeg
A safe and ergonomic Rust interface for FFmpeg integration, designed for ease of use.
https://github.com/yeautyye/ez-ffmpeg
audio cross-platform easy example ffmpeg flv integration media opengl rtmp rust safe tutorial video
Last synced: 7 months ago
JSON representation
A safe and ergonomic Rust interface for FFmpeg integration, designed for ease of use.
- Host: GitHub
- URL: https://github.com/yeautyye/ez-ffmpeg
- Owner: YeautyYE
- License: apache-2.0
- Created: 2025-03-05T09:55:58.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2025-07-19T06:42:35.000Z (8 months ago)
- Last Synced: 2025-07-19T10:13:39.065Z (8 months ago)
- Topics: audio, cross-platform, easy, example, ffmpeg, flv, integration, media, opengl, rtmp, rust, safe, tutorial, video
- Language: Rust
- Homepage:
- Size: 602 KB
- Stars: 195
- Watchers: 4
- Forks: 8
- Open Issues: 4
-
Metadata Files:
- Readme: README.md
- License: LICENSE-APACHE
Awesome Lists containing this project
README
[](https://crates.io/crates/ez-ffmpeg)
[](https://docs.rs/ez-ffmpeg)
[](https://github.com/YeautyYE/ez-ffmpeg/blob/main/LICENSE-APACHE)
[](https://www.rust-lang.org/)
[](https://ffmpeg.org)
## Overview
**`ez-ffmpeg`** provides a **safe and ergonomic Rust interface for FFmpeg integration**, offering a familiar API that closely follows FFmpeg’s original logic and parameter structures.
This library:
- Ensures full safety without using `unsafe` code
- Keeps the execution logic and parameter conventions as close to FFmpeg as possible
- Provides an intuitive and user-friendly API for media processing
- Supports custom Rust filters and flexible input/output handling
- Offers optional RTMP and OpenGL integration
By abstracting the complexity of the raw C API, `ez-ffmpeg` simplifies configuring media pipelines, performing transcoding and filtering, and inspecting media streams.
## Version Requirements
- **Rust:** Version 1.80.0 or higher.
- **FFmpeg:** Version 7.0 or higher.
## Documentation
More information about this crate can be found in the [crate documentation](https://docs.rs/ez-ffmpeg).
## Quick Start
### Installation Prerequisites
#### macOS
```bash
brew install ffmpeg
```
#### Windows
```bash
# For dynamic linking
vcpkg install ffmpeg
# For static linking (requires 'static' feature)
vcpkg install ffmpeg:x64-windows-static-md
# Set VCPKG_ROOT environment variable
```
### Adding the Dependency
Add **ez-ffmpeg** to your project by including it in your `Cargo.toml`:
```toml
[dependencies]
ez-ffmpeg = "*"
```
### Basic Usage
Below is a basic example to get you started. Create or update your `main.rs` with the following code:
```rust
use ez_ffmpeg::FfmpegContext;
use ez_ffmpeg::FfmpegScheduler;
fn main() -> Result<(), Box> {
// 1. Build the FFmpeg context
let context = FfmpegContext::builder()
.input("input.mp4")
.filter_desc("hue=s=0") // Example filter: desaturate (optional)
.output("output.mov")
.build()?;
// 2. Run it via FfmpegScheduler (synchronous mode)
let result = FfmpegScheduler::new(context)
.start()?
.wait();
result?; // Propagate any errors that occur
Ok(())
}
```
More examples can be found [here][examples].
[examples]: https://github.com/YeautyYE/ez-ffmpeg/tree/master/examples
## Features
**ez-ffmpeg** offers several optional features that can be enabled in your `Cargo.toml` as needed:
- **opengl:** Enables GPU-accelerated OpenGL filters for high-performance video processing.
- **rtmp:** Includes an embedded RTMP server for local streaming scenarios.
- **flv:** Provides support for FLV container parsing and handling.
- **async:** Adds asynchronous functionality (allowing you to `.await` operations).
- **static:** Enables static linking for FFmpeg libraries (via `ffmpeg-next/static`).
## License
ez-ffmpeg is licensed under your choice of the MIT, Apache-2.0, or MPL-2.0 licenses. You may select the license that best fits your needs.
**Important:** While ez-ffmpeg is freely usable, FFmpeg has its own licensing terms. Ensure that your use of its components complies with FFmpeg's license.