Important: Please read the Qt Code of Conduct -

Unable to play QML video

  • Hi,

    I have a desktop development environment (Ubuntu 18.04.3 LTS 64-bit, Qt 5.11.3 GCC) and a Yocto-based embedded Linux environment. Qt 5.11.3 is cross-compiled for the embedded device, which runs my Qt application ok, with the exception of QML video.

    I made a barebones project to test and illustrate this point. See below code (I've left out various default .pro defines and QML includes, etc.).

    QT += quick multimedia


    import QtMultimedia 5.9
    Window {
        visible: true
        width: 800
        height: 480
        Video {
            anchors.fill: parent
            source: "demonstration.mp4"
            autoPlay: true
            loops: MediaPlayer.Infinite

    On my Ubuntu desktop this compiles and runs as expected. However, on my embedded device, the MainWindow remains blank (white) and the video never plays. Here is the command line output when I try to run the application on the embedded device (./VideoTest -platform eglfs:

    QML debugging is enabled. Only use this in a safe environment.
    QEglFSVivIntegration will set environment variable FB_MULTI_BUFFER=2 to enable d                                                                        ouble buffering and vsync.
     If this is not desired, you can override this via: export QT_EGLFS_IMX6_NO_FB_M                                                                        ULTI_BUFFER=1
    [   24.999865] mxc_sdc_fb fb@0: 800x480 h_sync,r,l: 72,24,96  v_sync,l,u: 7,3,10                                                                         pixclock=29500000 Hz
    Unable to query physical screen size, defaulting to 100 dpi.
    To override, set QT_QPA_EGLFS_PHYSICAL_WIDTH and QT_QPA_EGLFS_PHYSICAL_HEIGHT (i                                                                        n millimeters).
    qt.qpa.input: X-less xkbcommon not available, not performing key mapping
    ====== AIUR: 4.4.5 build on Nov 17 2019 07:42:13. ======
            Core: MPEG4PARSER_06.16.01  build on Dec 11 2018 03:04:05
     file: /usr/lib/imx-mm/parser/
        Track 00 [video_0] Enabled
            Duration: 0:02:36.350354000
            Language: und
            video/x-h264, parsed=(boolean)true, alignment=(string)au, stream-format=                                                                        (string)avc, width=(int)800, height=(int)480, framerate=(fraction)30/1, codec_da                                                                        ta=(buffer)014d4029ffe10015674d402995a0320f6c04400000fa40003a9803d2a801000468ee3                                                                        c80
        Track 01 [audio_0] Enabled
            Duration: 0:02:36.373333000
            Language: und
            audio/mpeg, mpegversion=(int)4, channels=(int)2, rate=(int)48000, bitrat                                                                        e=(int)128000, stream-format=(string)raw, codec_data=(buffer)1190
    ====== BEEP: 4.4.5 build on Nov 17 2019 07:42:15. ======
            Core: AAC decoder Wrapper  build on Dec  7 2017 18:13:49
     file: /usr/lib/imx-mm/audio-codec/wrap/
    CODEC: BLN_MAD-MMCODECS_AACD_ARM_03.09.00_CORTEX-A8  build on Sep 20 2017 15:02:                                                                        14.
    [INFO]  bitstreamMode 1, chromaInterleave 0, mapType 0, tiled2LinearEnable 0

    The console becomes unresponsive (i.e. I can't Ctrl+C out of the application).

    It's also worth noting that I can play the video without issue on the embedded device with gst-launch-1.0, so the Gstreamer plugins I've included in my Yocto build seem to be working, but Qt for some reason doesn't work/use them? Here are the relevant sections in my local.conf file in my Yocto build:

    IMAGE_INSTALL_append = " \
        qtbase \
        qtsvg \
        fontconfig \
        qtcharts \
        qtdeclarative \
        qtgraphicaleffects \
        qtquickcontrols2 \
        qtquickcontrols \
        qtmultimedia \
        qtmultimedia-plugins \
        qtmultimedia-qmlplugins \
        imx-gpu-viv \
        gstreamer1.0-plugins-imx \
        packagegroup-fsl-tools-gpu \
        packagegroup-fsl-gstreamer1.0 \
        packagegroup-fsl-gstreamer1.0-full \
        imx-gst1.0-plugin \
        gst1.0-fsl-plugin \
        gstreamer \
        gstreamer1.0 \
        gstreamer1.0-libav \
        gstreamer1.0-meta-base \
        gstreamer1.0-plugins-bad \
        gstreamer1.0-plugins-base \
        gstreamer1.0-plugins-good "
    PREFERRED_VERSION_gstreamer1.0 = "1.12.imx"
    PREFERRED_VERSION_gstreamer1.0-plugins-base = "1.12.imx"
    PREFERRED_VERSION_gstreamer1.0-plugins-good = "1.12.imx"
    PREFERRED_VERSION_gstreamer1.0-plugins-bad = "1.12.imx"
    LICENSE_FLAGS_WHITELIST = 'commercial'
    PACKAGECONFIG_append_pn-qtmultimedia = " gstreamer"
    DISTRO_FEATURES_remove = "x11 wayland vulkan"

    I spent 8+ hours yesterday trying different gstreamer plugin combinations, and experienced the same white screen, with no error, on a number of different options. I've searched all over the web, and have seen countless QtMultimedia video playback issues, but none of the solutions I've found have worked.

    I've just checked my QtMultimedia configuration in my Qt 5.11.3/Src directory on the Ubuntu desktop, which shows that Video For Linux is being used, and GStreamer (0.10 and 1.0) are not configured?

    Qt Multimedia:
      ALSA ................................... yes
      GStreamer 1.0 .......................... no
      GStreamer 0.10 ......................... no
      Video for Linux ........................ yes
      OpenAL ................................. no
      PulseAudio ............................. yes
      Resource Policy (libresourceqt5) ....... no
      Windows Audio Services ................. no
      DirectShow ............................. no
      Windows Media Foundation ............... no

    This might explain why it works fine on Ubuntu (using Video For Linux) but not on the embedded device? How can I rebuild qtmultimedia to include GStreamer1.0?

    Does the above configuration look like the culprit?

  • Lifetime Qt Champion


    Are you cross-compiling Qt ?
    If so, do you have the Gstreamer development packages for your Yocto build ?
    What is your current configure line ?

  • Hi @SGaist

    I'm building as per this guide.

    As per my original post, I include all the (seemingly) necessary Gstreamer packages in my Yocto build, which seems to work as I can play the file with gst-launch-1.0, but not within Qt. It would seem that the missing GStreamer1.0/0.10 support in the QtMultimedia module should be to blame, given that that source is used in the cross-compile toolchain?

  • Lifetime Qt Champion

    @jars121 said in Unable to play QML video:

    given that that source is used in the cross-compile toolchain?

    But did you install the GStreamer development packages in your sysroot/Yocto build? Without them Qt will not be able to use GStreamer.

  • Do you have an example of one of the GStreamer development packages? I've added the various GStreamer options to my local.conf file, which is all I thought was needed (from posts such as this). There's obviously an additional step that I'm not quite understanding.

Log in to reply