-
Notifications
You must be signed in to change notification settings - Fork 220
Notes on building
On *nix systems, clang
, pkg-config
and FFmpeg libraries (including development headers) are required.
On macOS:
brew install pkg-config ffmpeg
On Debian-based systems:
apt install -y clang libavcodec-dev libavformat-dev libavutil-dev pkg-config
Other libav*-dev
and libsw*-dev
packages may be required if you enable the corresponding features, e.g., libavdevice-dev
for the device
feature.
At the moment codec
and format
are mandatory features, or ffmpeg-sys-next
won't build.
- Install LLVM (through official installer, Visual Studio, Chocolatey, or any other means), and add LLVM's
bin
path toPATH
, or setLIBCLANG_PATH
to that (seeclang-sys
documentation for additional info). - Install FFmpeg (complete with headers) through any means, e.g. downloading a pre-built "full_build-shared" version from https://ffmpeg.org/download.html. Set
FFMPEG_DIR
to the directory containinginclude
andlib
. -
cargo build
. - Add FFmpeg's
bin
path toPATH
You can find an example in https://github.com/zmwangx/rust-ffmpeg/blob/master/.github/workflows/build.yml.
It works with GNU toolchain(haven't checked with MSVC), so you should:
-
Install MSYS2
-
In
.cargo/config
add[target.x86_64-pc-windows-gnu] linker = "C:\\msys64\\mingw64\\bin\\gcc.exe"
-
Install these packages:
pacman -S mingw-w64-x86_64-toolchain mingw-w64-x86_64-ffmpeg mingw-w64-x86_64-clang
-
Add
C:\msys64\mingw64\bin
to yourPATH
environment variable
To build against an FFmpeg with rpi-specific patches (tell: rpi
can be found in ffmpeg -hwaccels
), the rpi
feature needs to be enabled.