Skip to content
  • Hey @jadahl

    I'm currently trying to write a little python program that pics up on your work with the gnome screen cast api. However I can't really wrap my head around your example script. I have a somewhat decent python knowledge but I don't really know gsteamer and dbus. Could you help me with a little start.

    What I need is a python program, that dumps out the pipewire stream into a file or even print. Could be raw data, I don't care, but I really don't understand this stream.connect_to_signal and pipeline.set_state and what not, further I couldn't find documentation on all these methods. All I need is a minimal example that captures the raw pipewire stream in some way so that I can parse it into another program later on.

    The goal is to write a capture program for hyperion

    Thx in advance.

    Edited by deisi1
  • stream.connect_to_signal connects to a D-Bus signal. How it works is that you create a screen cast session, say what you want to record, which will get you stream D-Bus objects. Then when you start, the display server (GNOME Shell) will start pipewire streams, and let you know via the PipeWireStreamAdded signal on the corresponding org.gnome.Mutter.ScreenCast.Stream object.

    You then use the pipewire stream ID to create a gstreamer pipeline. The set_state you see above is actually gst_element_set_state(). You can change the above code to output to a file by changing the ximagesink to something else (e.g. something ending with a filesink. You can add encoding etc by adapting the gstreamer pipeline to your needs.

  • Thx a lot. I also started to learn more about gstreamer and it turns out that I need some more knowledge about it, but I'm getting there. :)

  • Is there an example how to get a list of monitor/window ids to be used for this interface? With the defaults I have this running just fine - just not sure how to configure for anything other than not configuring and let the defaults kick in. I figured that I probably should use org.freedesktop.portal.ScreenCast - however although I seem to have pipewire/gstreamer working correctly I have no idea what I have to do get this interface exposed:

    dbus.exceptions.DBusException: org.freedesktop.DBus.Error.UnknownMethod: No such interface “org.freedesktop.portal.ScreenCast” on object at path /org/freedesktop/portal/desktop
    

    Running Debian/sid. Any hints are appreciated.

    EDIT:

    Don't know what package exactly was needed, but after installing gnome-remote-desktop the xdg API was accessible via dbus.

    Edited by Florian Zwoch
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment