At Cardinal Peak, 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.
What is GStreamer Used For?
The framework is largely utilized to create media applications (streaming, media playback, nonlinear editing, etc.). Designed to simplify the writing of applications that handle audio or video or both, GStreamer uses plug-ins that provide various codec and other functionalities to process streaming content.
Providing well-tested elements to meet many challenging engineering needs, GStreamer makes application development easy. Plus, the framework counts with an extensive list of multimedia plug-ins (encoders, decoders, content filters, etc.) and allows for uncomplicated third-party integration.
Recently, we’ve needed to use GStreamer on a couple of Windows projects. Because we use advanced features of GStreamer — such as 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.
Introduction to the GStreamer Windows Setup
Unfortunately, building GStreamer on Windows is fairly complex, and the existing Gstreamer windows deployment instructions available on the web are woefully out of date. I recently worked through the legacy instructions, updating, correcting and augmenting them to ultimately build 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. (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, this GStreamer tutorial should help you out.
Note that the software is 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 for Installing GStreamer on Windows
This GStreamer install was tested on:
- Windows 10 Professional
- Windows 7 Professional
- Using Visual Studio 2015 Community and Microsoft Windows SDK/DDK 10
The below assumes you are on 64-bit, building for 64-bit, and your Windows username does not contain spaces.
When using GStreamer in Windows, Git can be added as part of VS 2015 or installed stand-alone.
Microsoft Visual Studio and GStreamer SDK for Windows
These instructions for installing GStreamer on Windows used:
- Visual Studio 2015 Community
- Windows SDK 10 (which includes DDK 10)
The instructions should also 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.
GST Build Windows Downloads Needed
GStreamer 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.
This installation is quite involved, please follow the steps carefully. The later Cerbero build steps will automatically download the necessary components of MinGW/MSYS, so you don’t need to worry too much here.
- Install MinGW/MSYS Installation Manager
- When the Installation Manager opens at the end, select the following items in the “Basic System”:
- Click Installation\Apply Changes.
- Click Apply.
This process will take many minutes to finish.
Copy the YASM file you downloaded earlier (example name below) to:
yasm-1.3.0-win64.exe to C:\MinGW\bin
Make a shortcut icon on the desktop, taskbar or start menu:
Run as administrator. When you run this (as administrator) for the first time, it will create:
This is where you will add a .profile file and where you will build Cerbero.
Note that it is not known if the MinGW subsystem accepts Windows line endings.
It is suggested you use Notepad++ (or a 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:
Create a file in ~/.cerbero/cerbero.cbc with the following lines:
Note that 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
You need to set up the following items otherwise they halt the build process.
Note that 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, so be prepared!
- List the available branches and tags of GStreamer.
- Clone the desired version you want into your msys home folder.
- Run the “bootstrap” process, which builds Cerbero (this can take hours).
- 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
$ cd cerbero
$ cerbero -c config/win64.cbc bootstrap
WARNING: This could take several hours!
Finally, 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:
Does GStreamer Work on Windows?
Phew! So many steps and lots of waiting, but hopefully you learned a few useful things along the way. Long story short, yes, building GStreamer on Windows is possible, and since GStreamer is a multiplatform framework, you can run the same code for Windows as you would Linux, OSx, Android or iOS.
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.) If you need help installing GStreamer on Windows or designing audio/video products, tap our expertise!