This document guides you through the process of building, installing, and using Qt5GStreamer on Windows.
Setting up dependencies
Boost is required to build and use Qt5GStreamer. Set up is rather simple. Download the .zip from the boost.org website, extract it, and set the environment variable BOOST_ROOT to the root directory of the boost installation(C:\boost\boost_1_63_0). Verify this is correctly set up by opening a command prompt and typing
dir %BOOST_ROOT%\libs. You should see a bunch of directories.
Download and install at least the runtime and development files from the Gstreamer web site. Set both environment variables GSTREAMER_ROOT_X86 and GSTREAMER_1_0_ROOT_X86 to the installation directory(C:\gstreamer\1.0\x86). Add %GSTREAMER_ROOT_X86%\bin to your PATH. Verify you have this set up correctly by opening a command prompt and type
gst-launch-1.0 -h. You should see the usage output from the gst-launch command.
You will need CMake to configure and build Qt5GStreamer. Download and install it from the CMake website.
If chose to add cmake to your PATH, verify it is correctly set up by opening a command prompt and typing
cmake -version. You should see the version of cmake printed on the screen.
Using the default install path of "C:/Program Files (x86)/QtGStreamer" can cause problems because of the special characters in the path, and special permissions required, so we'll install it to C:\QtGStreamer.
- Set environment variable QTGSTREAMER_ROOT to C:\QtGStreamer
- Download source via:
git clone https://github.com/GStreamer/qt-gstreamer
- Start Qt Creator and open CMakeLists.txt. Switch to Projects and edit the Build Settings. Under the CMake section, edit CMAKE_INSTALL_PREFIX and set it to %QTGSTREAMER_ROOT%. Edit QT_VERSION and set it to 5. Click on "Apply Configuration Changes". Under Build Steps, click on Details, and select the target "install".
- Build the project.
- Finally, add %QTGSTREAMER_ROOT%\bin to PATH to complete the set up.
Verify Qt5GStreamer is properly built and installed by opening a command prompt and typing
dir %QTGSTREAMER_ROOT%\bin. You should see some .dll files starting with Qt5G.
If you're going to use cmake, you're all set. If you want to use qmake, there are additional steps to set up.
Installing and setting up pkg-config
There are several ways to set up pkg-config. Some set-ups are complicated, and some don't work :-/ Fortunately, I found a simple set up that works. Download pkg-config-lite from https://sourceforge.net/projects/pkgconfiglite/files/
Unzip, and add the bin directory to your path. Verify this is set up correctly by opening a command prompt and typing
pkg-config --help. You should see the help for pkg-config.
Set PKG_CONFIG_PATH to %GSTREAMER_ROOT_X86%\lib\pkgconfig;%QTDIR%\lib\pkgconfig;%QTGSTREAMER_ROOT%\lib\pkgconfig. Verify pkg-config can find Qt5Streamer-1.0 by opening a command prompt and typing
pkg-config --cflags Qt5GStreamer-1.0. You should not see any errors. If you see errors, you will need to resolve them. If you're using the MSVC compiler, check the MSVC section below.
Using Qt5GStreamer via PKGCONFIG in .pro file
Add the following to .pro file:
CONFIG += link_pkgconfig PKGCONFIG += Qt5GStreamer-1.0 Qt5GStreamerUi-1.0 QT += widgets INCLUDEPATH += $$(BOOST_ROOT)
Try opening the example .pro included with the qt-gstreamer source, make some edits, and try to build it. If you can build and run the example, you're all done.
Edit two files under %QTGSTREAMER_ROOT%\lib\pkgconfig. Qt5Glib.pc and Qt5GStreamerUi.pc: comment Qt5Core and Qt5Widgets. pkg-config can't find them because they don't exist for MSVC.
As a general rule, don't mix 32 and 64 bit, debug and release, libraries.