Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

QMediaPlayer not showing Video on Raspberry Pi, works fine on Windows



  • Hello,
    I'm trying to play a video in a qt application, running on a raspberry pi 4. The application compiles and I can run it, but the window is blanc. Also no errors.

    When I compile and run the same project on Windows on the other hand, the video plays.

    My code inside of the MainWindow-Constructor is:

        ui->setupUi(this);
    
        QMediaPlayer *player = new QMediaPlayer;
    
        player->setMedia(QUrl("qrc:/videos/small.mp4"));
    
        QVideoWidget *videoWidget = new QVideoWidget;
        setCentralWidget(videoWidget);
        player->setVideoOutput(videoWidget);
        player->play();
    

    The video file is in the project folder, but also on the pi, in the same directory as the executable. Am I missing some linux Packages on the Pi?


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    Can you play that file with GStreamer on your Pi ?
    Which version of Qt are you using ?
    Are you cross-compiling ?


Log in to reply