Skip to content

Instantly share code, notes, and snippets.

@DevStefIt
Last active February 8, 2025 17:08
Show Gist options
  • Save DevStefIt/d66d22ebc5ec2dae215a1823b3a1da3e to your computer and use it in GitHub Desktop.
Save DevStefIt/d66d22ebc5ec2dae215a1823b3a1da3e to your computer and use it in GitHub Desktop.
Statically compiling FFmpeg on Windows with MSVC
# Make sure you opened the x64 Native Tools Command Prompt for VS 2022 and then opened MSYS2 shell command
echo Compiling ffmpeg...
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
cd ../build
mkdir ffmpeg
cd ffmpeg
CC=cl \
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:../../installed/x264/lib/pkgconfig:../../installed/x265/lib/pkgconfig:../../installed/SDL/lib/pkgconfig" \
../../sources/ffmpeg/configure \
--prefix=../../installed/ffmpeg \
--toolchain=msvc --target-os=win64 --arch=x86_64 \
--disable-x86asm --disable-asm \
--disable-shared --enable-static \
--enable-libx264 --enable-libx265 --enable-libvpx --enable-sdl2 --enable-ffplay \
--disable-protocol=rtmp --disable-protocol=rtmps --disable-protocol=rtmpt --disable-protocol=rtmpts \
--disable-doc \
--enable-gpl --enable-version3 \
--enable-debug \
--disable-optimizations --optflags="-Od -Zi" \
--extra-cflags="-I../../installed/libvpx/include -MTd" \
--extra-cxxflags="-I../../installed/libvpx/include -MTd" \
--extra-ldflags="-LIBPATH:../../installed/libvpx/lib/x64"
make
make install
# Make sure you opened the x64 Native Tools Command Prompt for VS 2022 and then opened MSYS2 shell command
echo Compiling ffmpeg...
git clone https://git.ffmpeg.org/ffmpeg.git ffmpeg
cd ../build
mkdir ffmpeg
cd ffmpeg
CC=cl \
PKG_CONFIG_PATH="$PKG_CONFIG_PATH:../../installed/x264/lib/pkgconfig:../../installed/x265/lib/pkgconfig:../../installed/SDL/lib/pkgconfig" \
../../sources/ffmpeg/configure \
--prefix=../../installed/ffmpeg \
--toolchain=msvc --target-os=win64 --arch=x86_64 \
--disable-shared --enable-static \
--enable-libx264 --enable-libx265 --enable-libvpx --enable-sdl2 --enable-ffplay \
--disable-protocol=rtmp --disable-protocol=rtmps --disable-protocol=rtmpt --disable-protocol=rtmpts \
--disable-doc \
--enable-gpl --enable-version3 \
--extra-cflags="-I../../installed/libvpx/include -MT" \
--extra-cxxflags="-I../../installed/libvpx/include -MT" \
--extra-ldflags="-LIBPATH:../../installed/libvpx/lib/x64"
make
make install
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment