Or, how to lose your will to live using open source.
For... um... reasons... I had to try and build ffmpeg (www.ffmpeg.org
) for Windows from source. "Hey", I thought, "this seems easy. Just look, the website has a page dedicated to building the software - it says it just takes a few minutes!" (http://trac.ffmpeg.org/wiki/CompilationGuide
) How wrong I was.
So, my first attempt was to build using Visual Studio. So, all you need is Visual Studio. And a C99-C89 converter. And YASM. And some dodgy header files. And MSYS. Oh, and MSYS basically means you're getting MinGW. Ugh. Even after getting all of that set up, trying to configure the makefiles for Visual Studio still failed.
Oh well, I thought, it says you can build it using cross compilation tools in Linux. After following the instructions, with the obligatory fiddling around with library version updates etc. I found that the distro of Linux I was using (Mint) didn't have the required level of some core libraries. Sigh. Create a new Fedora VM and try again. This time I got quite a bit further in the process, but there were still issues with library incompatibility - I have now managed to completely excise those painful errors from my brain.
OK, OK, the third method is to build on Windows using Cygwin and MinGW. So I span up a new Windows VM. I used Windows 8, this time, which isn't really easy to use in a Windowed VM player - damn you charms! So, I used a script from here: http://blog.h-quer.de/post/2013/05/15/building-ffmpeg-on-Windows-(2-of-n).aspx
which claimed to set everything up for you. Well, that sort of worked, except that the script version it pointed to no longer works with the latest ffmpeg source. Sigh. So, after a bit more fiddling around, manually running ./configure commands and playing with ENV variables, I finally, miraculously, had an ffmpeg.exe I could test. And it worked! Craziness. So, I instantly shipped it off to the destination server where I needed to use the application.
And it failed. Because it was a 64 bit executable, and the target machine was 32 bit. Grrrrrrr. I then spent a while trying to play with all the ./configure command line parameters for building both the cygwin libraries and ffmpeg before smashing my head into the table in frustration.
Finally, I found the link below. Using a fresh Linux VM (Fedora 20 for those playing at home) I downloaded and ran the script. Two prompts later, it told me I was missing a large set of packages. I installed them, then ran the script again, and it promptly failed because there were more dependencies (gcc-c++ for one) that weren't checked the first time around. Then, after a (long) while as the script built the mingw compiler, from scratch, then built all of the shared libraries required, from scratch, the x264 library compilation failed. Sigh. Turned out the x264_opencl stuff that was retrieved from github couldn't be built. Deciding that x264 OpenCL support wasn't actually needed for my purposes, I did what any good C programmer would do, and commented out the offending lines - x264_opencl_cache_load and x264_opencl_source being the "undefined reference" culprits. And then I crossed my fingers, crossed my toes and ran the script again. This time everything built.
I transferred the files to my testing (Windows 32 bit) VM, and miracle of miracles, they work.
tl; dr: ffmpeg for Windows? Use a fresh Linux install with the script from the link. #ffmpeg #opensource