Thanks to visit codestin.com
Credit goes to lib.rs

#ffmpeg #rtmp

ez-ffmpeg

A safe and ergonomic Rust interface for FFmpeg integration, designed for ease of use

26 releases (6 breaking)

new 0.7.0 Jan 26, 2026
0.6.0 Nov 20, 2025
0.5.6 Oct 31, 2025
0.5.3 Jul 20, 2025
0.1.7 Mar 27, 2025

#41 in Video

Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App Codestin Search App

11,988 downloads per month

MIT OR Apache-2.0 OR MPL-2.0

1MB
23K SLoC

Logo

Crates.io Documentation License: MIT/Apache-2.0/MPL-2.0 Rust FFmpeg

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 GPU-accelerated OpenGL filters and high-performance embedded RTMP server

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.

Quick Start

Installation Prerequisites

macOS

brew install ffmpeg

Windows

# 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:

[dependencies]
ez-ffmpeg = "*"

Basic Usage

Below is a basic example to get you started. Create or update your main.rs with the following code:

use ez_ffmpeg::FfmpegContext;
use ez_ffmpeg::FfmpegScheduler;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    // 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.

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: High-performance embedded RTMP server with native epoll/kqueue, O(1) GOP sharing, and 10,000+ concurrent connections on Linux/macOS (8,000 on Windows). In-process ingest with no TCP between FFmpeg and server.
  • 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.

Dependencies

~1.3–7.5MB
~143K SLoC