Using PyGObject to control gstreamer under MSYS2 from windows

Peter peterswanston at gmail.com
Fri Jul 28 13:48:18 UTC 2023


Hey one more update just so no one wastes time trying to explain something
when I already think I may have figured it out.

I found that the pacman package included with mingw ucrt64 is missing the
libgstpython.dll file that it should have.
So I went about building the dll following the instructions at
https://gstreamer.freedesktop.org/documentation/installing/building-from-source-using-meson.html?gi-language=python
Once done I was able to load my python plugins under an msys2 shell. I've
included the steps I used at the end of this mail for anyone who might run
into the same issue later.
I'm not sure why they don't package the dll with the gst-python package
like is done with arch64 but I think it might be because the path to the
python.exe is dependent on the type of mingw that is used and also the
mingw installation folder.
hopefully I can find some way to make it play nice with pyinstaller even
though I suspect it's going to be looking for the python executable at a
constant path, which may mean I need to always install to the same folder.

Peter

steps used to build libgstpython.dll

    - pacman -S git mingw-w64-ucrt-x86_64-meson-python
mingw-w64-ucrt-x86_64-cc mingw-w64-ucrt-x86_64-meson
mingw-w64-ucrt-x86_64-ninja mingw-w64-ucrt-x86_64-pkg-config
mingw-w64-ucrt-x86_64-pygobject-devel mingw-w64-ucrt-x86_64-python
    - git clone https://gitlab.freedesktop.org/gstreamer/gstreamer.git
    - cd gstreamer
    - git checkout 1.22.5
    - cd subprojects/gst-python/
    - meson build
    - cd build
    - ninja
    - cp plugin/libgstpython.dll /ucrt64/lib/gstreamer-1.0/libgstpython.dll

On Fri, Jul 28, 2023 at 5:10 PM Peter <peterswanston at gmail.com> wrote:

> Hello,
>
> I wanted to provide an update as I've managed to figure out a solution to
> the immediate part of issue 1) the solution is discussed on this page.
>
> https://stackoverflow.com/questions/76458520/create-an-executable-from-a-python-and-pygtk-script-under-windows
> "chcp.com 65001"
> I am able to play a video using the example
> https://gstreamer.freedesktop.org/documentation/tutorials/basic/hello-world.html?gi-language=python
> while under a msys2 shell now.
>
> I am still stuck with the second question regarding what package is
> equivalent to gstreamer1.0-python3-plugin-loader on pacman for msys2.
>
> Peter
>
> On Fri, Jul 28, 2023 at 3:01 PM Peter <peterswanston at gmail.com> wrote:
>
>> Hello,
>>
>> I am attempting to port a python linux application that uses PyGObject to
>> interact with gstreamer over to windows.
>> It also makes use of the python3 plugin loader included with the debian
>> package gstreamer1.0-python3-plugin-loader.
>> I am running into 2 problems.
>>
>> 1) I am unable to get gstreamer to successfully run from within a msys2
>> console window.
>> I have tried very basic things like "gst-inspect-1.0" but it crashes with
>> an error.
>> I originally attempted to use the pacman packges included with mingw64
>> msys2 "mingw-w64-x86_64-gstreamer mingw-w64-x86_64-gst-devtools
>> mingw-w64-x86_64-gst-plugins-base" but got a popup error "Unspecified fatal
>> error encountered, aborting".
>> So I then uninstalled those pacman packages and installed the MingW
>> x86_64 runtime installer from the gstreamer website "
>> https://gstreamer.freedesktop.org/data/pkg/windows/1.22.5/mingw/gstreamer-1.0-mingw-x86_64-1.22.5.msi
>> .".
>> I still get the exact same error though whenever I try to launch the
>> program from either MSYS2, MSYS2 MingW64, MSYS2 ucrt64 (all three different
>> shells).
>> When I run the command from a command prompt "cmd.exe" it runs fine
>> though.
>>
>> I'm not sure but is there a way to get gstreamer to run within an msys2
>> shell context on windows?
>> it seems like the only way to use PyGObject is from within an msys2 shell
>> unless I'm mistaken so I'm not sure if this means it's not possible to
>> interact with gstreamer or PyGObject or not.
>>
>> 2) Assuming it is possible to interact with gstreamer using PyGObject on
>> windows under msys2  (or otherwise if possible). Is there some equivalent
>> to the debian package of gstreamer1.0-python3-plugin-loader for arch? or
>> whatever packages are used by msys2 to install gstreamer? Perhaps it is
>> included within one of the other packages and not broken out into it's own
>> package?
>>
>> It seems like perhaps I need to port my python application to c++ if I
>> hope to get it running on windows.
>>
>> Thanks for any assistance,
>>
>> Peter
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/gstreamer-devel/attachments/20230728/d09e5250/attachment.htm>


More information about the gstreamer-devel mailing list