Having realised how simple it is to compile stuff on my Synology NAS I decided to finally get something built on Windows using free tools. It’s not really much different, but I had to do a lot of searching to finally gather all the necessary configure parameters.
First we need to set up the build environment. MinGW stands for ‘Minimalist GNU for Windows’. Download the MinGW-get installer, which will install everything you’ll need including MSYS which is a Unix shell complete with all the essential binaries. Run the MinGW-get installer and select Download latest repository catalogs.
In the options add the C++ compiler (needed for FAAC) and select MSYS Basic System and MinGW Developer Toolkit.
Now download the source .tar.gz files of:
- FFmpeg snapshot
- NASM (assembler used to build parts of LAME)
- yasm (assembler used to build parts of FFmpeg)
Launch MinGW Shell from the Start Menu.
Copy those downloaded files to C:\MinGW\msys\1.0\home\yourusername
For each one run:
tar xvfz packagename.tar.gz
Then in order, cd into each extracted directory and…
For NASM and yasm:
./configure make make install
For FAAC (we need to disable the mp4v2 option to avoid a nasty compiler error – took me a long time to discover):
./bootstrap CC='gcc -mno-cygwin' ./configure --prefix=/mingw --exec-prefix=/mingw --enable-static --disable-shared --with-mp4v2=no make make install
./configure --prefix=/mingw --exec-prefix=/mingw --enable-static --disable-shared --disable-decoder --enable-nasm make make install
./configure --enable-static --disable-shared --disable-ffplay --disable-ffserver --enable-memalign-hack --enable-libmp3lame --enable-nonfree --enable-libfaac --arch=x86 --enable-runtime-cpudetect --enable-w32threads make make install
The compiled ffmpeg.exe will be in C:\MinGW\msys\1.0\local\bin
Update – I tried to set this up on my work PC which runs 64 bit Windows 7 and I discovered that it’s a world of pain, so I’ll have to amend this post once I solve it.