Behold, the power of GNU! Photo (CC-BY-SA Demet.

I love Windows. And by “love,” of course, I mean “tolerate grudgingly.” After all, good as Mac OS X is, running Windows means the ability to get the latest-and-greatest graphics drivers, run-on-anything hardware capabilities, promising new multitouch laptops, terrific gaming, wonderful visual tools like vvvv, quick-and-dirty video editing with great tools like Vegas, and Microsoft’s own Xbox360-friendly XNA developer tools. It’s access to cheaper computers, without having to make some of the sacrifices needed on Linux (and Linux is easier to dual-boot and share on Windows than on Mac).

In short, Windows can be a great visualist OS. The problem: to take advantage of much of the open source and free software stuff we love, you need an open toolchain and some of the basics from Linux, UNIX, and OS X that are absent on Windows. Know how free software advocates are constantly, annoyingly, referring to “GNU/Linux”? Well, while that doesn’t trip off the tongue, technically speaking they have a point. And indeed, one might as well say GNU/Mac OS X. It’s GNU, the little free software bits and compiling tools, on which all the most important parts of free and open source software are built.

Earlier this week, I talked about how you could build ffmpeg, the fantastic, free, command-line, do-everything video and audio conversion tool, on Windows. In fact, to do that, you’ll need those GNU goodies. And it turns out that build procedure isn’t all that intuitive. So, here you go – having learned this the hard way myself (I was booting into Linux or Mac OS to run ffmpeg), here’s the procedure.

1. Get MinGW.
MinGW is the “minimalist” port of GNU to Windows. Unlike Cygwin, from which MinGW and MSYS have forked, it’s not a massive pain in the … uh, okay, let’s just get started. Grab the latest automated exe installer from Sourceforge and run it. Pick a directory; c:\mingw is a good start. I selected most of the compilers; make sure you include gcc and g++, at least.

2. Get MSYS.
MSYS is your command line; this is what gives you the equivalent of running the Terminal application in OS X, with bash as your shell. Grab the most recent stable MSYS from the same SourceForge site as MinGW; in this case, the file you want is MSYS 1.0.11.

3. Install MSYS and point it at MinGW.
Run the MSYS installer. As it reaches 100%, you’ll see a DOS command line open. Say “yes” to its yes/no questions, and it’ll ask you for the location of MinGW. Here’s the trick: don’t assume case sensitivity. So, even though I’m installed in C:\MinGW, I’m going to type in (using UNIX-style forward slashes) “c:/mingw”. Then you’re good to go. If something goes wrong, you actually need to re-run the MSYS installer to fix it. See also ffmpeg’s instructions for MSYS.

4. Install SVN.
Subversion is going to let us grab the latest files. I could use the Windows Subversion, but I definitely want a copy of SVN running from the MSYS command line, too. You’ll find svn binaries for Windows from Tigris. Download that file, uncompress it, make a new directory in c:\msys\1.0 called “local,” then copy the folders from svn (bin, iconv, licenses, share) into c:\msys\1.0\local\. (PS, for more tips, check out the OpenTTD instructions for MinGW.

5. Install coreutils.
Here’s the part that really confused me. Some essential GNU utilities aren’t included in MinGW/MSYS by default, which means a lot of things won’t build. The trick is finding the right package. Browse through the files on MinGW’s SourceForge site. You’re looking for MSYS coreutils, which as of this writing is up to coreutils-5.97-2. You’ll find a number of files with an lzma extension, which you can easily open via the awesome Windows utility 7-zip. What you’re trying to grab is the coreutils file that ends with -ext. The “ext” package includes those files you’re missing. Find that file, decompress it, and copy the files you need from its bin folder to your c:\mingw\1.0\bin. I just went ahead and copies everything, as it includes a lot of essential utilities. (For ffmpeg, you absolutely need “pr.exe.”)

6. Try installing ffmpeg!
If you’ve followed the steps above, one of the things you can install is ffmpeg. Configure won’t work without an essential flag:
./configure --enable-memalign-hack
make install

(If you want to build your ffmpeg libraries as DLLs, you can do –enable-shared.)

Once that’s done, though, you can run ffmpeg from your MSYS prompt. Neat! And you’ll also have a build toolchain that works well with other cross-platform open source projects. Now, go enjoy your game of Team Fortress 2, because you can.

If this makes you nostalgic as it does me, you, like me, are OLD. Photo (CC-BY David Orban.
  • Jaime Munarriz

    Wow, I know how mind-blowing this operations can be… thanks for sharing!

    By the way, ani't there a compiled version around? I think I've used it on windows, already built.



  • yoo

    I just had a wave of nostalgia….thanks Peter i feel bad enough as it is with my birthday coming up ;)

  • Peter Kirn

    Heheh, that's okay — we're only old in computer years. ;) <span style="white-space: pre;"> </span>

  • SKY(nard) RON(stein)

    Love  hurts! (sorry, I couldn't resist!)

    (p.s. I'm about to enter Ubuntu world, having acquired 3 old desktop PCs my university was throwing away . . . wish me luck!)

  • Peter Kirn

    Ron, I have to say, I've got to strongly recommend Fedora over Ubuntu having played around with it. I'm spending a fraction of the amount of time I had been with screwy Ubuntu packages and poor maintenance.<span style="white-space: pre;"> </span>But that's another conversation…

  • Samuel Gaehwiler

    I'm not working with Windows (except virtualized), so I'm not familiar with these options. Nevertheless, I will share something I have read in the german Linux Magazin:

    On&nbsp ; it is described as

    "coLinux lets you run Linux natively within windows. This is full blown linux on the windows machine…not a compatible/striped down environment like cygwin/mingw."

    There is also&nbsp ;, which is built on top of coLinux and Ubuntu. I'm quite sure similar projects exist for Fedora.

  • Peter Kirn

    @Samuel: Absolutely. Those do tend to be overkill, though, for many users; in this case I'm assuming you just need the MinGW rig and a build chain, and are more likely to use native Windows apps for everything else. It's not too hard to dual boot, anyway, I find.<span style="white-space: pre;"> </span>

  • Pingback: Create Digital Motion » More ffmpeg Recipes for Free Video Conversion on Any Platform

  • Rados

    ok im new here so here's where i fail- ive done all the steps, but how do i install ffmpeg? i did download it and ran ffmpeg.exe from 'bin' folder if thats what it takes, but it just opens the DOS window for a second and then it closes. im running on win7. wat do?

  • Rados

    actually sorry, just found some exhaustive guides that ll probably clear things out for me, i take back my cry for help :)