Skip to content
  • @jadahl Thanks for this, I've created a similar snippet for screen-shots based on this in https://gitlab.gnome.org/snippets/814

  • Could this be updated for more recent versions of python3-gi? Or at least inform which version-range it would work with?

    Ref:

    [2021-01-22 14:56:40] 0 x10an14@machine:~
    -> $ python3
    Python 3.8.5 (default, Jul 28 2020, 12:59:40)
    [GCC 9.3.0] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import gi
    >>> gi.repository
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    AttributeError: module 'gi' has no attribute 'repository'
    >>> gi.Repository
    <class 'gi.Repository'>
    >>> from gi.Repository import GLib
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    ModuleNotFoundError: No module named 'gi.Repository'
    >>> gi.version_info
    (3, 36, 0)
    >>>
  • Could this be updated for more recent versions of python3-gi?

    Hmm,

    >>> import gi
    >>> gi.version_info
    (3, 38, 0)
    >>> gi.repository
    Traceback (most recent call last):
      File "<stdin>", line 1, in <module>
    AttributeError: module 'gi' has no attribute 'repository'
    >>> gi.Repository
    <class 'gi.Repository'>

    but the script still works.

    FWIW, I removed the deprecated GObject.threads_init() so that warning should no longer occur.

  • @jadahl Hello. Thanks for this code. How can I record in MP4 with sound? The examples I've used before with ximagesrc don't work ...

  • @amikha1lov you need to set up your own gstreamer pipeline that combines some audio source with the pipewire stream; it's more of a gstreamer question.

  • Is it possible to do an example of this with gst-launch-1.0 pipewiresrc ! videoconvert ! autovideosink and dbus-send?

    I am talking about the commands and in bath, I understand little of python. So if it is possible to make an example in bath it would help me a lot

    I tried it and it seems to work for me, but I don't want to use python for what I'm developing

  • For it to work properly, you need to pass a file descriptor from the D-Bus call to the gstreamer pipeline (see the fd=.. part of the gstpipewiresrc element); I'm not sure you can do that with bash and dbus-send.

  • Well after being able to recreate this for my application, I couldn't find a way to save the output in a .mp4 video.

    try things like pipeline = Gst.parse_launch('pipewiresrc fd=%d path=%u ! videoconvert ! x264enc ! mp4mux ! filesink location=hola.mp4 '%(fd, node_id)), but this created a blank file.

    Then I tried this, gst-launch-1.0 pipewiresrc path=75 ! videoconvert ! filesink location=fileRare it seems to save something but I really don't know what to do with it.

    I don't really know where to start, but all I want to do is capture the output and save or stream it. It would help me a lot if you can give me a hint for this

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