How to Setup GStreamer for Windows: A Guide

Introduction to the GStreamer Windows Setup

We’re big fans of GStreamer, a very good open source multimedia framework supported on almost every platform conceivable, including Linux, OS/X, Android, iOS, and even tiny clients like Raspberry Pi.

Recently, we’ve needed to use GStreamer on a couple of Windows projects. Because we use advanced features of GStreamer, like multiple synchronized video feeds with synchronized audio, we want to be able to build the Gstreamer libraries from source, in case we uncover a bug under advanced scenarios that might affect our client.

Unfortunately, building GStreamer on Windows is fairly complex, and the existing instructions available on the web are woefully out of date. In general, you should avoid GStreamer.com since that site is no longer maintained by its parent company Fluendo and use gstreamer.freedesktop.org instead.

I recently worked through the legacy instructions, updating, correcting, and augmenting them to the end of building GStreamer-1.0 (1.8.0) on Windows. The end result was a successful build of the GStreamer Windows MSI and merge module release artifacts. (A thank you to the current maintainers of GStreamer, who provided helpful advice along the way.)

Building GStreamer on Windows is not for the faint of heart! But if you need to build it from source, these directions should help you out.

Note that the software gets built in the Unix/POSIX-compatible MingGW/MSYS subsystem for Windows, so the instructions below assume at least some basic familiarity with Unix conventions.

Prerequisites

This was tested on:

  • Windows 10 Professional
  • Windows 7 Professional
  • Using Visual Studio 2015 Community
  • Using Microsoft Windows SDK/DDK 10

The below assumes you are on 64-bit, you’re building for 64-bit, and your Windows username does not contain spaces.

Git

Git can be added as part of VS 2015 or installed standalone.

Microsoft Visual Studio and GStream SDK for Windows

  • These instructions used Visual Studio 2015 Community
  • Windows SDK 10 (which includes DDK 10)
  • Should work with SDK/DDK 7.1 or later (which may be a manual download/install for earlier versions of VS)
  • Visual C++
  • Add as part of VS 2015 (Tools 1.x + Windows SDK 10)

Note that the build does not use the Microsoft C/C++ compiler, but will need the Visual C++ libraries installed.

Downloads Needed

Python 2.7

Git (if not already installed, e.g., integrated in VS)

MinGw/MSYS

CMAKE
– Windows Installer: msi

YASM
– Win64.exe (note: this will be renamed/copied later)

WIX (3.5)
– wix35.msi
INSTALLATION STEPS

* Install Visual Studio 2015 Community (or greater)
– Make sure to add prerequisites in the components dialog
– You can try using an earlier version of VS
* Install Python to C:\Python27
– Install for all users
– Add Python.exe to Path

 

* Install CMake
– Add CMake to the System Path for all users
– Suggested to install to C:\CMake

 

* Install Wix
– You may get a warning that Votive cannot be installed to Visual Studio; this is harmless.
MinGW/MSYS

– This installation is quite involved, please follow the steps carefully
– The later Cerbero build steps will automatically download the components of MinGW/MSYS that it needs, so you don’t need to worry too much here

* Install MinGW/MSYS Installation Manager

* When the Installation Manager opens at the end, select following items in the “Basic System”
– MinGW-developer-toolkit
– MinGW32-base
– MinGW32-gcc-c++
– msys-base
– Click Installation\Apply Changes
– Click Apply. This will take many minutes to finish.
YASM
* Copy the YASM file you downloaded earlier (example name below) to
yasm-1.3.0-win64.exe to C:\MinGW\bin
– Rename to yasm.exe
* Make a shortcut icon on the desktop or taskbar or start menu:
target: C:\MinGW\msys\1.0\msys.bat
Run as administrator

When you run this (as administrator) for the first time, it will create:
\C:\MinGW\msys\1.0\home\<username>
This is where you will add a .profile file and where you will build Cerbero.

NOTE: it is not known if the MinGW subsystem accepts Windows line endings
It is suggested you use Notepad++ (or similar programmer editor) and set EOL (line endings) to Unix if you edit files in MinGW (use menu Edit\EOL Conversion\Unix)
* Create fstab. You can copy:
copy C:\MinGW\msys\1.0\etc\fstab.sample to fstab
Make sure it has this line enabled:
c:/mingw        /mingw
* Create a file in ~/.cerbero/cerbero.cbc with the following lines:
* NOTE: Parallel builds do not work (as of 1.8.0), so don’t enable that option

Import os
from cerbero.config import Platform, Architecture, Distro
target_arch = Architecture.X86_64
You must now set up the following inside your C:\MinGW installation.
(run the msys shell as Administrator)

* create a ~/.profile file:

$ echo “export PATH=\”\$PATH:/c/Python27\”” >> ~/.profile
$ echo “alias cerbero=‘~/cerbero/cerbero-uninstalled’” >> ~/.profile

* Set wget to not check certificates:

$ echo “check_certificate=off” >> ~/.wgetrc
Git Config

* You need to set up the following items otherwise they halt the build process.
NOTE: Git run inside the MinGW shell doesn’t pick up settings from Git Windows

$ git config –global user.email “[email protected]
$ git config –global user.name “Your Name”
$ git config –global core.autocrlf false
Cerbero and GStreamer

The following basic steps will be done to build a specific version of GStreamer.
The recipe files in the version of Cerbero you check out will by default build the same version of GStreamer. (Cerbero and recipe files are beyond the scope of this section.)
Note that the entire process can take MANY hours; be prepared!

  1. List the available branches and tags of GStreamer
  2. Clone the desired version you want into your msys home folder
  3. Run the “bootstrap” process, which builds Cerbero (this can take hours)
  4. Build GStreamer (this can take many hours!)

Open the msys shell in Administrator mode

* List the available builds

$ git ls-remote http://cgit.freedesktop.org/gstreamer/cerbero

* check out a specific build or tag (this uses tag 1.8.0)

$ git clone -b 1.8.0 http://cgit.freedesktop.org/gstreamer/cerbero

* Run bootstrap

$ cd cerbero
$ cerbero -c config/win64.cbc bootstrap

WARNING: This could take several hours

* Build gstreamer

$ cerbero -c config/win64.cbc package gstreamer-1.0

Warning: This could take up to eight hours or more.

The output artifacts can be found in:

C:\MinGW\msys\1.0\home\<username>\cerbero
gstreamer-1.0-devel-x86_64-<version>.msi
gstreamer-1.0-x86_64-<version>.msi
gstreamer-1.0-x86_64-<version>-merge-modules.zip

Conclusion

Phew! Many steps and lots of waiting, but hopefully you learned a few useful things along the way. Now, get cracking on building (or porting!) your awesome GStreamer-based software to Windows. (Rumor has it that the Windows operating system has a substantial user base.)

Let me know if you discover any errors or omissions, or have helpful updates to the instructions in the comments, and I’ll update this post accordingly.

Previous
Next