Qt and gstreamer
-
@stephane78-0
oh sry...i thought you are talking about the QtMultimedia module -
@raven-worx Hi ,you have perhaps a good idea I will try to compile Qt with gstreamer 1.0 support and I come again back
-
Did you check the winID value ?
-
Hi, I have tryed another method with the plugin qmlsink s owith qml but I have a black screen, my code comes from an exemple of the plugin good on github:
int main(int argc, char *argv[]) { int ret; gst_init (&argc, &argv); { QGuiApplication app(argc, argv); GstElement *pipeline = gst_pipeline_new (NULL); //GstElement *src = gst_element_factory_make ("videotestsrc", NULL); GstElement *src = gst_element_factory_make ("filesrc","videosrc"); GstElement *glupload = gst_element_factory_make ("glupload", NULL); GstElement *decodebin = gst_element_factory_make("decodebin", NULL); /* the plugin must be loaded before loading the qml file to register the * GstGLVideoItem qml item */ GstElement *sink = gst_element_factory_make ("qmlglsink", NULL); g_assert (src && glupload && sink); g_object_set (G_OBJECT (src), "location", "/home/user/Downloads/small.mp4", NULL); gst_bin_add_many (GST_BIN (pipeline), src, decodebin, glupload, sink, NULL); gst_element_link_many (src, decodebin, glupload, sink, NULL); QQmlApplicationEngine engine; engine.load(QUrl(QStringLiteral("qrc:/main.qml"))); QQuickItem *videoItem; QQuickWindow *rootObject; /* find and set the videoItem on the sink */ rootObject = static_cast<QQuickWindow *> (engine.rootObjects().first()); videoItem = rootObject->findChild<QQuickItem *> ("videoItem"); g_assert (videoItem); g_object_set(sink, "widget", videoItem, NULL); rootObject->scheduleRenderJob (new SetPlaying (pipeline), QQuickWindow::BeforeSynchronizingStage); ret = app.exec(); gst_element_set_state (pipeline, GST_STATE_NULL); gst_object_unref (pipeline); } gst_deinit (); return ret;
so there is perhaps a problem with my debian 9 or it lacks a library
-
Do you get any error message on the console ?
-
Does it work if you follow GStreamer's Qt example ?
-
-
Then I would gradually modify the example until it does play the file you are trying to play with your code.
-
Hey @SGaist and @stephane78-0 ,
Did anyone managed to run that example with "filesrc" instead of "videotestsrc" ?This example works for me, but it uses "videotestsrc" as Source, but I would like to use "filesrc".
Because, I want to be able to use a custom video.I'm guessing that I need help with GStreamer, and not QT necessarily. But it's worth taking a shot.
-
you can try:
MediaPlayer{ id: playVideo source: "gst-pipeline: filesrc location=/home/root/skim-debris.mp4 ! qtdemux ! avdec_h264 ! qtvideosink" autoLoad: true autoPlay: true playbackRate: 1.0 loops: 10 } VideoOutput { anchors.fill: parent source: playVideo }