Compile FFmpeg with VapourSynth Support
Compiling FFmpeg with VapourSynth support allows you to feed
high-performance Python-based video processing scripts directly into
FFmpeg for encoding without intermediate raw video files. This guide
walks you through the essential prerequisites, dependency management,
configuration flags, and build commands required to compile an FFmpeg
binary capable of reading and processing VapourSynth scripts
(.vpy).
Step 1: Install Build Tools and Dependencies
On a Debian or Ubuntu-based system, update your package repositories and install the foundational development tools:
sudo apt update
sudo apt install -y build-essential yasm nasm pkg-config gitStep 2: Install VapourSynth and Headers
FFmpeg requires the VapourSynth development headers and
pkg-config files to compile the demuxer correctly.
If using a package manager:
sudo apt install -y vapoursynth-dev libvapoursynth-script0Verify that pkg-config can locate your VapourSynth
installation:
pkg-config --modversion vapoursynth
pkg-config --modversion vapoursynth-scriptIf these commands do not return a version number, set your
PKG_CONFIG_PATH environment variable to the directory
containing vapoursynth.pc (commonly
/usr/local/lib/pkgconfig or
/usr/lib/pkgconfig):
export PKG_CONFIG_PATH="/usr/local/lib/pkgconfig:$PKG_CONFIG_PATH"Step 3: Clone the FFmpeg Source Code
Download the latest stable release or clone the current Git repository:
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
cd ffmpegStep 4: Configure the Build
Run the ./configure script with the
--enable-vapoursynth flag. Include other standard encoders
(such as libx264 or libx265) if needed:
./configure \
--enable-vapoursynth \
--enable-gpl \
--enable-libx264 \
--enable-nonfreeIf the configuration script finishes without error, VapourSynth
support is verified. If it fails, check ffbuild/config.log
to ensure the VapourSynth libraries and headers are in your system's
library paths.
Step 5: Compile and Install
Compile the source code using multiple cores, then install the binary:
make -j$(nproc)
sudo make installStep 6: Verify the Installation
Ensure the newly compiled binary includes VapourSynth support:
ffmpeg -versionLook for --enable-vapoursynth in the configuration
banner. You can also verify that the VapourSynth demuxer is active:
ffmpeg -demuxers | grep -i vapoursynthTo encode directly from a VapourSynth script, run:
ffmpeg -i input.vpy -c:v libx264 -crf 18 output.mp4