-
Notifications
You must be signed in to change notification settings - Fork 248
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
binpath toPATH, or setLIBCLANG_PATHto that (seeclang-sysdocumentation 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_DIRto the directory containingincludeandlib. -
cargo build. - Add FFmpeg's
binpath 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/configadd[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\binto yourPATHenvironment 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.