Crate ffmpeg_sidecar

Source
Expand description

Wrap a standalone FFmpeg binary in an intuitive Iterator interface.

§Example

use ffmpeg_sidecar::command::FfmpegCommand;
fn main() -> anyhow::Result<()> {
  // Run an FFmpeg command that generates a test video
  let iter = FfmpegCommand::new() // <- Builder API like `std::process::Command`
    .testsrc()  // <- Discoverable aliases for FFmpeg args
    .rawvideo() // <- Convenient argument presets
    .spawn()?   // <- Ordinary `std::process::Child`
    .iter()?;   // <- Blocking iterator over logs and output

  // Use a regular "for" loop to read decoded video data
  for frame in iter.filter_frames() {
    println!("frame: {}x{}", frame.width, frame.height);
    let _pixels: Vec<u8> = frame.data; // <- raw RGB pixels! 🎨
  }

  Ok(())
}

Modules§

child
Wrapper around std::process::Child containing a spawned FFmpeg command.
comma_iter
An internal utility used to parse comma-separated values in FFmpeg logs.
command
Builder interface for FFmpeg commands.
download
Utilities for downloading and unpacking FFmpeg binaries.
event
Any event that occurs during the execution of an FFmpeg command.
ffprobe
Utilities related to the FFprobe binary.
iter
A stream of events from an FFmpeg process.
log_parser
Internal methods for parsing FFmpeg CLI log output.
metadata
Information about an FFmpeg process and its streams.
named_pipesnamed_pipes
Cross-platform abstraction over Windows async named pipes and Unix FIFO.
paths
Utilities for locating FFmpeg binaries on the system.
pix_fmt
A database of the pixel formats supported by FFmpeg and their size per pixel.
read_until_any
Internal utility; BufRead::read_until with multiple delimiters.
version
Utilities for checking local FFmpeg version string.

Macros§

pipe_namenamed_pipes
On Windows, prepend the pipe name with \\.\pipe\. On Unix, return the name as-is.

Type Aliases§

Result
Result<T, Error>