Gstreamer video overlay on wayland backend ( python )


Is there a way to render gstreamer video overlay on a wayland gdk window from python ?

It is possible in C though, as below:

  if (GDK_IS_WAYLAND_DISPLAY (display) && (!user_choice
          || g_strcmp0 (user_choice, "wayland") == 0)) {
    gst_video_overlay_set_window_handle (videooverlay,
        (guintptr) gdk_wayland_window_get_wl_surface (window));
  } else

But, no python bindings available for wayland backend.

I am not sure why we’re even dealing with gdk backend specific calls in the example above. Shouldn’t these be abstracted by virtual functions ?


GTK3 doesn’t generate bindings for wayland backend.

Only X11 backend as shown below:


The proper way to integrate GStramer and GTK is to use the gtksink element and then extract the GtkWidget used to display the video through the widget property.

Even if GTK exposed the GdkWayland namespace like it does for the X11 backend, you would not be able to use native Wayland types in Python, because there’s no introspection data for libwayland-client.

Not really: you’re passing around native data structures, to avoid overhead.

In general, though, the documentation for integrating GStreamer and GTK and other toolkits is known to be out of date.


The video is rendered to a window with title 'Gtk+ Cairo renderer'.

Is it possible to render the video on a custom window without title bar ? Something like a video preview.


The titlebar (or headerbar in modern gtk apps) is drawn by the application under wayland and its something you can hide if you so desire. Make sure thought that there’s some way to manage the window.


There’s also gtkglsink which should be more efficient but is a bit harder to use and will cause crashes with the nouveau driver due to driver bugs.

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.