ffmpeg_version

Function ffmpeg_version 

Source
pub fn ffmpeg_version() -> Result<String>
Expand description

Alias for ffmpeg -version, parsing the version number and returning it.

Examples found in repository?
examples/download_ffmpeg_with_progress.rs (line 45)
9fn main() -> anyhow::Result<()> {
10  use ffmpeg_sidecar::command::ffmpeg_is_installed;
11
12  if ffmpeg_is_installed() {
13    println!("FFmpeg is already installed! 🎉");
14    println!("For demo purposes, we'll re-download and unpack it anyway.");
15    println!(
16      "TIP: Use `auto_download_with_progress(progress_callback)` to skip manual customization."
17    );
18  }
19
20  let progress_callback = |e: FfmpegDownloadProgressEvent| match e {
21    FfmpegDownloadProgressEvent::Starting => {
22      println!("Starting download...");
23    }
24    FfmpegDownloadProgressEvent::Downloading {
25      downloaded_bytes,
26      total_bytes,
27    } => {
28      print!(
29        "\rDownloaded {:.1}/{:.1} mB    ",
30        downloaded_bytes as f64 / 1024.0 / 1024.0,
31        total_bytes as f64 / 1024.0 / 1024.0
32      );
33      std::io::stdout().flush().unwrap();
34    }
35    FfmpegDownloadProgressEvent::UnpackingArchive => {
36      println!("\nUnpacking archive...");
37    }
38    FfmpegDownloadProgressEvent::Done => {
39      println!("Ffmpeg downloaded successfully!")
40    }
41  };
42
43  force_download_with_progress(progress_callback)?;
44
45  let version = ffmpeg_version()?;
46  println!("FFmpeg version: {version}");
47  Ok(())
48}