Search code examples
pythonpython-3.xgstreamergstreamer-1.0

How to setup Python virtual environment with bindings for gstreamer?


I would like to use gstreamer library (1.0+) inside my python code. As they mention on their website they offer python bindings, but unfortunately they do not provide any additional information on how to get it up and running.

Can someone please provide a step by step instructions on how to install all the required package (preferably with pip) in order to use gstreamer inside a python virtual environment. A minimal working example would also be highly appreciated.

ps: I am working on Ububtu 18.04


Solution

  • In order to use gstreamer with python bindings a PyGObject package must be installed.
    The setup procedure is the following:

    1. Open a terminal and enter your virtual environment
    2. Execute sudo apt install libgirepository1.0-dev gcc libcairo2-dev pkg-config python3-dev gir1.2-gtk-3.0 to install the build dependencies and GTK
    3. Execute pip3 install pycairo to build and install Pycairo
    4. Execute pip3 install PyGObject to build and install PyGObject

    A more comprehensive guide can be found here:
    https://pygobject.readthedocs.io/en/latest/getting_started.html