Minimal audio-only FFmpeg build with MinGW32

Another post intended mainly for future me, I tend to lose and re-invent this kind of stuff if it's not public... :)

For projects like Picard or Chromaprint, when I'm doing a Windows build, I need a minimal version of FFmpeg that can decode audio files, but not much else. FFmpeg is a huge project, I definitely don't want to distribute all the video codecs that it supports (e.g. avcodec-52.dll from HawkEye's FFmpeg Windows Builds has 11MB, mine has 1MB). Here is a simple guide how to get a working version using MinGW32 on a Ubuntu machine:

sudo apt-get install mingw32 yasm
mkdir -p ~/code/mingw32/install/
cd ~/code/mingw32/
git clone git://
cd ffmpeg
wget -O- | patch -p1
chmod +x
PREFIX=~/code/mingw32/install/ ./
make install

Ta-da, in ~/code/mingw32/install/ you now have everything you need to compile applications that use FFmpeg with MinGW32. If you need import libraries for MSVC, go to the bin directory on Windows and run the following commands:

lib /machine:x86 /def:avcodec-52.def /out:..\lib\avcodec.lib
lib /machine:x86 /def:avformat-52.def /out:..\lib\avformat.lib
lib /machine:x86 /def:avutil-50.def /out:..\lib\avutil.lib

Next up, how to compile Chromaprint on Windows with MSVC 2010 using these libraries.

Leave a Reply

comments powered by Disqus