[Solved][QML + Qt5]Video

  • Hello!
    I'm on Linux, and i've some troubles with QML and Multimedia module:
    I want to use a video as background in a QQuickView.

    @import QtQuick 2.0
    import QtMultimedia 5.0

    Rectangle {
    width: 300
    height: 300
    color: "black"

     MediaPlayer {
         id: mediaPlayer
         source: "movie.avi"
         autoPlay: true
     VideoOutput {
         id: video
         anchors.fill: parent
         source: mediaPlayer


    And this is what i saw in Qt doc, but i get this error:
    @GStreamer; Unable to play - ""
    Error: "No URI set" @

    I also try the qml video example (which looks similar) but i didn't get any error with it.
    ( http://qt-project.org/doc/qt-5.1/qtmultimedia/video-qmlvideo.html )

    Hope someone could help me..
    (In 2011 someone report this error as a bug in Qt: http://lists.qt.nokia.com/public/qt-mobility-feedback/2011-March/000977.html)

  • No idea ?

  • I was able to run this code on Ubuntu 12.04 with gstreamer 0.10.22 and Qt 5.1.
    Created project as both a QtQuick 2 application and as a QtQuick 2 UI application.
    When I moved the avi file out, application directory, I got the corect diagnostic - "GStreamer; Unable to play -" and the path to the avi file.

  • Ok. That's only when i import a qml file from a qrc.. but when i'm using QUrl::fromLocalFile() it works...

  • I had the same problem, could you advice on the solution?
    my code work in Qt Quick UI but not in Qt Quick Application.

    I could run MediaPlayer source, exact duplicate to your code
    on Qt Quick UI but on Qt Quick Application.

    int main(int argc, char *argv[ ])

    QGuiApplication app(argc,argv);
    QQmlApplicationEngine engine;
    return app.exec();


Log in to reply

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