Building Qt-GStreamer



  • 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


  • Moderators

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


  • Lifetime Qt Champion

    Hi,

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



  • 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


Log in to reply
 

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