DEV Community

Cless
Cless

Posted on

Setup Gstreamer with Python on Windows

When I started trying GStreamer with Python on Windows 10, it took me quite some time to set up the development environment. So this might help others on the way.

The most convenient approach is through MSYS2. Here are the steps:

1.Download and install MSYS2: https://www.msys2.org. Remember [msys2_path] for environment variable.

2.Install Python, GStreamer, tools, plugins, and PyGObject

  • Open MSYS2 UCRT64 terminal
  • Update MSYS2 pacman -Syu. After this, the terminal may close; you need to open it again.
  • Install gcc pacman -S mingw-w64-ucrt-x86_64-gcc
  • Install Python, GStreamer, tools, plugins, and PyGObject pacman -S mingw-w64-x86_64-python3 mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-devtools mingw-w64-x86_64-gst-plugins-{base,good,bad,ugly} mingw-w64-x86_64-python3-gobject
  • Add the following paths to ~/.bashrc

    export PATH="<msys2_path>/mingw64/bin:$PATH"
    export XDG_DATA_DIRS="<msys2_path>/mingw64/share/:$XDG_DATA_DIRS"
    
  • Apply bashrc: source ~/.bashrc

3.Test: run this on the terminal

pip install pygobject
python -c "import gi; gi.require_version('Gst', '1.0'); from gi.repository import Gst; print(Gst.version_string())"
Enter fullscreen mode Exit fullscreen mode

Top comments (0)