Qt and Gstreamer

  • Hi all,

    I try to develop a QT application including Gstreamer on windows.

    I had download GStreeamer 1.6.3 (normal and dev ) packages for windows and installed them.

    Gstreamer alone work well. I try the following command and all is ok :
    C:\gstreamer\1.0\x86\bin>gst-launch-1.0.exe videotestsrc pattern=0 ! autovideosink

    So I try to include Gstreamer in my QT application. I use QT 5.4.1 with mingw

    To fix __gxx_personality_v0 link error, i remove stdc++.lib,libstdc++.la, and libstdc++.dll.a from gstreamer directory.

    Here is my pro

    # Project created by QtCreator 2016-01-19T10:06:45
    QT       += core gui
    greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
    TARGET = QtGstreamerPlayer
    TEMPLATE = app
    win32 {
        CONFIG(debug, debug|release): message("QT_CONFIG= debug")
        else: message("QT_CONFIG= release")
    CONFIG(debug, debug|release){
        DESTDIR = $${OUT_PWD}/bin/
    CONFIG(release, debug|release){
        DESTDIR = $${OUT_PWD}/bin/
    #message("Dest DIR= $${DESTDIR}")
    INCLUDEPATH += c:/gstreamer/1.0/x86/include \
            C:/gstreamer/1.0/x86/lib/gstreamer-1.0/include \
            c:/gstreamer/1.0/x86/include/gstreamer-1.0 \
            c:/gstreamer/1.0/x86/include/glib-2.0/glib \
    LIBS += -Lc:/gstreamer/1.0/x86/lib
    LIBS += -lglib-2.0 -lwinpthread -lgstreamer-1.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0
    CONFIG += c:/gstreamer/1.0/x86/lib/pkgconfig
    SOURCES += main.cpp\
    HEADERS  += qtgstreamerplayer.h
    FORMS    += qtgstreamerplayer.ui

    and source

    #include "qtgstreamerplayer.h"
    #include <QApplication>
    #include <QGuiApplication>
    #include <gst/gst.h>
    #include "QDebug"
    int main(int argc, char *argv[])
       #if 1
        QGuiApplication app(argc, argv);
        GstElement *pipeline;
        GstBus *bus;
        GstMessage *msg;
    //        putenv("GST_PLUGIN_PATH_1_0=E:\\sdk\\gstreamer\\1.0\\x86_64\\lib\\gstreamer-1.0\\");
    //        putenv("GST_PLUGIN_PATH=E:\\sdk\\gstreamer\\1.0\\x86_64\\lib\\gstreamer-1.0\\");
        /* Initialize GStreamer */
        gst_init (&argc, &argv);
        /* Build the pipeline */
        GError *Gerror = NULL;
        //pipeline = gst_parse_launch ("ksvideosrc device-index=0 ! autovideosink", &Gerror); // Windows OS specific
        //gst-launch-1.0.exe videotestsrc pattern=0 ! autovideosink
        pipeline = gst_parse_launch("videotestsrc pattern=0 ! autovideosink", &Gerror);
        QString str(Gerror->message);
        qDebug() << "gst_parse_launch error: " << str;
        if (!pipeline) {
             qDebug() << "pipeline empty error =  " << str;
            exit (1);
        if (!str.isEmpty())
            qDebug() << "gst_parse_launch error: " << str;
           exit (1);
        /* Start playing */
        gst_element_set_state (pipeline, GST_STATE_PLAYING);
        /* Wait until error or EOS */
        bus = gst_element_get_bus (pipeline);
        msg = gst_bus_timed_pop_filtered (bus, GST_CLOCK_TIME_NONE, (GstMessageType)(GST_MESSAGE_ERROR | GST_MESSAGE_EOS));
        /* Free resources */
        if (msg != NULL)
          gst_message_unref (msg);
        gst_object_unref (bus);
        gst_element_set_state (pipeline, GST_STATE_NULL);
        gst_object_unref (pipeline);
        return app.exec();
        QApplication a(argc, argv);
        QtGstreamerPlayer w;
        return a.exec();

    The application compile well but when I try to start the pipeline with gst_parse_launch I had this error : "no element "videotestsrc""

    I suspect something wrong in gst_init. I had some warning for some dll not loaded

     GStreamer-WARNING **: Failed to load plugin 'C:\gstreamer\1.0\x86\lib\gstreamer-1.0\libgstvideoconvert.dll': 'C:\gstreamer\1.0\x86\lib\gstreamer-1.0\libgstvideoconvert.dll': The specified module could not be found.

    but don't understand why only some dll failed and some other successed. ( all the dll are present in this path) and I am not sure if this is really the issue.

    Is anyone have some experience making Qt application with Gstreamer on windows?

    Thans a lot

  • Hi ooznerol,
    This question is old but same you, when i asked for gstreamer, i never had answer.
    But i find something should help you (this helped me also):
    First, there is package make libray link with gstreamer-0.10 and gstreamer-1.x
    This link show how to call/link the library the easy way.
    hope this help.

Log in to reply

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.