Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. 3rd Party Software
  4. Building Qt-GStreamer

Building Qt-GStreamer

Scheduled Pinned Locked Moved 3rd Party Software
8 Posts 5 Posters 11.8k 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.
  • M Offline
    M Offline
    MichaelR
    wrote on last edited by
    #1

    Hello,

    I have spent a few days resolving problems with qt-GStreamer and so I thought I would share my work so others might be able to benefit.

    This is more of a guide of how I built it but also leaves some questions that I don't know the answer to.

    GStreamer can grab many different sources of video and so is very useful as a plugin for
    use in Qt.

    I am using Qt 5.7.1 with GStreamer 1.10.2 (32-bit-developer)

    Download the qt-gstreamer Git Repository from here:
    https://cgit.freedesktop.org/gstreamer/qt-gstreamer

    You will need to have Git (https://git-scm.com/downloads) installed on your machine. I
    also use the nice GUI from Attlasian – Source Tree: https://www.atlassian.com/software/
    sourcetree

    Once you have qt-gstreamer downloaded to a directory, you will ned a lot of things
    installed in order to build it.

    You will need to install CMake from here:
    https://cmake.org/download/

    You obviously will need GStreamer. Qt-GStreamer didn’t like the 64bit version of
    GStreamer, so I would stick with the 32bit version (x86):
    https://gstreamer.freedesktop.org/data/pkg/windows/

    You also need to install Boost from here:
    http://www.boost.org/

    And also the Glib / GObject from GTK+ http://www.gtk.org/
    This wasn’t so straight forward because there isn’t an installer from gtk.org. You have to
    download MSYS2 installer from here:
    https://msys2.github.io/
    Then you have to run a few commands with MSYS2 to install everything. These are all the
    commands that I run that got it to work.
    pacman -Sy pacman
    pacman –Syu (keep running this until it says there is nothing left to update)
    pacman -S mingw-w64-x86_64-toolchain
    The last command installs the toolchain – don’t ask me what that is. There is more
    information here: https://blogs.gnome.org/nacho/2014/08/01/how-to-build-your-gtkapplication-
    on-windows/

    Now you should be ready to build qt-gstreamer!
    Open up a command line and cd to the qt-gstreamer directory.
    Now run:
    $ mkdir build && cd build
    $ cmake .. -G "Visual Studio 12 2013" -DCMAKE_INSTALL_PREFIX=\DEV
    \GStreamer\qt-gstreamer -DQT_VERSION=5 -Wno-dev

    This tells CMake to use QT Version 5 and to suppress the CMake warnings for developers
    and to use Visual Studio 2013 Cmake generator.
    If everything works then you should get a list of all the dependencies that you do have and
    a list of some things built by CMake. If it doesn’t work then you will get a list of missing
    Requirements on the command line and also in the build directory in a file called
    Requirements. If this happens, then install the missing requirements and delete everything
    in the build directory before trying again.

    Now you should have a full build directory. Open up the QtGStreamer.sln file in Visual
    Studio 2013 and choose Release Mode and then choose Build->Build Solution. This will
    build a lot of things. I still got a few build failures but it was usable enough for me.
    I wanted to run the QMLPlayer2 example, so I went straight to this solution:
    qt-gstreamer\build\examples\qmlplayer2
    and opened the qtgst-example-qmlplayer2.sln

    Now you can build that in release mode and you will have the executable in this directory:
    qt-gstreamer\build\examples\qmlplayer2\Release

    Run: QT_DIR\bin\Windeployqt.exe to pull in all the dependencies.
    $ cd QT_DIR\bin
    $ windeployqt.exe C:\DEV\qt-gstreamer\build\examples\qmlplayer2\Release

    This should fill up your qmlplayer2\Release folder with all the dll files and folders required
    to deploy the qmlplayer on another machine.

    For some reason this didn’t pull in all the dependencies for me and I had to manually add
    these folders:
    QT_DIR/qml/QtQuick2.0
    Also requires the QtGStreamer folder from
    qt-gstreamer\build\src\qml\quick2\QtGStreamer
    Requires Qt5OpenGL.dll file from QT_DIR\bin\Qt5openGL.dll
    GStreamer also requires this file in this directory but I don’t know where this comes from:
    C:\gstreamer\1.0\x86\lib\gstreamer-1.0\libgstqt5videosink.dll

    It is probably an extra installation option with GStreamer.

    If everything works then you should see a cartoon about a bunny start playing.

    Other notes: When I first ran this on my machine I got a green screen instead of the
    video. This turned out to be my Intel graphics card wasn’t good enough for it. Luckily I had
    another graphics card already installed on my machine I just wasn’t using it x-(

    Hope this helps somebody. Please contribute any further information.

    Regards,
    Michael

    A 1 Reply Last reply
    2
    • M MichaelR

      Hello,

      I have spent a few days resolving problems with qt-GStreamer and so I thought I would share my work so others might be able to benefit.

      This is more of a guide of how I built it but also leaves some questions that I don't know the answer to.

      GStreamer can grab many different sources of video and so is very useful as a plugin for
      use in Qt.

      I am using Qt 5.7.1 with GStreamer 1.10.2 (32-bit-developer)

      Download the qt-gstreamer Git Repository from here:
      https://cgit.freedesktop.org/gstreamer/qt-gstreamer

      You will need to have Git (https://git-scm.com/downloads) installed on your machine. I
      also use the nice GUI from Attlasian – Source Tree: https://www.atlassian.com/software/
      sourcetree

      Once you have qt-gstreamer downloaded to a directory, you will ned a lot of things
      installed in order to build it.

      You will need to install CMake from here:
      https://cmake.org/download/

      You obviously will need GStreamer. Qt-GStreamer didn’t like the 64bit version of
      GStreamer, so I would stick with the 32bit version (x86):
      https://gstreamer.freedesktop.org/data/pkg/windows/

      You also need to install Boost from here:
      http://www.boost.org/

      And also the Glib / GObject from GTK+ http://www.gtk.org/
      This wasn’t so straight forward because there isn’t an installer from gtk.org. You have to
      download MSYS2 installer from here:
      https://msys2.github.io/
      Then you have to run a few commands with MSYS2 to install everything. These are all the
      commands that I run that got it to work.
      pacman -Sy pacman
      pacman –Syu (keep running this until it says there is nothing left to update)
      pacman -S mingw-w64-x86_64-toolchain
      The last command installs the toolchain – don’t ask me what that is. There is more
      information here: https://blogs.gnome.org/nacho/2014/08/01/how-to-build-your-gtkapplication-
      on-windows/

      Now you should be ready to build qt-gstreamer!
      Open up a command line and cd to the qt-gstreamer directory.
      Now run:
      $ mkdir build && cd build
      $ cmake .. -G "Visual Studio 12 2013" -DCMAKE_INSTALL_PREFIX=\DEV
      \GStreamer\qt-gstreamer -DQT_VERSION=5 -Wno-dev

      This tells CMake to use QT Version 5 and to suppress the CMake warnings for developers
      and to use Visual Studio 2013 Cmake generator.
      If everything works then you should get a list of all the dependencies that you do have and
      a list of some things built by CMake. If it doesn’t work then you will get a list of missing
      Requirements on the command line and also in the build directory in a file called
      Requirements. If this happens, then install the missing requirements and delete everything
      in the build directory before trying again.

      Now you should have a full build directory. Open up the QtGStreamer.sln file in Visual
      Studio 2013 and choose Release Mode and then choose Build->Build Solution. This will
      build a lot of things. I still got a few build failures but it was usable enough for me.
      I wanted to run the QMLPlayer2 example, so I went straight to this solution:
      qt-gstreamer\build\examples\qmlplayer2
      and opened the qtgst-example-qmlplayer2.sln

      Now you can build that in release mode and you will have the executable in this directory:
      qt-gstreamer\build\examples\qmlplayer2\Release

      Run: QT_DIR\bin\Windeployqt.exe to pull in all the dependencies.
      $ cd QT_DIR\bin
      $ windeployqt.exe C:\DEV\qt-gstreamer\build\examples\qmlplayer2\Release

      This should fill up your qmlplayer2\Release folder with all the dll files and folders required
      to deploy the qmlplayer on another machine.

      For some reason this didn’t pull in all the dependencies for me and I had to manually add
      these folders:
      QT_DIR/qml/QtQuick2.0
      Also requires the QtGStreamer folder from
      qt-gstreamer\build\src\qml\quick2\QtGStreamer
      Requires Qt5OpenGL.dll file from QT_DIR\bin\Qt5openGL.dll
      GStreamer also requires this file in this directory but I don’t know where this comes from:
      C:\gstreamer\1.0\x86\lib\gstreamer-1.0\libgstqt5videosink.dll

      It is probably an extra installation option with GStreamer.

      If everything works then you should see a cartoon about a bunny start playing.

      Other notes: When I first ran this on my machine I got a green screen instead of the
      video. This turned out to be my Intel graphics card wasn’t good enough for it. Luckily I had
      another graphics card already installed on my machine I just wasn’t using it x-(

      Hope this helps somebody. Please contribute any further information.

      Regards,
      Michael

      A Offline
      A Offline
      ambershark
      wrote on last edited by
      #2

      @MichaelR I don't have need of this, but wanted to say thank you for the write up and sharing. :)

      My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

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

        Hi,

        You should maybe consider converting this to a Wiki article, forum posts don't stay visible in the long run.

        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
        • X Offline
          X Offline
          xrodpim
          wrote on last edited by
          #4

          Hi Michael.

          Are you getting success working with pipelines in you Qt GStreamer code?

          If yes, could you take a look in a question I asked today about third part tools, please?

          Any hint will be very helpful!

          Best regards.

          xrodpim

          1 Reply Last reply
          0
          • J Offline
            J Offline
            jward
            wrote on last edited by
            #5

            Thanks for sharing your guide. I don't know why I'm having a hard time building this on Windows 10. I ran:

            cmake .. -G "Visual Studio 14 2015" -DCMAKE_INSTALL_PREFIX=\Programs\GStreamer\qt-gstreamer -DQT_VERSION=5 -Wno-dev -DCMAKE_PREFIX_PATH=C:/Qt/5.11.0/msvc2015
            

            which succeeded until

            -- Could NOT find GLIB2 (missing: GLIB2_LIBRARIES GLIB2_MAIN_INCLUDE_DIR)
            -- Could NOT find GObject (missing: GOBJECT_INCLUDE_DIR GOBJECT_LIBRARIES)
            ...
            -----------------------------------------------------------------------------
            -- The following REQUIRED packages could NOT be located on your system.
            -- You must install these packages before continuing.
            -----------------------------------------------------------------------------
               * GLib  <http://www.gtk.org/>
                 Required to build QtGLib
               * GObject  <http://www.gtk.org/>
                 Required to build QtGLib
            

            I used MSYS2 to install GTK+ in C:\Programs\gtk\gtk-3.19 but I might not have the necessary environment variables or paths that must be defined. I don't know if they were supposed to be created during installation or if I'm supposed to create or define them.

            The file C:\Programs\qt-gstreamer\cmake\modules\FindGLIB2.cmake contains

            find_path(GLIB2_MAIN_INCLUDE_DIR glib.h
                      PATH_SUFFIXES glib-2.0
                      HINTS ${PKG_GLIB_INCLUDE_DIRS} ${PKG_GLIB_INCLUDEDIR})
            

            so to the environment variable "PKG_CONFIG_PATH" I added "C:\Programs\gtk\gtk-3.19\include" because glib.h is in "C:\Programs\gtk\gtk-3.19\include\glib-2.0".

            Something I found that doesn't seem right is what is in C:\Programs\gtk\gtk-3.19\lib\pkgconfig\glib-2.0.pc which contains

            prefix=/opt
            exec_prefix=${prefix}
            libdir=${exec_prefix}/lib
            includedir=${prefix}/include
            

            which makes this appear to be for linux, not my Windows installation.
            What seems to be more appropriate is what I found in C:\gstreamer\1.0\x86\lib\pkgconfig\glib-2.0.pc which contains

            prefix=/c/gstreamer/1.0/x86
            exec_prefix=${prefix}
            libdir=/c/gstreamer/1.0/x86/lib
            includedir=${prefix}/include
            

            but when I replaced the previous path with "C:\gstreamer\1.0\x86\lib\pkgconfig" in "PKG_CONFIG_PATH", this didn't change the symptoms.

            If you could let me know what I might be missing that would let cmake know where to find GLib/GObject, I'd appreciate it.

            1 Reply Last reply
            0
            • M Offline
              M Offline
              MichaelR
              wrote on last edited by
              #6

              Hi Jward,
              I can't remember having problems with this specifically.
              Only thing I could suggest if you have installed GLib and GObject is to manually define environment variables for GLIB2_LIBRARIES, GLIB2_MAIN_INCLUDE_DIR, GOBJECT_INCLUDE_DIR and GOBJECT_LIBRARIES.
              Regards,
              Michael

              1 Reply Last reply
              0
              • J Offline
                J Offline
                jward
                wrote on last edited by
                #7

                Thanks Michael. None of the variables you listed are in my environment. If they are in yours, where do they point? If you don't have them, they shouldn't be needed for cmake to be able to build the project but I'm obviously missing something .

                M 1 Reply Last reply
                0
                • J jward

                  Thanks Michael. None of the variables you listed are in my environment. If they are in yours, where do they point? If you don't have them, they shouldn't be needed for cmake to be able to build the project but I'm obviously missing something .

                  M Offline
                  M Offline
                  MichaelR
                  wrote on last edited by
                  #8

                  @jward I had rebuild this plugin today and had the same problem. I found that I had to include the GStreamer bin dir in my environment path.
                  I added this to my path and cmake configured correctly:
                  C:\gstreamer\1.0\x86\bin

                  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