GStreamer Qt6GLVideoItem cannot be imported by QML with PySide6
-
Hi community,
I'm porting an application from PyQt5 to PyQt6/PySide6.
With Qt5 it used the
QMediaPlayer
for playing an RTP stream processed with GStreamer like:self.mm = QMediaPlayer(None) self.mm.setMedia(QMediaContent(QUrl("gst-pipeline: ..."))
As GStreamer pipelines are not supported anymore directly in Qt6-Multimedia, I switched the GUI to QML in order to use
Qt6GLVideoItem
.But I always get the following error while running the attached minimal reproduction as you can see below:
$ ./repro.py GStreamer: (major=1, minor=26, micro=0, nano=0), Qt: 6.8.3 QQmlApplicationEngine failed to load component file:///home/djboris/MASKED/repro.qml:4:1: module "org.freedesktop.gstreamer.Qt6GLVideoItem" is not installed
This happens with the Arch Linux GStreamer package (version 1.26.0, gst-plugins-good, gst-plugin-qml6, gst-plugin-qmlgl installed).
The same issue exists with the GStreamer project compiled from main@7d51dc615d6ecae51e41dd8adbcf8c9a5ce74a09 with Qt6 support enabled and running ingst-dev.py
-environment.I also tried to run it on a Debian system with the distributed packages but had no luck with making it work.
Now my Qt debugging skills are exhausted as I don't understand how the import statement of
org.freedesktop.gstreamer.Qt6GLVideoItem
can find the GStreamer component as there is noqmldir
present in the GStreamer installation. It looks like there is a matching symbol in/usr/lib/gstreamer-1.0/libgstqmlgl.so
but how (and if) this can be imported in QML correctly.Finally, my questions are:
- What could be the cause of the import issue? Or: How does the QML import of
Qt6GLVideoItem
work, so I could further narrow down my issue - Are there better ways to show an RTP stream in Qt6?
A solution without QML is also fine. Migration from Python to C++ is possible, but not preferred. The code snippets were inspired from the GStreamer examples.
#!/usr/bin/env python3 # This is repro.py import sys import signal signal.signal(signal.SIGINT, signal.SIG_DFL) from PySide6.QtGui import QGuiApplication from PySide6.QtQml import QQmlApplicationEngine from PySide6.QtCore import qVersion import gi gi.require_version("GLib", "2.0") gi.require_version('Gst', '1.0') from gi.repository import Gst, GLib def main(args): app = QGuiApplication(args) pipeline = Gst.parse_launch("videotestsrc ! glupload ! qmlgloverlay name=o ! gldownload ! videoconvert ! qmlglsink name=sink") engine = QQmlApplicationEngine() engine.quit.connect(app.quit) engine.load('repro.qml') return app.exec() if __name__ == '__main__': Gst.init(sys.argv) print(f'GStreamer: {Gst.version()}, Qt: {qVersion()}') sys.exit(main(sys.argv))
// This is repro.qml import QtQuick 6.0 import QtQuick.Controls 6.0 import org.freedesktop.gstreamer.Qt6GLVideoItem 1.0 ApplicationWindow { visible: true width: 600 height: 500 title: "Repro" Text { anchors.centerIn: parent text: "Repro" font.pixelSize: 24 } Qt6GLVideoItem { id: video objectName: "inputVideoItem" anchors.centerIn: parent width: parent.width height: parent.height } }
- What could be the cause of the import issue? Or: How does the QML import of
-
Hi, having the same problem with Ubuntu 24.04, some debug logs attached:
0:00:00.000056816 240736 0xb9959e0 INFO GST_INIT gst.c:574:init_pre: Initializing GStreamer Core Library version 1.24.2 0:00:00.000080340 240736 0xb9959e0 INFO GST_INIT gst.c:575:init_pre: Using library installed in /usr/lib/x86_64-linux-gnu 0:00:00.000086081 240736 0xb9959e0 INFO GST_INIT gst.c:593:init_pre: Linux jesus-HP-ZBook 6.11.0-17-generic #17~24.04.2-Ubuntu SMP PREEMPT_DYNAMIC Mon Jan 20 22:48:29 UTC 2 x86_64 0:00:00.000172642 240736 0xb9959e0 INFO GST_INIT gstmessage.c:129:_priv_gst_message_initialize: init messages 0:00:00.000314487 240736 0xb9959e0 INFO GST_INIT gstcontext.c:86:_priv_gst_context_initialize: init contexts 0:00:00.000365642 240736 0xb9959e0 INFO GST_PLUGIN_LOADING gstplugin.c:328:_priv_gst_plugin_initialize: registering 0 static plugins 0:00:00.000393865 240736 0xb9959e0 INFO GST_PLUGIN_LOADING gstplugin.c:236:gst_plugin_register_static: registered static plugin "staticelements" 0:00:00.000399135 240736 0xb9959e0 INFO GST_PLUGIN_LOADING gstplugin.c:238:gst_plugin_register_static: added static plugin "staticelements", result: 1 0:00:00.000417529 240736 0xb9959e0 INFO GST_REGISTRY gstregistry.c:1918:ensure_current_registry: reading registry cache: ~/.cache/gstreamer-1.0/registry.x86_64.bin 0:00:00.007627994 240736 0xb9959e0 INFO GST_REGISTRY gstregistrybinary.c:683:priv_gst_registry_binary_read_cache: loaded ~/.cache/gstreamer-1.0/registry.x86_64.bin in 0.007197 seconds 0:00:00.007716520 240736 0xb9959e0 INFO GST_REGISTRY gstregistry.c:1785:scan_and_update_registry: Validating plugins from registry cache: ~/.cache/gstreamer-1.0/registry.x86_64.bin 0:00:00.008525830 240736 0xb9959e0 INFO GST_PLUGIN_LOADING gstplugin.c:1630:gst_plugin_ext_dep_extract_env_vars_paths:<plugin191> ignoring environment variable 'DISPLAY' with content #0 '': either not an absolute path or not a path at all 0:00:00.008532823 240736 0xb9959e0 INFO GST_PLUGIN_LOADING gstplugin.c:1630:gst_plugin_ext_dep_extract_env_vars_paths:<plugin191> ignoring environment variable 'DISPLAY' with content #1 '0': either not an absolute path or not a path at all 0:00:00.008537752 240736 0xb9959e0 INFO GST_PLUGIN_LOADING gstplugin.c:1630:gst_plugin_ext_dep_extract_env_vars_paths:<plugin191> ignoring environment variable 'WAYLAND_DISPLAY' with content #0 'wayland-0': either not an absolute path or not a path at all 0:00:00.009375976 240736 0xb9959e0 INFO GST_REGISTRY gstregistry.c:1877:scan_and_update_registry: Registry cache has not changed 0:00:00.009396565 240736 0xb9959e0 INFO GST_REGISTRY gstregistry.c:1953:ensure_current_registry: registry reading and updating done 0:00:00.009411363 240736 0xb9959e0 INFO GST_INIT gst.c:807:init_post: GLib runtime version: 2.80.0 0:00:00.009415140 240736 0xb9959e0 INFO GST_INIT gst.c:809:init_post: GLib headers version: 2.80.0 0:00:00.009417664 240736 0xb9959e0 INFO GST_INIT gst.c:811:init_post: initialized GStreamer successfully INFO:root:qml: Qt 6.9.0 (x86_64-little_endian-lp64 shared (dynamic) release build; by GCC 10.3.1 20210422 (Red Hat 10.3.1-1)) [Python limited API 3.12.3] INFO:root:qml: Using built-in configuration: default INFO:root:qml: loading ~/main2.qml INFO:root:qml: Using attribute AA_ShareOpenGLContexts INFO:root:qml: Gui application QQmlApplicationEngine failed to load component ~/main2.qml:4:1: module "org.freedesktop.gstreamer.Qt6GLVideoItem" is not installed
-