error: failed to run custom build command for `ffmpeg-sys-next v7.1.0`

Hello. I'm experiencing issues with building FFmpeg Rust bindings on Windows environment.

Environment

  • OS: Windows 11
  • FFmpeg: Manual installation (Following zmwangx/rust-ffmpeg guide)
  • MSYS2/MinGW: Installed (Also installed FFmpeg through MSYS2)

Steps Taken

  1. Created new project:

bash

Copy

cargo new ffmpeg-sample
  1. Cargo.toml configuration:

toml

Copy

[package]
name = "ffmpeg-sample"
version = "0.1.0"
edition = "2021"

[dependencies]
ffmpeg-next = { version = "7.1.0", features = ["static", "build"] }
ffmpeg-sys-next = { version = "7.1.0", features = ["static", "build"] }
pkg-config = "0.3.31"
  1. Ran cargo build

Error Output

Copy

Caused by:
  process didn't exit successfully: `C:\Users\super\Workspace\superhan\rust-study\ffmpeg-sample\target\debug\build\ffmpeg-sys-next-94d1e92da322ea10\build-script-build` (exit code: 101)
  --- stdout
  cargo:rustc-link-search=native=C:\Users\super\Workspace\superhan\rust-study\ffmpeg-sample\target\debug\build\ffmpeg-sys-next-b910e1ad937100a4\out\dist\lib
  cargo:rustc-link-lib=static=avcodec
  cargo:rustc-link-lib=static=avdevice
  cargo:rustc-link-lib=static=avfilter
  cargo:rustc-link-lib=static=avformat
  cargo:rustc-link-lib=static=avutil
  cargo:rustc-link-lib=static=swresample
  cargo:rustc-link-lib=static=swscale
  --- stderr
  Cloning into 'ffmpeg-7.1'...
  Updating files: 100% (8563/8563), done.
  thread 'main' panicked at [...]\build.rs:365:29:
  "C:\\Users\\super\\[...}\\configure" "--prefix=[...]\\dist" [...] failed

The FFmpeg configure script seems to be failing during execution. How can I resolve this issue?

Any help would be greatly appreciated.

this seems an autotools configure script, which is supported on Windows.

since you already installed the ffmpeg library, you should not need to use the "build" feature, and let the build script to detect your ffmpeg installation.

if it cannot find it, make sure you have set the FFMPEG_DIR environment variable correctly.