How to install Gstreamer Python Bindings

3 min. read |

Development for Gstreamer could be quite challenging at the beginning. But there is a lifeboard, – Gstreamer Python Bindings. With Python it is much easier to understand basic Gstreamer concepts and at the same time to speed up applications development.


  • Ubuntu 18
  • Python 3.6


Personal experience

Gstreamer is written on pure C. I worked with C/C++ for almost 5 years. But at first it was still quite difficult to use it and prototype video analytics applications within short deadlines. And almost all logic for such applications often is written in Python using OpenCV, Tensorflow. But with Gstreamer Bindings for Python it was much easier to build applications using advantages of Gstreamer’s flexibility and Python’s simplicity. Now I could hide any image processing in Gstreamer pipeline and for analytics pipeline just use decoded RGB buffer.


Checkout Dockerfile to build Docker Image for Ubuntu 18 and Gstreamer Python Binding.


First, Install Gstreamer on Ubuntu

In addition we need to install dev package for gstreamer

Then, install Python specific packages.

Also install additional packages required to build Gstreamer from sources

Let’s install packages for Python GObject, GObject Introspection required to make Gstreamer friends with Python.

Now system is ready to build gst-python package from repository.

Building gst-python from sources

First, create a test virtual environment to check installation

After all, install pip-requirements. Detailed requirements for Python GObject installation

Checkout Python GObject API References. This resource is going to be main source of Gstreamer API for Python.

Gst-Python API Check

Now check that essential imports are working in python

Gst-Python Plugin Check

Download and execute next command

If while running previous commands you got any mistakes, then proceed with next steps.

Let’s build gst-python from sources. This allows to use the latest gstreamer python bindings and align it with pre-installed gstreamer version.


  • Set PYTHON variable to change python executable location
  • Gstreamer Version Check
  • Get libpython-dir (location of libpython*
  • Get Prefix for current environment (Python Library Path)

Common Issues

Element factory metadata for plugin has no valid long-name field

For example, during execution :

You can get the following error message

Solution. While gst-python installation the following files should be copied to PYTHON_PACKAGES_DIR/gi/overrides. Because existing files installed by pygobject could be outdated.

Note: PYTHON_PACKAGES_DIR is usually path to site-packages or dist-packages

Usually, all the files are being copied during make install execution.

But in case if you want to move files into another location you can use the following procedure.


2. Define GST_GI_OVERRIDES_PATH. Path to files generated by make inside gst-python folder

3. Now, copy required files from GST_GI_OVERRIDES_PATH to GI_OVERRIDES_PATH

This should fix previous error.

Note: The only time I needed this is when I was installing gst-python with prefix /usr. Because in that case all files are being install into ../site-packages folder, but python uses ../dist-packages. In that case manual files transfer helps.

But in general, I suggest you to use venv. In such a case python uses ../site-packages folder


Repeat GstPython API Check.

Hope everything works as expected. Finally, in case of any errors, mistakes or problems leave comments down here. I’d be happy to find out solution with you 😉


Add a Comment

Your email address will not be published. Required fields are marked *