To compile FFmpeg using the provided ./configure options, you're essentially cross-compiling FFmpeg for Windows (x86_64) on a Linux or macOS host, using the MinGW-w64 toolchain. Below is a step-by-step guide to help you build FFmpeg with those options.
✅ Prerequisites
Make sure you have installed:
mingw-w64 (for Windows cross-compilation)
yasm or nasm (required by some codecs)
- Basic build tools (
make, gcc, g++, etc.)
On Debian/Ubuntu:
sudo apt-get update
sudo apt-get install mingw-w64 yasm nasm make gcc g++ git
On Fedora:
sudo dnf install mingw64-gcc mingw64-gcc-c++ yasm nasm make git
📁 Directory Setup
Ensure that the following directories exist:
mkdir -p "$HOME/ffmpeg_build" "$HOME/bin"
📦 Get FFmpeg Source
If you haven’t already cloned the FFmpeg source:
git clone https://git.ffmpeg.org/ffmpeg.git
cd ffmpeg
🛠 Configure FFmpeg
Now run the ./configure command as specified:
./configure \
--prefix="$HOME/ffmpeg_build" \
--target-os=mingw32 \
--arch=x86_64 \
--cross-prefix=x86_64-w64-mingw32- \
--enable-shared \
--extra-cflags="-I$HOME/ffmpeg_build/include" \
--extra-ldflags="-L$HOME/ffmpeg_build/lib" \
--ld="g++" \
--bindir="$HOME/bin"
Explanation of Key Options:
--target-os=mingw32: Cross-compiling for Windows.
--arch=x86_64: Target architecture is x86_64.
--cross-prefix=x86_64-w64-mingw32-: Prefix for MinGW-w64 tools.
--enable-shared: Build shared libraries (DLLs).
--extra-cflags and --extra-ldflags: Include paths for dependencies.
--ld="g++": Use g++ as the linker (useful if linking C++ code or STL).
--bindir: Install binaries in your $HOME/bin.
🔨 Compile and Install
After configuring:
make -j$(nproc)
make install