Set up the MSYS environment
Download MSYS from MinGW-builds. Extract it to a path with no spaces, to which you have write permissions. For example,
D:\msys. This already includes useful features like pkg-config, Autotools and Git.
Download a pre-built MinGW-w64 from drangon.org and extract it inside the MSYS directory. This already includes useful features like Yasm.
Start MSYS with
In MSYS, run:
echo 'export PATH=.:/local/bin:/bin:/mingw64/bin' > .profile echo 'git config --global core.autocrlf false' >> .profile source .profile
Check that it has worked with
Compile ffmpeg and libraries
These steps are similar to the Linux/BSD version of this guide.
git clone git://git.videolan.org/x264.git x264 cd x264 ./configure --host=x86_64-w64-mingw32 --enable-static --enable-shared && make && make install cd .. git clone git://github.com/mstorsjo/fdk-aac.git fdk-aac cd fdk-aac ./autogen.sh ./configure --host=x86_64-w64-mingw32 --enable-static --enable-shared && make && make install cd .. git clone git://source.ffmpeg.org/ffmpeg.git ffmpeg cd ffmpeg ./configure --enable-gpl --enable-nonfree --enable-libx264 --enable-libfdk_aac --enable-static --disable-shared --extra-cflags=-I/local/include --extra-ldflags='-L/local/lib -static' && make && make install
NOTE: configure on ffmpeg in mingw is slow. Be patient. You should also check for success after each library has compiled.
This should build ffmpeg.exe as a 64 bit static executable that can be run directly in Windows x64, with H.264 and AAC support. It does not need to be run from MSYS. In my testing, the 64 bit version is approx. 10% faster than the 32 bit version.
If you want it to use DLLs instead of creating a static executable, change
--enable-shared and remove the
-static from the ldflags in the ffmpeg configure.
You may also want to use
--enable-avisynth (64 bit port). SDL is required for ffplay.