Compile FFmpeg with QuickSync on Windows
This article provides a direct, step-by-step guide on how to compile FFmpeg with Intel QuickSync Video (QSV) support on Windows. By enabling QSV, you can leverage your Intel processor’s integrated GPU for hardware-accelerated video encoding and decoding. This guide covers setting up the MSYS2 environment, installing the required Intel Media SDK dependencies, and running the compilation commands to generate a custom FFmpeg binary.
Step 1: Install MSYS2
To compile FFmpeg on Windows, you need a Unix-like environment. MSYS2 provides this along with the MinGW-w64 toolchain.
- Download and run the MSYS2 installer from the official MSYS2 website.
- Follow the installation wizard instructions.
- Once installed, open the MSYS2 MinGW 64-bit terminal from your Start Menu.
Step 2: Update MSYS2 and Install Dependencies
In the MSYS2 MinGW 64-bit terminal, run the following command to update the package database and core system packages:
pacman -SyuIf the terminal closes, reopen MSYS2 MinGW 64-bit and run the update command again:
pacman -SuNext, install the required build tools, compilers, and the Intel
QuickSync dependency (libmfx):
pacman -S mingw-w64-x86_64-toolchain mingw-w64-x86_64-yasm mingw-w64-x86_64-nasm mingw-w64-x86_64-libmfx git make diffutils pkg-configWhen prompted to select packages from the toolchain group, press
Enter to install all of them.
Step 3: Clone the FFmpeg Source Code
Clone the official FFmpeg git repository and navigate into the directory:
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg-qsv
cd ffmpeg-qsvStep 4: Configure the Build
Configure the FFmpeg build to enable the GPL license, non-free
libraries, and Intel’s libmfx (QuickSync). Run the
following configure script:
./configure \
--arch=x86_64 \
--target-os=mingw32 \
--enable-gpl \
--enable-nonfree \
--enable-libmfx \
--extra-libs=-lpsapiNote: The --enable-libmfx flag is what enables Intel
QuickSync support.
Step 5: Compile FFmpeg
Compile the source code using your processor’s available cores to
speed up the process. Replace $(nproc) with the number of
CPU cores you want to allocate if you wish to limit it:
make -j$(nproc)The compilation process may take several minutes to complete.
Step 6: Verify QuickSync Support
Once compilation finishes, verify that the compiled binary has successfully integrated Intel QuickSync. Run the following command:
./ffmpeg.exe -encoders | grep qsvIf the compilation was successful, you will see a list of QSV
encoders, such as h264_qsv, hevc_qsv, and
mjpeg_qsv, confirming that your custom FFmpeg build is
ready for hardware-accelerated encoding.