Qt World Summit: Submit your Presentation

[Solved] QGraphicsVideoItem plays media but not QVideoWidget

  • Hi,

    I've tested the two qt multimedia examples (see below) but only the QGraphicsVideoItem example works not QVideoWidget example.
    I've installed all the necessary libraries and plugins. I'm not suspecting that i'm still missing some plugins because one of the examples works.
    So my question is : why the QGraphicsVideoItem example works but not QVideoWidget example ?

    I'm using Qt 5.2.

    QVideoWidget example : (doesn't work, got "Internal data stream error")

    QMediaPlayer * player = new QMediaPlayer;

            QVideoWidget * videoWidget = new QVideoWidget;


    QGraphicsVideoItem example : (works)

    QGraphicsView * graphicsView = new QGraphicsView;
    QMediaPlayer * player = new QMediaPlayer;

            QGraphicsScene * scene = new QGraphicsScene;
            QGraphicsVideoItem *item = new QGraphicsVideoItem;



  • No idea ? I've tested the two codes on Windows 7 and all is fine with QGraphicsVideoItem but i just can heard the sound but no video is diplayed with QVideoWidget ...

  • Moderators


    I don't know the exact details, but it's possible that QGraphicsVideoItem and QVideoWidget use different backends.

    See http://stackoverflow.com/questions/21458581/playing-videos-with-qmediaplayer-qvideowidget-in-qt5-2 -- What version of OpenGL does your machine support?

    Try a non-OpenGL package of Qt (See http://qt-project.org/downloads and download a package without "OpenGL" in its name).

  • Thanks for your reply.

    Here is the OpenGL version supported by my card :
    OpenGL Version: 2.1 Chromium 1.9

    So as it's said in the discussion you provided "It needed a video card that supports OpenGL Version 2.1 or more", i think that it would work for me !?

    I've downloaded the non-OpenGL package. This one "Qt 5.2.1 for Linux 64-bit (368 MB)":http://download.qt-project.org/official_releases/qt/5.2/5.2.1/qt-opensource-linux-x64-5.2.1.run

  • Moderators

    Is this in a physical machine or virtual machine? There seems to be graphics/video issues in VMs (e.g. see http://qt-project.org/forums/viewthread/38002/ )

  • Unfortunately for me, i was testing in a virtual machine. I'll test on a physical machine ...

  • Indeed, the problem was related to the VM !
    It works perfectly on a physical machine !
    I'll maybe investigate after on what was wrong with the VM ...

    Thanks for all.

Log in to reply