I used to compile ffmpeg on a linux machine with MinGW, but now I'm able to compile on a windows machine, in my case Windows 10.

NOTE: For me it only worked for ffmpeg versions >= 3.0 and I tested using VS 2013 and 2015

Few steps but very important:

Download and install (except YASM):

  • Visual Studio 2013 or 2015
  • YASM
  • MSYS2

Steps:

  1. Install MSYS2 to a fixed folder (eg.: C:\Dev\msys64)
  2. Run msys2.exe
  3. Execute command "pacman -S make gcc diffutils" and press "Y" to install
  4. Close msys2
  5. Rename C:\Dev\msys64\usr\bin\link.exe to some other name (eg.: msys2_link.exe)
  6. Copy and rename "yasm--win64.exe" to "C:\Dev\yasm.exe"
  7. Add "C:\Dev" to environment variables PATH
  8. Run VS2013/2015 x86 (for x86) or x64 for (x64) Command Prompt
  9. Execute "C:\Dev\msys64\msys2_shell.cmd -msys -use-full-path"
  10. On the msys2 window execute "which cl" and you should see the path of your VS
  11. Execute "which link" and you should also see the path of your VS
  12. Go to the ffmpeg source path (eg.: "cd /c/ffmpeg3.3")
  13. Run ./configure and make

I use this configuration:

./configure \
    --toolchain=msvc \
    --arch=x86_64 \
    --enable-yasm \
    --enable-asm\
    --enable-shared \
    --enable-w32threads \
    --disable-programs \
    --disable-ffserver \
    --disable-doc \
    --disable-static \
    --prefix=/c/ffmpeg3.3/DLLS

NOTE2: If you used the last line --prefix=/c/ffmpeg3.3/DLLS, as a final step, run make install and the binaries will be copied to that path

Hope it helped.

Best of luck

Answer from tweellt on Stack Overflow
Top answer
1 of 4
13

I used to compile ffmpeg on a linux machine with MinGW, but now I'm able to compile on a windows machine, in my case Windows 10.

NOTE: For me it only worked for ffmpeg versions >= 3.0 and I tested using VS 2013 and 2015

Few steps but very important:

Download and install (except YASM):

  • Visual Studio 2013 or 2015
  • YASM
  • MSYS2

Steps:

  1. Install MSYS2 to a fixed folder (eg.: C:\Dev\msys64)
  2. Run msys2.exe
  3. Execute command "pacman -S make gcc diffutils" and press "Y" to install
  4. Close msys2
  5. Rename C:\Dev\msys64\usr\bin\link.exe to some other name (eg.: msys2_link.exe)
  6. Copy and rename "yasm--win64.exe" to "C:\Dev\yasm.exe"
  7. Add "C:\Dev" to environment variables PATH
  8. Run VS2013/2015 x86 (for x86) or x64 for (x64) Command Prompt
  9. Execute "C:\Dev\msys64\msys2_shell.cmd -msys -use-full-path"
  10. On the msys2 window execute "which cl" and you should see the path of your VS
  11. Execute "which link" and you should also see the path of your VS
  12. Go to the ffmpeg source path (eg.: "cd /c/ffmpeg3.3")
  13. Run ./configure and make

I use this configuration:

./configure \
    --toolchain=msvc \
    --arch=x86_64 \
    --enable-yasm \
    --enable-asm\
    --enable-shared \
    --enable-w32threads \
    --disable-programs \
    --disable-ffserver \
    --disable-doc \
    --disable-static \
    --prefix=/c/ffmpeg3.3/DLLS

NOTE2: If you used the last line --prefix=/c/ffmpeg3.3/DLLS, as a final step, run make install and the binaries will be copied to that path

Hope it helped.

Best of luck

2 of 4
4

Assuming with x64 you mean the standard 64-bit version, yes it is possible. See the fate page for all tested builds of FFmpeg, there's various 32- and 64-bit versions of Visual Studio in that list, including VS2013 and VS2015 64-bit. Search for "Microsoft (R) C/C++ Optimizing Compiler Version 18.00.40629 for x64" (or "19.00.24215.1") or "VS2013"/"VS2015", all the way at the bottom. For exact build options, see here for 2013 or here for 2015. The important part is to open a Windows shell with the 64-bit commandline build tools in your $PATH and open a msys shell from there, and then run configure using the --arch=x86_64 --target-os=win64 --toolchain=msvc options. For more detail, see the MSVC compilation wiki page.

🌐
Qt
doc.qt.io › qt-6 › qtmultimedia-building-ffmpeg-windows.html
Building FFmpeg from source on Windows | Qt Multimedia | Qt 6.11.0
Build the development libraries. ... Download from the FFmpeg download page. Clone from git. For example, this command clones the version 7.1.3 of the FFmpeg sources to C:\FFmpeg\ffmpeg.
Discussions

Can anyone tell me how you compile ffmpeg from a GitHub version, preferably into a static build?
ffmpeg has the option to build in quite a few dependencies / external libraries, so it's rather complex. Last time I did it I used https://github.com/rdp/ffmpeg-windows-build-helpers but there are other build scripts on GitHub that also seem like they'd be good More on reddit.com
🌐 r/ffmpeg
19
4
September 26, 2022
Compile FFMPEG on WSL 2 Linux and link it to Windows
I compile FFMPEG from source built with CUDA support in Linux. Now I want to link the compiled FFMPEG in WSL 2 Ubuntu to Windows (build 19640 Insider) so that Windows can detect FFMPEG CUDA. Is it possible to do that? More on learn.microsoft.com
🌐 learn.microsoft.com
2
0
June 5, 2020
How do I set up and use FFmpeg in Windows? - Video Production Stack Exchange
In this case, it is saying create ... input source. ... -f mp3 - Force to MP3 conversion. Without this command, FFmpeg attempts to interpret what you want based on the extension you use in the output file name. ... As you can probably guess, this short command makes an MP3 audio file from an MP4 file. To run this command, assuming you have an MP4 file to try this on, follow these steps: Hit the Windows key ... More on video.stackexchange.com
🌐 video.stackexchange.com
New source of FFmpeg builds for Windows users
The builds include git versions of both libaom and SVT-AV1. Probably a good choice if you want to stay up-to-date but don't want to build yourself. More on reddit.com
🌐 r/AV1
3
26
September 15, 2020
🌐
CODEX FFMPEG
gyan.dev › ffmpeg › builds
Builds - CODEX FFMPEG @ gyan.dev
Full build requires at least Windows 10. If you're downloading a package to support features in a program like Krita or Blender, the release essentials build is sufficient. Read more in the section about these builds. The following builds are also available through package managers: release essentials: choco install ffmpeg scoop install ffmpeg-essentials winget install "FFmpeg (Essentials Build)" release full: choco install ffmpeg-full scoop install ffmpeg winget install ffmpeg release full shared: scoop install ffmpeg-shared winget install "FFmpeg (Shared)" git master: scoop install ffmpeg-gyan-nightly
🌐
Reddit
reddit.com › r/ffmpeg › can anyone tell me how you compile ffmpeg from a github version, preferably into a static build?
r/ffmpeg on Reddit: Can anyone tell me how you compile ffmpeg from a GitHub version, preferably into a static build?
September 26, 2022 - ffmpeg has the option to build in quite a few dependencies / external libraries, so it's rather complex. Last time I did it I used https://github.com/rdp/ffmpeg-windows-build-helpers but there are other build scripts on GitHub that also seem like they'd be good
🌐
GitHub
github.com › FFmpeg › FFmpeg › blob › master › INSTALL.md
FFmpeg/INSTALL.md at master · FFmpeg/FFmpeg
configure can be launched from a directory different from the FFmpeg sources to build the objects out of tree. To do this, use an absolute path when launching configure, e.g.
Author   FFmpeg
🌐
Mux
mux.com › articles › how-to-get-started-in-ffmpeg
How to get started in ffmpeg | Mux
FFmpeg is an open-source multimedia framework for recording, converting, streaming, and playing multimedia files. It supports a vast range of formats and codecs. It’s used in many applications all across the Internet today. It's main uses are to manipulate video files in a way to prepare them for viewing interactions in a plethora of web devices as well as some broadcast applications. ... Download the latest static build from FFmpeg’s website.
Top answer
1 of 2
16

This is easier said than done, and has taken me over a month to figure out how to do without any issues, but I've spent enough time on it that I decided I'd document the process well enough to be completed virtually seamlessly by anyone following me.

Unfortunately, Cygwin's default toolchain (i.e. the gcc-core package included with the Cygwin installer) is inherently broken for cross-compiling purposes, and there doesn't seem to be any intent from the Cygwin maintainers to fix this, so currently, the only way to compile software for Windows with Cygwin is to set up a MinGW-w64 toolchain under it. Thankfully, this is as easy as installing a few packages. After this, we'll be compiling the remaining packages, before using a combination of both to compile FFmpeg itself.


Using this Guide

Following this guide in its entirety will build a static FFmpeg installation with external libraries such as fdk-aac, libopus, x265 and the SOX resampler. I may consider adding instructions for compiling specific external libraries to the guide if I get enough requests to do so for a particular library.

The dependencies used by this guide - made up of the MinGW-w64 cross-compile toolchain itself, all packages installed by apt-cyg and all packages compiled from source - will consume up to 2.8GB of disk space, although the guide also includes commands to clean up everything but the FFmpeg installation once done. The installation itself, made up of the binaries and documentation, occupies just over 200MB of disk space.

This guide will create a folder in your Home directory called ffmpeg_sources, where it will download and compile all of the packages being built from source. FFmpeg will be installed to /usr/local, where the FHS standard recommends that software compiled by the user is installed to. This location also has the secondary advantage of being on the system PATH by default in Cygwin, and so doesn't require the $PATH environment variable to be updated.


Install package manager dependencies

To begin with, download the latest version of the Cygwin installer to install the wget, tar, gawk and git packages. The good news is that these packages are dependencies for a tool that can prevent you from ever needing to use the Cygwin installer again.


Install the apt-cyg package manager

Next, install kou1okada's fork of the apt-cyg package manager. If you don't currently use a package manager for Cygwin, this step will not only make the rest of the guide a breeze, but will also make your Cygwin experience rival that of any Linux distribution.

Even if you already use a package manager for Cygwin, such as a different fork of the original apt-cyg, I highly recommend you replace it with this one, which is a much more fully-fledged piece of software compared to the original, as well as the only package manager for Cygwin that is currently in active development.

To install kou1okada's apt-cyg:

mkdir -p /usr/local/src &&
cd /usr/local/src &&
git clone https://github.com/kou1okada/apt-cyg.git &&
ln -s "$(realpath apt-cyg/apt-cyg)" /usr/local/bin/

Install build tools and set up the MinGW-w64 cross-compiler

apt-cyg install \
autoconf \
automake \
binutils \
cmake \
doxygen \
git \
libtool \
make \
mercurial \
mingw64-x86_64-SDL2 \
mingw64-x86_64-binutils \
mingw64-x86_64-fribidi \
mingw64-x86_64-gcc-core \
mingw64-x86_64-gcc-g++ \
mingw64-x86_64-headers \
mingw64-x86_64-libtheora \
mingw64-x86_64-libvpx \
mingw64-x86_64-runtime \
mingw64-x86_64-win-iconv \
mingw64-x86_64-windows-default-manifest \
mingw64-x86_64-zlib \
nasm \
pkg-config \
subversion \
texinfo \
yasm

Compile the dependencies

Each section below compiles an external library that will allow you to compile FFmpeg with support for that library enabled. Copy and paste the whole of each command into your shell.

If you decide you don't require your build of FFmpeg to support a given library, skip its section and remove the corresponding --enable-package line when compiling FFmpeg in the final stage of this guide.

Create a directory at the root of your Cygwin installation with the following:

rm -rf /ffmpeg_sources &&
mkdir -p /ffmpeg_sources

This is the directory we'll be downloading our source code to, and compiling it from.

libmp3lame

To compile the LAME audio codec for MP3:

cd /ffmpeg_sources && rm -rf lame-svn &&
svn checkout https://svn.code.sf.net/p/lame/svn/trunk/lame lame-svn &&
cd lame-svn &&
./configure --host=x86_64-w64-mingw32 --prefix="/usr/x86_64-w64-mingw32/sys-root/mingw" \
--enable-static --disable-shared &&
make -j$(nproc) &&
make install 

libx264

To compile the x264 video codec:

cd /ffmpeg_sources && rm -rf x264 && 
git clone --depth 1 https://code.videolan.org/videolan/x264.git && 
cd x264 &&
./configure --cross-prefix=x86_64-w64-mingw32- --host=x86_64-w64-mingw32 \
--prefix="/usr/x86_64-w64-mingw32/sys-root/mingw" --enable-static &&
make -j$(nproc) &&
make install 

libx265

To compile the x265 video codec:

cd /ffmpeg_sources && rm -rf x265 && 
hg clone https://bitbucket.org/multicoreware/x265 &&
cd x265/build/linux &&
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/usr/x86_64-w64-mingw32/sys-root/mingw" \
-DENABLE_SHARED=OFF -DCMAKE_EXE_LINKER_FLAGS="-static" ../../source \
-DCMAKE_TOOLCHAIN_FILE="/ffmpeg_sources/x265/build/msys/toolchain-x86_64-w64-mingw32.cmake" &&
make -j$(nproc) &&
make install

libogg/libvorbis

The Ogg format is a dependency for the Vorbis audio codec, so will need to be compiled before it:

cd /ffmpeg_sources && rm -rf ogg &&
git clone --depth 1 https://gitlab.xiph.org/xiph/ogg.git &&
cd ogg && ./autogen.sh &&
./configure --host=x86_64-w64-mingw32 --prefix="/usr/x86_64-w64-mingw32/sys-root/mingw" \
--enable-static --disable-shared &&
make -j$(nproc) &&
make install

Then compile Vorbis as normal:

cd /ffmpeg_sources && rm -rf vorbis && 
git clone --depth 1 https://gitlab.xiph.org/xiph/vorbis.git &&
cd vorbis && ./autogen.sh &&
./configure --host=x86_64-w64-mingw32 --prefix="/usr/x86_64-w64-mingw32/sys-root/mingw" \
--enable-static --disable-shared &&
make -j$(nproc) &&
make install

libaom

To compile the AV1 video encoder:

cd /ffmpeg_sources && rm -rf aom && 
git clone --depth 1 https://aomedia.googlesource.com/aom && 
mkdir -p /ffmpeg_sources/aom/build && cd /ffmpeg_sources/aom/build && 
cmake -G "Unix Makefiles" -DCMAKE_INSTALL_PREFIX="/usr/x86_64-w64-mingw32/sys-root/mingw" \
-DCMAKE_EXE_LINKER_FLAGS="-static" .. \
-DCMAKE_TOOLCHAIN_FILE="/ffmpeg_sources/aom/build/cmake/toolchains/x86_64-mingw-gcc.cmake" && 
make -j$(nproc) && 
make install

libopus

To compile the Opus audio encoder:

cd /ffmpeg_sources && rm -rf opus && 
git clone --depth 1 https://github.com/xiph/opus.git &&
cd opus && ./autogen.sh &&
./configure CFLAGS="-I/usr/local/llsp" --host=x86_64-w64-mingw32 --prefix="/usr/x86_64-w64-mingw32/sys-root/mingw" \
--enable-static --disable-shared &&
make -j$(nproc) &&
make install

libfdk-aac

To compile the Fraunhofer FDK encoder for AAC:

cd /ffmpeg_sources && rm -rf fdk-aac && 
git clone --depth 1 https://github.com/mstorsjo/fdk-aac &&
cd fdk-aac && autoreconf -fiv &&
./configure --host=x86_64-w64-mingw32 --prefix="/usr/x86_64-w64-mingw32/sys-root/mingw" \
--enable-static --disable-shared &&
make -j$(nproc) &&
make install 

libsoxr

To compile the SOX resampler library, you'll first need to create a CMAKE toolchain file for the MinGW-w64 toolchain as the project doesn't include one by default.

Create a new file in the Cygwin root directory, and call it toolchain-x86_64-mingw32.cmake (make sure Windows is showing extensions, and that the extension is .cmake).

Copy and paste the following into the file:

SET(CMAKE_SYSTEM_NAME Windows)
SET(CMAKE_C_COMPILER /usr/bin/x86_64-w64-mingw32-gcc)
SET(CMAKE_CXX_COMPILER /usr/bin/x86_64-w64-mingw32-g++)
SET(CMAKE_RC_COMPILER /usr/bin/x86_64-w64-mingw32-windres)
SET(CMAKE_Fortran_COMPILER /usr/bin/x86_64-w64-mingw32-gfortran)
SET(CMAKE_AR:FILEPATH /usr/bin/x86_64-w64-mingw32-ar)
SET(CMAKE_RANLIB:FILEPATH /usr/bin/x86_64-w64-mingw32-ranlib)
SET(CMAKE_FIND_ROOT_PATH /usr/x86_64-w64-mingw32)
SET(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
SET(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
SET(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
SET(QT_BINARY_DIR /usr/x86_64-w64-mingw32/bin /usr/bin)
SET(Boost_COMPILER -gcc47)

Now you can compile the SOX resampler as normal:

cd /ffmpeg_sources && rm -rf soxr &&  
git clone --depth 1 https://git.code.sf.net/p/soxr/code soxr &&
mkdir -p soxr/build && cd soxr/build &&
cmake -Wno-dev -DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="/usr/x86_64-w64-mingw32/sys-root/mingw" \
-DBUILD_SHARED_LIBS=OFF .. -DCMAKE_TOOLCHAIN_FILE="/toolchain-x86_64-mingw32.cmake" &&
make -j$(nproc) &&
make install

Compile the FFmpeg binary

The only thing that's left to is compile FFmpeg itself, using the libraries downloaded or compiled above:

cd /ffmpeg_sources && rm -rf ffmpeg &&
wget -O ffmpeg-snapshot.tar.bz2 https://ffmpeg.org/releases/ffmpeg-snapshot.tar.bz2 &&
tar xvf ffmpeg-snapshot.tar.bz2 && rm -f ffmpeg-snapshot.tar.bz2 && cd ffmpeg &&
CFLAGS=-I/usr/x86_64-w64-mingw32/sys-root/mingw/include &&
LDFLAGS=-L/usr/x86_64-w64-mingw32/sys-root/mingw/lib &&
export PKG_CONFIG_PATH= &&
export PKG_CONFIG_LIBDIR=/usr/x86_64-w64-mingw32/sys-root/mingw/lib/pkgconfig &&
./configure \
--arch=x86_64 \
--target-os=mingw32 \
--cross-prefix=x86_64-w64-mingw32- \
--prefix=/usr/local \
--pkg-config=pkg-config \
--pkg-config-flags=--static \
--extra-cflags=-static \
--extra-ldflags=-static \
--extra-libs="-lm -lz -fopenmp" \
--enable-static \
--disable-shared \
--enable-nonfree \
--enable-gpl \
--enable-avisynth \
--enable-libaom \
--enable-libfdk-aac \
--enable-libfribidi \
--enable-libmp3lame \
--enable-libopus \
--enable-libsoxr \
--enable-libvorbis \
--enable-libvpx \
--enable-libx264 \
--enable-libx265 &&
make -j$(nproc) &&
make install

Remember to remove --enable-\*package\* lines for each package in the list above that you didn't download or compile a library for.

Compiling FFmpeg will take much longer than compilation of the external libraries, but once it's done, you should have a fully working binary enabled with all of the libraries you compiled it with. To run it, simply run ffmpeg in the Cygwin terminal.


Clean up/uninstall

By this point in the guide, you will have taken up around 2.8 GB of disk space with downloading, installing and compiling. The majority of this is now redundant, and should be cleaned up. More than 2.6 GB of it can be safely purged, which brings the total footprint of our FFmpeg installation down to as little as 200MB.

Post-install clean up

Running the following will free up more than 2.3GB of disk space:

apt-cyg remove \
cmake \
doxygen \
git \
mercurial \
subversion \
texinfo \
yasm &&
rm -rf /ffmpeg_sources &&
rm -rf /usr/local/lib/{libav*,libpost*,libsw*} &&
rm -rf /usr/local/lib/pkgconfig/{libav*,libpost*,libsw*} &&
rm -rf /usr/local/include/{libav*,libpost*,libsw*} &&
rm -rf /toolchain-x86_64-mingw32.cmake

As well as removing the ffmpeg_sources directory and unneeded static libraries, this will also remove any packages installed earlier that are no longer needed, except for those that are commonly needed for building tools on Cygwin/Linux.

Remove the cross-compiler

If you no longer intend to compile any other programs using the MinGW-w64 cross-compiling toolchain built earlier in this guide, you can safely uninstall it, as well as all the remaining packages installed earlier:

apt-cyg remove \
autotools \
autoconf \
automake \
gcc-core \
gcc-g++ \
pkg-config \
libtool \
make \
nasm \
mingw64-x86_64-SDL2 \
mingw64-x86_64-binutils \
mingw64-x86_64-fribidi \
mingw64-x86_64-gcc-core \
mingw64-x86_64-gcc-g++ \
mingw64-x86_64-headers \
mingw64-x86_64-libtheora \
mingw64-x86_64-libvpx \
mingw64-x86_64-runtime \
mingw64-x86_64-win-iconv \
mingw64-x86_64-windows-default-manifest \
mingw64-x86_64-zlib &&
rm -rf /usr/x86_64-w64-mingw32

This will free up an additional ~450 MB of space.

Uninstalling FFmpeg

If you ever need to reverse all of the steps in this guide and purge the FFmpeg binaries from your system, simply run the following:

apt-cyg remove \
autotools \ 
autoconf \
automake \
binutils \
cmake \
doxygen \
gcc-core \
gcc-g++ \
git \
libtool \
make \
mercurial \
mingw64-x86_64-SDL2 \
mingw64-x86_64-binutils \
mingw64-x86_64-fribidi \
mingw64-x86_64-gcc-core \
mingw64-x86_64-gcc-g++ \
mingw64-x86_64-headers \
mingw64-x86_64-libtheora \
mingw64-x86_64-libvpx \
mingw64-x86_64-runtime \
mingw64-x86_64-win-iconv \
mingw64-x86_64-windows-default-manifest \
mingw64-x86_64-zlib \
nasm \
pkg-config \
subversion \
texinfo \
yasm &&
rm -rf /ffmpeg_sources &&
rm -rf /usr/local/bin{ffmpeg,ffprobe,ffplay} &&
rm -rf /usr/local/lib/{libav*,libpost*,libsw*} &&
rm -rf /usr/local/lib/pkgconfig/{libav*,libpost*,libsw*} &&
rm -rf /usr/local/include/{libav*,libpost*,libsw*} &&
rm -rf /usr/local/share/doc/ffmpeg &&
rm -rf /usr/local/share/ffmpeg &&
rm -rf /usr/local/share/man/man1/ff* &&
rm -rf /usr/local/share/man/man3/{libav*,libpost*,libsw*} &&
rm -rf /usr/x86_64-w64-mingw32/ &&
rm -rf /toolchain-x86_64-mingw32.cmake 

This will remove everything installed during the process of this guide, and revert your system to exactly how it was before starting it.

2 of 2
3

Instead of doing everything manually, you can use the media-autobuild_suite for Windows, which builds FFmpeg with almost all of its dependencies:

This Windows Batchscript setups a MinGW/GCC compiler environment for building ffmpeg and other media tools under Windows. After building the environment it retrieves and compiles all tools. All tools get static compiled, no external .dlls needed (with some optional exceptions)

The script gets continuously updated, and for most users, it will be the preferred way to get FFmpeg compiled under Windows.

Find elsewhere
🌐
Super User
superuser.com › questions › 1662924 › compiling-ffmpeg-for-windows
Compiling FFMpeg for windows - Super User
July 16, 2021 - Install vcpkg - https://vcpkg.io/en/getting-started.html I did this in a separate HDD. Step 1: Clone the vcpkg repo. git clone https://github.com/Microsoft/vcpkg.git Step 2: Run the bootstrap script to build vcpkg.
🌐
Dektec
dektec.com › products › SDK › ffmpeg › windows
FFmpeg Build Guide (Windows)
Open a 64-bit Visual Studio 2022 prompt or manually execute 'vcvars64.bat' in a CMD window. ... Download the DekTec-extended FFmpeg sources and unpack them to '/c/ffmpeg_sources'.
🌐
GitHub
github.com › rdp › ffmpeg-windows-build-helpers
GitHub - rdp/ffmpeg-windows-build-helpers: Helper script for cross compiling some media tools for windows, like customizable ffmpeg.exe (with or without non-free components, etc), and some other bonuses like mplayer, mp4box, mxf, etc. · GitHub
This helper script lets you cross compile a windows-based 32 or 64-bit version of ffmpeg.exe/mplayer/mp4box.exe, etc, including their dependencies and libraries that they use. Note that I do offer custom builds, price negotiable.
Starred by 1.2K users
Forked by 424 users
Languages   Shell 99.1% | Dockerfile 0.9%
🌐
SourceForge
sourceforge.net › projects › ffmpeg-windows-builds
FFmpeg Windows Builds download | SourceForge.net
April 27, 2021 - Download FFmpeg Windows Builds for free. FFmpeg Nightly and Release binaries for Windows. FFmpeg is a "complete, cross-platform solution to record, convert and stream audio and video". We provide easy to use binaries for Windows.
🌐
Roxlu
roxlu.com › 2019 › 062 › compiling-ffmpeg-with-x264-on-windows-10-using-msvc
Compiling FFmpeg with X264 on Windows 10 using MSVC | ROXLU
Therefore I'm providing these ... and will build a shared library for FFmpeg with X264. Note that at the time of writing you can't link statically with X264, see the X264_API_IMPORTS define in FFmpegs source. I've tried to keep things as short as possible. Hit me up on Twitter when you have any questions. Thanks Matthias C. M. Troffaes for providing fixes that allow us to compile X264 with MSVC with MSYS2. You can download the shell script containing all the steps from this ...
🌐
FFmpeg
ffmpeg.org › platform.html
Platform Specific Information
FFmpeg can be built with MSVC 2013 or later. ... To set up a proper environment in MSYS2, you need to run msys_shell.bat from the Visual Studio or Intel Compiler command prompt. Place nasm.exe somewhere in your PATH. Next, make sure any other headers and libs you want to use, such as zlib, ...
🌐
Pracucci
pracucci.com › compile-ffmpeg-on-windows-with-visual-studio-compiler.html
Compile ffmpeg libs on Windows with Visual Studio compiler
Previous versions don’t compile with VS2015 because they expect that VS compiler has no snprintf support while it was introduced in VS2015. Download and run the installer at ​http://msys2.github.io. Follow the instructions and install it in C:\workspace\windows...
🌐
LinkedIn
linkedin.com › pulse › building-ffmpeg-windows-without-fuss-moshe-david
Building ffmpeg on Windows without fuss
December 18, 2017 - 3. From MSYS2 shell, its time to configure the build (this is based on your requirements) a basic configure invocation, would be ./configure --disable-static --enable-shared --disable-doc --arch=x86_64 --target-os=mingw64 (configuring on MSYS2 is tremendously slow, so be patient) 4. The final step - the actual building, invoke make -j[num_of_physical_coress] Roger Pack did an outstanding work while enabling womb-to-tomb ffmpeg cross compilation (even along with bootstrapping the cross compiler itself !).
Top answer
1 of 2
2

Hi. I recently faced the same issue.

You can patch the ffmpeg/config file as follows to enable WSL support (note, the patch applies to the most recent master commit, you may need to input your changes manually in the future):

diff --git a/configure b/configure

index 169f23e17f..19d8d192f1 100755

--- a/configure

+++ b/configure

@@ -4698,7 +4698,11 @@ probe_cc(){

         else

             _ident=$($_cc --version 2>/dev/null | head -n1 | tr -d '\r')

         fi

-        _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '''/including/ { sub(/^.*file: */, ""); gsub(/\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }''' > $(@:.o=.d)'

+        if [ -f /bin/wslpath ]; then

+            _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '''/including/ { sub(/^.*file: */, ""); gsub(/\/, "/"); if (!match($$0, / /)) b=substr($0,3); $$0=gensub(/(\w):(.*)/,"/mnt/\1" b,1,tolower($0)); print "$@:", $$0 }''' > $(@:.o=.d)'

+        else

+            _DEPCMD='$(DEP$(1)) $(DEP$(1)FLAGS) $($(1)DEP_FLAGS) $< 2>&1 | awk '''/including/ { sub(/^.*file: */, ""); gsub(/\/, "/"); if (!match($$0, / /)) print "$@:", $$0 }''' > $(@:.o=.d)'

+        fi

         _DEPFLAGS='$(CPPFLAGS) $(CFLAGS) -showIncludes -Zs'

         _cflags_speed="-O2"

         _cflags_size="-O1"

@@ -5570,11 +5574,15 @@ link_name=$(mktemp -u $TMPDIR/name_XXXXXXXX)

 mkdir "$link_dest"

 $ln_s "$link_dest" "$link_name"

 touch "$link_dest/test_file"

-if [ "$source_path" != "." ] && [ "$source_path" != "src" ] && ([ ! -d src ] || [ -L src ]) && [ -e "$link_name/test_file" ]; then

+if [ "$source_path" != "." ] && [ "$source_path" != "src" ] && ([ ! -d src ] || [ -L src ]) && [ -e "$link_name/test_file" ] && [ ! -e /bin/wslpath ]; then

     # create link to source path

     [ -e src ] && rm src

     $ln_s "$source_path" src

     source_link=src

+elif [ -e /bin/wslpath ]; then

+    # cl.exe does not support slash-lead paths (i.e. /mnt/c/source/code.c). Use relative path instead.

+    source_path=$(realpath --relative-to=$(pwd) "$source_path")

+    source_link=$source_path

 else

     # creating directory links doesn't work

     # fall back to using the full source path

2 of 2
0

Hi, I'm Elise, an independent advisor and I'd be happy to help with your issue.

Someone has created a script to help you accomplish this already:

https://github.com/rdp/ffmpeg-windows-build-hel...

Kind Regards,

Elise

Note: This is a non-Microsoft website. The page appears to be providing accurate, safe information. Watch out for ads on the site that may advertise products frequently classified as a PUP (Potentially Unwanted Products). Thoroughly research any product advertised on the site before you decide to download and install it.

Top answer
1 of 2
61

FFmpeg is indeed a powerful video encoder/decoder tool¹. It operates in the command line, as opposed to using a GUI. Command line is that black window you find by typing [windows+r], then cmd in the popup field and hitting enter. This is also called "command prompt". Once setup, you enter FFmpeg commands in one of these windows to use it.

Here are the basic steps to "install" and use it:

Installation

  1. Download the latest FFmpeg build, courtesy of gyan.dev.
  2. Create a folder on your computer to unpack the zip file. This folder will be your "installation" folder. I chose C:\Program Files\ffmpeg\. This is a good idea because you will treat this like a regular program. Unpack the zip file into this folder.
  3. The folder should now contain a number of other folders, including one titled bin where ffmpeg.exe is saved. We're not done yet. Double clicking that file does nothing. Remember, this is a command line program. It runs in cmd.
  4. Before you can use ffmpeg.exe in cmd you have to tell your computer where it can find it. You need to add a new system path. First, right click This PC (Windows 10) or Computer (Windows 7) then click Properties > Advanced System Settings > Advanced tab > Environment Variables.
  5. In the Environment Variables window, click the "Path" row under the "Variable" column, then click Edit
  6. The "Edit environment variable" window looks different for Windows 10 and 7. In Windows 10 click New then paste the path to the folder that you created earlier where ffmpeg.exe is saved. For this example, that is C:\Program Files\ffmpeg\bin\ In Windows 7 all the variables are listed in a single string, separated by a semicolon. Simply go the the end of the string, type a semicolon (;), then paste in the path.
  7. Click Ok on all the windows we just opened up. Just to be sure, reboot your computer before trying any commands.

FFmpeg is now "installed". The Command Prompt will now recognize FFmpeg commands and will attempt to run them. (If you are still having issues with Command Prompt not recognizing FFmpeg try running CMD as an admin. Alternatively, you can use windows powershell instead of cmd. If it still does not work double check to make sure each step was followed to completion.)

Alternative installation methods

I've not tried these myself, but they probably work, and they're easy to do. However, you can accidentally mess up important things if you're not careful.

First, if you open cmd with administrator privileges, you can run setx /m PATH "C:\ffmpeg\bin;%PATH%", and change C:\ffmpeg\bin to your path to FFmpeg. This uses cmd to do all the gui steps listed above. Easy peasy.

Second, user K7AAY reports that you can simply drop the FFmpeg executables in C:\Windows\System32 and run them from there without having to define the path variable because that path is already defined.

Updating FFmpeg

To update FFmpeg, just revisit the download page in step 1 above and download the zip file. Unpack the files and copy them over the old files in the folder you created in step 2.

Using FFmpeg

Using FFmpeg requires that you open a command prompt window, then type FFmpeg specific commands. Here is a typical FFmpeg command:

 ffmpeg -i video.mp4 -vn -ar 44100 -ac 1 -b:a 32k -f mp3 audio.mp3

This command has four parts:

  1. ffmpeg - This command tells cmd that we want to run FFmpeg commands. cmd will first look for ffmpeg.exe in one of the folders from step 6 in the Installation section. If it is found, it will attempt to run the command.
  2. -i video.mp4 - This is an input file. We are going to be doing work on this file.
  3. -vn -ar 44100 -ac 1 -b:a 32k -f mp3 - These are the "arguments". These characters are like mini commands that specify exactly what we want to do. In this case, it is saying create an mp3 file from the input source.
  • -vn - Leave out the video stream
  • -ar 44100 - Specifies audio resolution in hertz.
  • -ac 1 - Audio channels, only 1. This is effectively "make mono".
  • -b:a 32k - Audio bitrate, set to 32 kbps.
  • -f mp3 - Force to MP3 conversion. Without this command, FFmpeg attempts to interpret what you want based on the extension you use in the output file name.
  1. audio.mp3- This is the output file.

As you can probably guess, this short command makes an MP3 audio file from an MP4 file.

To run this command, assuming you have an MP4 file to try this on, follow these steps:

  1. Hit the Windows key + r.
  2. Type cmd then enter.
  3. Change the path to where the file is that you want to work on. Type cd [path]. It should look something like cd C:\Users\name\Desktop\.
  4. Now type the FFmpeg command with the name of your input file. The command will run with some feedback. When it's done, cmd will be available for more commands.

This is the basic way to use FFmpeg. The commands can get far more complicated, but that's only because the program has so much power. Using the FFmpeg documentation, you can learn all the commands and create some very powerful scripts. After that, you can save these scripts into a .bat file so that you just have to double click a file instead of type out the whole command each time. For example, this answer contains a script that will create MP3's from all the MP4's in a folder. Then we would be combining the power of FFmpeg with the power of cmd, and that's a nice place to be when you have to do professional quality video/audio encoding on mountains of files.


  1. As a point if technical accuracy, FFmpeg is itself not an encoder or decoder. FFmpeg is a multimedia framework which can process almost all common and many uncommon media formats. It has thousands of to capture, decode, encode, modify, combine, and stream media, and it can make use of dozens of external libraries to do even more. Gyan.dev provides a succinct description.
2 of 2
9

The other answer gives a very good answer that covers the default way of installing it, I'd like to propose two ohter methods that are good for noobs and pros alike:

Option 1

Chocolatey is a package manager, it's a bit like the Microsoft Store, except that it's actually useful, it's all free, and it runs on the commandline. With chocolatey, installing ffmpeg—and setting up the correct $PATH etc.—is as simple as

choco install ffmpeg

It's way quicker and far safer than searching for the right website, finding the download, unzipping it, reading the installation documentation, googling how to set it up, downloading some dependancy etc. etc.

To install Chocolatey you run a command on the commandline, obvs. The website shows you how, but it is a simple cut-n-paste affair. https://chocolatey.org/

You can then check out over 6000 free packages available with choco list <search term here>. There are even non-CLI programs so it's not just for the hardcore. It makes setting up a new install of windows super easy: I have a list of software that I always install and just get chocolatey to do it for me: choco install firefox ffmpeg conemu edgedeflector ditto rainmeter imagemagick… and so on.

As an added bonus upgrading your software is as easy as choco upgrade all

Option 2

Winget is another package manager, that is built-in to recent versions of Windows. The recipe for installing ffmpeg with winget is similar: open a terminal (can be Powershell, wsl, or even cmd if you like banging rocks together) and type

winget install ffmpeg

This will download and install the build of ffmpeg that is hosted by gyan (at the time of writing). It will also work if you don't have admin privileges, which chocolatey prefers.

🌐
Wikihow
wikihow.com › computers and electronics › operating systems › windows › how to install ffmpeg on windows: a step-by-step guide
How to Install FFmpeg on Windows: A Step-by-Step Guide
March 15, 2026 - The full text of the link is www.gyan.dev/ffmpeg/builds/ffmpeg-release-full.7z. This link downloads the latest FFmpeg files to your PC in a compressed format. The full release of FFmpeg works on Windows 10 and later. If you're using Windows 7 or Windows 8, you will need to download ffmpeg-release-essentials.7z instead.[2] X Research source...
🌐
FFmpeg
ffmpeg.org › download.html
Download FFmpeg
FFmpeg only provides source code. Below are some links that provide it already compiled and ready to go. Debian – Official packages for Stable-Backports, Testing, Unstable Debian – deb-multimedia packages for Oldstable, Stable, Testing, Unstable Ubuntu – Official packages Fedora and Red Hat Enterprise Linux packages · 64-bit static and shared builds · Windows builds from gyan.dev Windows builds by BtbN ·
🌐
PhoenixNAP
phoenixnap.com › home › kb › sysadmin › installing ffmpeg on windows
Installing FFmpeg on Windows {Step-by-Step}
September 3, 2024 - Users can run FFmpeg directly from the command line without typing in the full path to the app's folder. Visit the FFmpeg download page. The More downloading options section has FFmpeg packages and executable files for Linux, Windows, and Mac. To get the Windows version: 1. Hover over the Windows logo and click the Windows builds from gyan.dev link.