We're hiring!

Getting started with GStreamer's gst-build

Stéphane Cerveau avatar

Stéphane Cerveau
March 19, 2020

Share this post:

GStreamer relies on multiple repositories such as base and good to build its ecosystem, and now owns more than 30 projects in Gitlab. So, a unified tool/build system has always been necessary to build a specified version.

For over a decade, a script named gst-uninstalled was present in the gstreamer/scripts directory to build the whole solution. Although this tool was not very flexible and was missing some options in the command line, it was good enough if you wanted to tackle a surprising bug in our favorite framework. But it was not as good at providing a real swiss-army knife approach to build GStreamer and its dependencies.

Another build system called cerbero, created a few years ago, provides a standalone solution to build GStreamer packages. This solution offers a wide range of options in addition to a proper sandbox to avoid system dependencies and to be able to prepare packages that include third party software dependencies for a given version. Cerbero is written in Python and can create builds for the host machine like gst-uninstalled but also for various common targets depending on the host. Indeed a Linux regular desktop host will be capable to cross-build GStreamer for x86(32/64bits) but also for architecture such ARM and system such as Microsoft Windows. It can also create builds for Android and iOS.

Despite a shell environment allowing artifacts testing, Cerbero is not really convenient for a day to day development related to GStreamer as a new plugin development or a bug fix as it is not easy to update to the last revision without loosing a current work, or to test another branch of GStreamer

The rise of gst-build:

In order to improve this situation, gst-build was born. Taking advantage of the flexibility of the rising Meson build system, gst-build has been implemented to replace gst-uninstalled and provide a quick and smooth environment to hack into GStreamer and its dependencies.

Autotools is dead, long live Meson

Since GStreamer 1.18, Meson has been chosen as the only build system for the official GStreamer repositories. For its simplicity, speed and flexibility, Meson replaced Autotools, so it is also perfect to use with gst-build. Indeed gst-build is just a Meson project including GStreamer sub-projects with options to enable/disable selected sub-projects.

Using gst-build for the first time

gst-build is mainly a meson.build project. It reads .wrap files which are located in the subprojects folder to determine the elements of the project such as gstreamer or gst-plugins-base. These subprojects use the meson build system as well. gst-build comes with the essential projects you need to start using GStreamer and build it almost without system dependencies. gst-build bundles libffi or glib in the subprojects directory. It can also gather dependencies using pkg-config from the system to build the GStreamer plugins such as flac, for example, which needs libflac to build.

So let's take a look on how to work with gst-build!


As we have to choose a specific development environment, a 64 bit machine has been selected:

  • Ubuntu 18.04
  • Bash Shell


  • build-essential (gcc)
  • python3
  • git
  • meson
  • ninja

Install meson and ninja

Here are the essential dependencies you need to install before running meson and ninja.

$ sudo apt install build-essential python3 git ninja python3-pip

You can now install meson from the pip repository

$ pip3 install --user meson

This will install meson into ~/.local/bin which may or may not be included automatically in your PATH by default.

Fetch and Configure

This step will download the GStreamer repositories including some dependencies such as glib etc. into the subprojects folder. Basically it tries to download as many mesonified third party libraries as possible, and breaking news the cmake ones, as a bridge has been implemented recently if necessary.

$ git clone https://gitlab.freedesktop.org/gstreamer/gst-build
$ cd gst-build
$ meson build --buildtype=debug



All GStreamer modules

                        FFmpeg: YES
                         dssim: YES
                    gl-headers: YES
                      graphene: YES
                  gst-devtools: YES
          gst-editing-services: YES
                  gst-examples: YES
    gst-integration-testsuites: YES
                     gst-libav: YES
                       gst-omx: YES
               gst-plugins-bad: YES
              gst-plugins-base: YES
              gst-plugins-good: YES
                gst-plugins-rs: NO
              gst-plugins-ugly: YES
                    gst-python: NO
               gst-rtsp-server: YES
                     gstreamer: YES
               gstreamer-sharp: Feature 'sharp' disabled
               gstreamer-vaapi: YES
                         gtest: NO
                   libmicrodns: YES
                       libnice: YES
                        libpsl: YES
                       libsoup: NO
                      openh264: YES
                           orc: YES
                     pygobject: NO
                        sqlite: YES
                      tinyalsa: NO
                          x264: YES
Option buildtype is: debug [default: debugoptimized]
Found ninja-1.8.2 at /usr/bin/ninja

After this step, a newly created folder named build should be ready to be used by ninja to build the binaries.

As you may notice, --buildtype=debug has been added to the command line to get a fully debugable result without optimization. I invite you to visit this page if you want to fine-tune the build.

Build gst-build

This step will build all GStreamer libraries in addition to the plugins from base/good/bad/ugly/libav if their dependencies have been met or built by gst-build (ie glib, openh264 etc.).

$ ninja -C build

Test gst-build

This command will create an environment where all tools and plugins built previously are available in the environment as a superset of the system environment with the right environment variables set.

$ ninja -C build devenv

A prefix to your prompt should be shown as

[gst-master] bash-prompt $


[gst-master] bash-prompt $ env | grep GST_

From this environment you are now ready to use the power of GStreamer, and even implement new features in it without the fear of using out of date version.

From this shell, you are also able to compile without exiting the environment except when a configure step is necessary. This feature is very convenient to test a branch or fix a bug. Go to the subprojects folder and modify the code directly and then call ninja -C ../../build.

[gst-master] bash-prompt $ gst-inspect-1.0

Let's add a log line in gst-plugins-base

In this tutorial, I will explain how to add a log line in videotestsrc element, gst-plugins-base's plugin, rebuild using gst-build and test that the new log is now displayed.

  1. Edit the file
    vim subprojects/gst-plugins-base/gst/videotestsrc/gstvideotestsrc.c

    Go to the method gst_video_test_src_start and add the line:

    GST_ERROR_OBJECT (src, ""Starting to debug videotestsrc, is there an error ?");

    This will add a runtime log with the ERROR level. For more information about debugging facilities in GStreamer, visit the following page.

    Then close the editor.

  2. Build with gst-build
    $ ninja -C build

    You should see that only the file gstvideotestsrc.c rebuilt.

  3. Test the changes

    In order to enable the logs, you have to export the environment variable GST_DEBUG.

    Let's start the playback and display the result in the terminal. The following command will display all the log from videotestsrc with the category ERROR(1).

    GST_DEBUG=videotestsrc:1 gst-launch-1.0 videotestsrc num-buffers=1 ! fakevideosink

    You should have this output:

    Setting pipeline to PAUSED ...
    0:00:00.225273663 21743 0x565528ab7100 ERROR           videotestsrc gstvideotestsrc.c:1216:gst_video_test_src_start: Starting to debug videotestsrc, is there an error ?
    Pipeline is PREROLLING ...
    Pipeline is PREROLLED ...
    Setting pipeline to PLAYING ...
    New clock: GstSystemClock
    Got EOS from element "pipeline0".
    Execution ended after 0:00:00.033464391
    Setting pipeline to PAUSED ...
    Setting pipeline to READY ...
    Setting pipeline to NULL ...
    Freeing pipeline ..
  4. Update gst-build

    This command will update all the repositories and will reissue a build.

    $ ninja -C build_dir update

Adding a new repository

Better to be outside of devenv env. If you want to add a new repository and work in this environment. Very simple and handy way, you'll have to:

$ cd subprojects
$ git clone my_subproject
$ cd ../build
$ rm -rf * && meson .. -Dcustom_subprojects=my_subproject

And then you can go in your subproject, edit, change, remove even stare at his beauty.

$ ninja -C ../../build
$ ninja -C ../../build uninstalled

Wrapping up

Voilà, you're done! Stay tuned for my next blog post, where we'll look at how to use gst-build to cross-compile GStreamer to run it on embedded platforms.

As usual, if you would like to learn more about meson, gst-build or any other parts of GStreamer, please contact us!

Comments (4)

  1. Leslaw:
    Apr 07, 2020 at 06:10 PM

    Could you provide step by step blog entry for compiling GStreamer using Visual Studio and Gst-build. I did follow all available tutorials online and could not get a workable GStreamer build which would work for Visual Studio 2019. I managed to get a wine 64 bit build using WSL and Ubuntu 18.04 - however static libraries produced (*.dll.a) were not suitable for writing Visual Studio C++ apps, as I got persistent linking errors (different C++ naming decoration).
    I know that there are available builds of GStreamer 1.16.2 for Windows Visual Studio, but there is no code base or CI log files on the internet which could provide information what needs to be installed on a Windows 10 Visual Studio 2020 machine.
    If you were to provide such article could you make it as verbose as possible with exact log files from builds and possibly ZIP files from the build?

    Kind Regards

    Reply to this comment

    Reply to this comment

      1. Leslaw:
        Apr 08, 2020 at 08:58 AM

        I know about this entry. But after following it I stumbled upon many errors, which I could not overcome. First one was that glib subproject did not compile because of lack of libffi present. It would be really helpful if you provided even over the top algorithm how to compile with all the output data, such as which version of gst-build you used, which version of Meson build system was used plus all the output from compilation process. This would allow comparison and see what I do differently to you guys, which would allow me to successfully accomplish the build on Windows using Visual Studio 2019 Enterprise edition.

        Reply to this comment

        Reply to this comment

        1. Olivier Crête:
          Apr 08, 2020 at 01:48 PM

          This is tested on every merge request to GStreamer as part of our CI. So this should be work fine in the git master as well as 1.16 branch. libffi should be pulled in as a dependency. And it should work with any recent version of meson.

          If you need assistance, I advise you to ask on the gstreamer-devel mailing list https://lists.freedesktop.org/mailman/listinfo/gstreamer-devel

          Reply to this comment

          Reply to this comment

Add a Comment

Allowed tags: <b><i><br>Add a new comment:

Search the newsroom

Latest Blog Posts

Using regmaps to make Linux drivers more generic


Device drivers can support more revisions and SoC platforms by abstracting away specific hardware interface layouts. Let's examine a specific…

Cross-compiling with gst-build and GStreamer


gst-build is one of the main build systems used by the community to develop the GStreamer platform. In my last blog post, I presented gst-build…

Using syzkaller, part 3: Fuzzing your changes


In part 2 of this series on syzkaller, we looked at how to install the tool and use it to improve our code base. Now, how does syzkaller…

WirePlumber, the PipeWire session manager


An in-depth look at WirePlumber, the modular and extensible session manager for PipeWire that brings advanced device management, policy…

Reducing the size of a Rust GStreamer plugin


With Rust gaining traction among the GStreamer community as an alternative to C to write applications and plugins, we began wondering, could…

From Bifrost to Panfrost - deep dive into the first render


The Panfrost project building a free, Open Source graphics driver for modern Mali GPUs has reached a new milestone: the first 3D render,…

Open Since 2005 logo

We use cookies on this website to ensure that you get the best experience. By continuing to use this website you are consenting to the use of these cookies. To find out more please follow this link.

Collabora Ltd © 2005-2020. All rights reserved. Website sitemap.