Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Building with Gstreamer on Windows

Building with Gstreamer on Windows

Scheduled Pinned Locked Moved Solved Installation and Deployment
32 Posts 2 Posters 10.3k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • SGaistS Offline
    SGaistS Offline
    SGaist
    Lifetime Qt Champion
    wrote on last edited by
    #6

    @erikherz said in Building with Gstreamer on Windows:

    PKG_CONFIG_PATH

    should contain paths to folder containing .pc files.

    Just an educated guess but pkg-config was likely not developed with Windows in mind when it was released.

    Interested in AI ? www.idiap.ch
    Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

    1 Reply Last reply
    0
    • erikherzE Offline
      erikherzE Offline
      erikherz
      wrote on last edited by erikherz
      #7

      OK. I found it here:
      C:>dir "C:" /s /b /d | find ".pc"
      ...
      C:\gstreamer\1.0\x86_64\lib\pkgconfig\x264.pc
      C:\gstreamer\1.0\x86_64\lib\pkgconfig\zlib.pc
      ... etc
      and set it here but got the same error:
      ..set_path.png

      1 Reply Last reply
      0
      • SGaistS Offline
        SGaistS Offline
        SGaist
        Lifetime Qt Champion
        wrote on last edited by
        #8

        Did you also modify the PATH environment variable so that pkg-config can be found by Qt Creator ?

        Interested in AI ? www.idiap.ch
        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

        1 Reply Last reply
        0
        • erikherzE Offline
          erikherzE Offline
          erikherz
          wrote on last edited by
          #9

          Done. Same error.
          update_path.png

          1 Reply Last reply
          0
          • erikherzE Offline
            erikherzE Offline
            erikherz
            wrote on last edited by erikherz
            #10

            I did not build qt-gstreamer on any platform. It compiled as-is on Linux and MacOS with the Gstreamer installs but perhaps I need to build an install this as per this article?

            https://forum.qt.io/topic/74652/building-qt-gstreamer

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #11

              Path contains a folder list, not full executable path.

              There's no need to build QtGstreamer which is deprecated by the way.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              1
              • erikherzE Offline
                erikherzE Offline
                erikherz
                wrote on last edited by
                #12

                Path updated. Still no luck.
                new_path.png

                1 Reply Last reply
                0
                • SGaistS Offline
                  SGaistS Offline
                  SGaist
                  Lifetime Qt Champion
                  wrote on last edited by
                  #13

                  Did you force a re-run of qmake after these modifications ?

                  Interested in AI ? www.idiap.ch
                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                  1 Reply Last reply
                  0
                  • erikherzE Offline
                    erikherzE Offline
                    erikherz
                    wrote on last edited by
                    #14

                    According to this article, yes:
                    https://forum.qt.io/topic/34055/how-does-qtcreator-know-when-to-re-run-qmake/5

                    I re-started QT Creator and made a point of changing the .pro file. It re-parse and reset.

                    ... same error.

                    1 Reply Last reply
                    0
                    • erikherzE Offline
                      erikherzE Offline
                      erikherz
                      wrote on last edited by
                      #15

                      I did a clean install of QT Creator with the MSVC Gstreamer installers and got past that initial error. Now my error is in the Gstreamer integration code. I consider this progress!
                      Screen Shot 2020-03-13 at 9.40.18 AM.png

                      1 Reply Last reply
                      0
                      • erikherzE Offline
                        erikherzE Offline
                        erikherz
                        wrote on last edited by
                        #16

                        Making some progress. Now it is compiling after I added:

                        LIBS += -lgstvideo-1.0

                        Now we are trying to get gstreamer to find its own plugins:

                        14:31:17: Starting C:\GIT\build-slim-Desktop_Qt_5_14_1_MinGW_64_bit-Debug\slim.exe ...

                        (slim.exe:4476): GStreamer-WARNING **: 14:31:24.371: Failed to load plugin 'C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0\gstopenh264.dll': 'C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0\gstopenh264.dll': The specified procedure could not be found.

                        (slim.exe:4476): GStreamer-WARNING **: 14:31:25.826: Failed to load plugin 'C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0\gstsrt.dll': 'C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0\gstsrt.dll': The specified procedure could not be found.
                        WARNING: no real random source present!
                        14:31:30: C:\GIT\build-slim-Desktop_Qt_5_14_1_MinGW_64_bit-Debug\slim.exe exited with code 1

                        1 Reply Last reply
                        0
                        • erikherzE Offline
                          erikherzE Offline
                          erikherz
                          wrote on last edited by
                          #17

                          This does the trick for making sure that Gstreamer finds its own plugins:
                          gstreamer_plugins.png

                          1 Reply Last reply
                          1
                          • erikherzE Offline
                            erikherzE Offline
                            erikherz
                            wrote on last edited by
                            #18

                            Also here is my win32 block in my .pro file for reference:

                            win32 {
                                INCLUDEPATH += \
                                               c:\gstreamer\1.0\x86_64\include \
                                               c:\gstreamer\1.0\x86_64\lib\gstreamer-1.0\include \
                                               c:\gstreamer\1.0\x86_64\include\gstreamer-1.0 \
                                               c:\gstreamer\1.0\x86_64\include\glib-2.0 \
                                               c:\gstreamer\1.0\x86_64\include\glib-2.0\glib \
                                               c:\gstreamer\1.0\x86_64\include\glib-2.0\include
                            
                            
                                DEPENDPATH += c:\gstreamer\1.0\x86_64\lib
                            
                                LIBS += -Lc:\gstreamer\1.0\x86_64\lib
                                LIBS += c:\gstreamer\1.0\x86_64\lib\glib-2.0.lib
                                LIBS += -lglib-2.0 -lwinpthread -lgstreamer-1.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0
                                LIBS += -lgstvideo-1.0
                            
                                CONFIG += c:\gstreamer\1.0\x86_64\lib\pkgconfig
                            }
                            
                            1 Reply Last reply
                            1
                            • SGaistS Offline
                              SGaistS Offline
                              SGaist
                              Lifetime Qt Champion
                              wrote on last edited by
                              #19

                              Looks like pkg-config did not work correctly but still... the manual way did work !

                              Glad you found a way and thanks for sharing !

                              Interested in AI ? www.idiap.ch
                              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                              1 Reply Last reply
                              0
                              • erikherzE Offline
                                erikherzE Offline
                                erikherz
                                wrote on last edited by
                                #20

                                Also for Windows, I needed to use d3dvideosink or autovideosink rather than glimagesink

                                It builds and renders the Gstreamer sample video.

                                Now my issue is getting it to stay within the application window rather than popping out into its own new window.

                                I got this error:

                                ** (slim_qt.exe:5908): CRITICAL **: 16:15:15.218: gst_video_overlay_set_window_handle: assertion 'overlay != NULL' failed
                                

                                So I added:

                                    qDebug() << "slim_qt:gst() xwinid = " + QVariant(xwinid).toString();
                                

                                and got this:

                                "slim_qt:gst() xwinid = 1770362"
                                

                                So I am wondering why gst_video_overlay_set_window_handle failed.

                                1 Reply Last reply
                                0
                                • SGaistS Offline
                                  SGaistS Offline
                                  SGaist
                                  Lifetime Qt Champion
                                  wrote on last edited by
                                  #21

                                  You might want to take a look at the GStreamer backend plugin. With recent versions of Qt you can build custom pipelines and make them output to a Qt video widget naming the sink properly.

                                  Interested in AI ? www.idiap.ch
                                  Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                  1 Reply Last reply
                                  0
                                  • erikherzE Offline
                                    erikherzE Offline
                                    erikherz
                                    wrote on last edited by
                                    #22

                                    I would love to learn more about that. May I have a pointer to a doc? A quick search did not turn up an obvious resource for me.

                                    1 Reply Last reply
                                    0
                                    • erikherzE Offline
                                      erikherzE Offline
                                      erikherz
                                      wrote on last edited by erikherz
                                      #23

                                      I got it to land in the QWidget. The trick was to call .show() before calling winId().

                                      Here is the final .pro:

                                      QT       += core gui multimediawidgets
                                      
                                      greaterThan(QT_MAJOR_VERSION, 4): QT += widgets
                                      
                                      CONFIG += c++11
                                      
                                      DEFINES += QT_DEPRECATED_WARNINGS
                                      
                                      SOURCES += \
                                          main.cpp
                                      
                                      HEADERS +=
                                      
                                      CONFIG += link_pkgconfig
                                      
                                      PKGCONFIG += gstreamer-1.0 \
                                              glib-2.0 \
                                              gobject-2.0 \
                                              gio-2.0
                                      
                                      linux {
                                          PKGCONFIG += gstvideo-1.0
                                          LIBS += -L/usr/lib/i386-linux-gnu/ -lgstvideo-1.0
                                      }
                                      
                                      mac {
                                          PKG_CONFIG = /usr/local/bin/pkg-config
                                          PKGCONFIG += gstreamer-video-1.0
                                      }
                                      
                                      win32 {
                                          INCLUDEPATH += c:/gstreamer/1.0/x86_64/include \
                                                         c:/gstreamer/1.0/x86_64/lib/gstreamer-1.0/include \
                                                         c:/gstreamer/1.0/x86_64/include/gstreamer-1.0 \
                                                         c:/gstreamer/1.0/x86_64/include/glib-2.0 \
                                                         c:/gstreamer/1.0/x86_64/include/glib-2.0/glib \
                                                         c:/gstreamer/1.0/x86_64/include/glib-2.0/include
                                      
                                      
                                          DEPENDPATH += c:/gstreamer/1.0/x86_64/lib/
                                      
                                          LIBS += -Lc:/gstreamer/1.0/x86_64/lib
                                          LIBS += c:/gstreamer/1.0/x86_64/lib/glib-2.0.lib
                                          LIBS += -lglib-2.0 -lwinpthread -lgstreamer-1.0 -lgobject-2.0 -lgmodule-2.0 -lgthread-2.0
                                          LIBS += -lgstvideo-1.0
                                      
                                          CONFIG += c:/gstreamer/1.0/x86_64/lib/pkgconfig
                                      }
                                      
                                      # Default rules for deployment.
                                      qnx: target.path = /tmp/$${TARGET}/bin
                                      else: unix:!android: target.path = /opt/$${TARGET}/bin
                                      !isEmpty(target.path): INSTALLS += target
                                      
                                      

                                      and main.cpp:

                                      #include <QApplication>
                                      #include <QFrame>
                                      #include <QTimer>
                                      #include <QDebug>
                                      #include <QLabel>
                                      #include <QWidget>
                                      #include <QVBoxLayout>
                                      #include <gst/gst.h>
                                      #include <QtDebug>
                                      
                                      #include <gst/video/videooverlay.h>
                                      
                                      /* added to work on OSX */
                                      #ifdef __APPLE__
                                      #ifdef TARGET_OS_MAC
                                      #include <glib/deprecated/gthread.h>
                                      #endif
                                      #endif
                                      
                                      void gst(int argc, char *argv[]) {
                                      
                                         gst_init (&argc, &argv);
                                         QApplication app(argc, argv);
                                         app.connect(&app, SIGNAL(lastWindowClosed()), &app, SLOT(quit ()));
                                      
                                      
                                         // prepare the pipeline
                                         /*
                                            GstElement *pipeline =
                                                    gst_parse_launch
                                                    (
                                                        "videotestsrc is-live=true ! d3dvideosink",
                                                    NULL);
                                             GstElement *sink  =  gst_bin_get_by_name(GST_BIN(pipeline), "sink");
                                         */
                                      
                                            GstElement *pipeline = gst_pipeline_new ("xvoverlay");
                                            GstElement *src = gst_element_factory_make ("videotestsrc", NULL);
                                            GstElement *sink = gst_element_factory_make ("d3dvideosink", NULL);
                                            gst_bin_add_many (GST_BIN (pipeline), src, sink, NULL);
                                            gst_element_link (src, sink);
                                      
                                      
                                            // prepare the ui
                                      
                                         QWidget window;
                                      
                                         QLabel *label = new QLabel("Hi");
                                         QWidget *widget = new QWidget();
                                      
                                          QVBoxLayout qboxLayout;
                                          qboxLayout.addWidget(label);
                                          qboxLayout.addWidget(widget);
                                          window.setLayout(&qboxLayout);
                                      
                                          window.resize(320, 240);
                                          window.show();
                                      
                                      
                                              WId xwinid = widget->winId();
                                              qDebug() << "slim_qt:gst() xwinid = " + QVariant(xwinid).toString();
                                      
                                              gst_video_overlay_set_window_handle (GST_VIDEO_OVERLAY (sink), xwinid);
                                      
                                         // run the pipeline
                                      
                                         GstStateChangeReturn sret = gst_element_set_state (pipeline,
                                             GST_STATE_PLAYING);
                                         if (sret == GST_STATE_CHANGE_FAILURE) {
                                           gst_element_set_state (pipeline, GST_STATE_NULL);
                                           gst_object_unref (pipeline);
                                           // Exit application
                                           QTimer::singleShot(0, QApplication::activeWindow(), SLOT(quit()));
                                         }
                                      
                                         app.exec();
                                      
                                      }
                                      
                                      int main(int argc, char *argv[])
                                      {
                                          gst(argc, argv);
                                          return true;
                                      }
                                      

                                      and project build ENV settings:

                                      Set GSL_PLUGIN_PATH to C:\gstreamer\1.0\x86_64\lib\gstreamer-1.0
                                      Set GSTREAMER_INCDIR to C:\gstreamer\1.0\x86_64\include\gstreamer-1.0
                                      Set GSTREAMER_LIBDIR to C:\gstreamer\1.0\x86_64\lib
                                      Set PKG_CONFIG_PATH to C:\gstreamer\1.0\x86_64\lib\pkgconfig\
                                      
                                      Add to Path: C:\gstreamer\1.0\x86_64\bin\
                                      
                                      1 Reply Last reply
                                      0
                                      • SGaistS Offline
                                        SGaistS Offline
                                        SGaist
                                        Lifetime Qt Champion
                                        wrote on last edited by
                                        #24

                                        QMediaPlayer::setMedia for thé documentation itself.

                                        You might even be able just build the GStreamer backend and use it directly.

                                        Interested in AI ? www.idiap.ch
                                        Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                                        1 Reply Last reply
                                        0
                                        • erikherzE Offline
                                          erikherzE Offline
                                          erikherz
                                          wrote on last edited by
                                          #25

                                          I thought that QMediaPlayer used native AV Foundations (Windows Media Foundation for Windows, AV Foundation for MacOS, and GStreamer for Linux) ... does this mean that I can now use a gst-pipeline source for QMediaPlayer in an App on Windows or Mac?

                                          1 Reply Last reply
                                          0

                                          • Login

                                          • Login or register to search.
                                          • First post
                                            Last post
                                          0
                                          • Categories
                                          • Recent
                                          • Tags
                                          • Popular
                                          • Users
                                          • Groups
                                          • Search
                                          • Get Qt Extensions
                                          • Unsolved