17 Oct 2009

GStreamer on Windows

GStreamer is a multimedia framework used extensively in GNOME applications (such as QuodLibet, a media player). Due to its relationship with GNOME, it primarily runs on Linux. However getting it to run under Windows is quite easy.

We will focus on how to get GStreamer 0.10.17 installed—I assume you will know what to do with it once it’s working properly (such as getting your favourite GStreamer-based music player running).

GStreamer

  1. First off, you’ll need a few binary packages. Download and extract each of the following (they each include a binary installer):

  2. For some strange reason, GStreamer (which provides no GUI afaik) requires the GTK+ runtime installed, so download the latest gtk2-runtime*-ash.exe from http://gtk-win.sourceforge.net/home/index.php/Downloads and install it. Make sure the installer sets up the PATH environment variable (it does by default) or GStreamer won’t be able to find GTK.

  3. Install each of the extracted GStreamer binaries in the order given in step one.

    Note: When installing GStreamer core, the installer will ask you if you want to reinstall the glib libraries that GTK provides. Make sure you select No.

  4. Test that GStreamer is writing to the Windows Audio Service properly by opening a cmd window and typing the following:

    gst-launch-0.10 audiotestsrc ! autoaudiosink
    

    After you dismiss a missing library warning (more on this next), you should hear a constant tone coming from your speakers. Stop it with ^C.

  5. When running gst-launch-0.10, you will possibly get an error pop up with the following text:

    This application has failed to start because libpng13.dll was not found. Re-installing the application may fix this problem.

    This library isn’t provided with GTK+ or GStreamer, and the easiest way to get it is to download it and extract the libpng13.dll file to the C:\Program Files\Common Files\GStreamer\\0.10\lib\gstreamer-0.10 directory.

    After dismissing this first error, you may also see an error printed in the console window:

    WARNING **: Failed to load plugin ‘C:\Program Files\Common Files\GStreamer\0.10\lib\gstreamer-0.10/libgstpng.dll’: The specified module could not be found.

    This error is quite misleading, as upon closer inspection, libgstpng.dll does actually exist at the specified path. As is usual on Windows, the library directory isn’t in the PATH environment setting. Append the following to the PATH setting in System Properties -> Advanced -> Environment Variables -> System variables:

    ;C:\Program Files\Common Files\GStreamer\\0.10\lib\gstreamer-0.10
    
  6. You will need to reopen the cmd window for the new PATH setting to take effect. Running gst-launch-0.10 … as per step four should now run without any errors.

Python bindings

Python has bindings for GStreamer that a number of Python audio applications use. Installing these bindings is easy, however please note that there is not yet (at time of writing) a Windows build against Python 2.6; instead you must have Python 2.5 installed.

  1. Download and install the Python 2.5 binary.

  2. Download and install the gst-python25-0.10.10.setup.zip bindings. The installer should auto-detect the default directory for you (defaults to C:\Python25\Lib\site-packages).

You should now have a working GStreamer installation on Windows.