Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Problem displaying videos with qmediaplayer and qvideowidget
QtWS25 Last Chance

Problem displaying videos with qmediaplayer and qvideowidget

Scheduled Pinned Locked Moved Unsolved General and Desktop
6 Posts 2 Posters 3.2k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lilie 0
    wrote on last edited by
    #1

    Hello,

    This is my first post also I hope I did it at the right place. I am encoutering some issues when I try to display videos, also any idea would be welcome considering that I have already spent hours searching a solution on the internet.
    So here is the issue:
    I use two QVideoWidget and two QMediaplayer to display two videos at the same time. My app was working quite fine on windows but not with 4K videos and I couldn't solve the problem... I guess it might have been a problem with the codecs used.
    I decided to try on linux and with Ubuntu 16.04 I have no issues for playing two 4K videos. I set the QVideoWidget size because I want each video to fill one quarter of the screen. The problem is that some times the video isn't displayed at the right size. It occupies only a small part of the QVideoWidget.
    Have you any idea about what could cause this ? I don't see why the same code would some times work and some times not...
    Thank you for your time reading this

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi and welcome to devnet,

      What version of Qt are you using ?
      What exact platform are you running on ?
      What video format are you trying to use ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      0
      • L Offline
        L Offline
        Lilie 0
        wrote on last edited by Lilie 0
        #3

        Hello,

        Thank you for your answer.
        I am using Qt 5.8.0 (but I also tried 5.9.1) on linux 64 bits with Ubuntu 16.04 LTS and for the graphic card I have Gallium 0.4 on NVE7.
        For the video formats I have mp4 and mov.
        I can read both with a qmediaplayer and a qvideowidget but sometimes they don't fill the qvideowidget completely (it also happens that the qvideowidget remains totally black or white). To be able to play de videos I had to install some gstreamer packages.
        If I change the size of the qvideowidget with the mouse the video gets often resized at the right size. Considering this I have tried to resize the qvideowidget in my code but it changed nothing.

        I had no such problem on windows 7 (64bits) with Qt 5.8.0 MinGW 32 bit. I had just to install codecs (KLite Pack Full 13.3.0) to be able to read videos. Only on windows I couldn't play two 4K videos at the same time and I have never found a solution... (I was using the same computer). I just had this warning: "NVD3DREL: Failed to run Algo 0 of Stream 0" that could appear but not every time and I didn't found any revelant information on what I may do to correct this and I am not sure it was concerning the impossibility to read 4k videos.

        Here is the part of the code that I am using for the players, if it can help:

        //        //first player
                _videoWidget1 = new QVideoWidget;
                _videoWidget1->setWindowFlags(Qt::FramelessWindowHint);
                _mediaPlayer1 = new QMediaPlayer;
                _mediaPlayer1->setMuted(true);
                _mediaPlayer1->setMedia(QUrl::fromLocalFile(_pathVideo1));
                _mediaPlayer1->setVideoOutput(_videoWidget1);
                _videoWidget1->setGeometry(0,0,_screenWidth/2,_screenHeight/2);
                _videoWidget1->show();
                _mediaPlayer1->play();
        
                //second player
                _videoWidget2 = new QVideoWidget;
                _videoWidget2->setWindowFlags(Qt::FramelessWindowHint);
                _mediaPlayer2 = new QMediaPlayer;
                _mediaPlayer2->setMuted(true);
                _mediaPlayer2->setMedia(QUrl::fromLocalFile(_pathVideo2));
                _mediaPlayer2->setVideoOutput(_videoWidget2);
                _videoWidget2->setGeometry(0,_screenHeight/2,_screenWidth/2,_screenHeight/2);
                _videoWidget2->show();
                _mediaPlayer2->play();
        
        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #4

          Are your test videos available somewhere ?

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • L Offline
            L Offline
            Lilie 0
            wrote on last edited by Lilie 0
            #5

            Hello,

            They aren't available but I already tried with a very wide range of different videos and the bug did appeared with all of them.
            I got an improvment on windows. I deployed the app and when I run it, it can play two 4k videos. It is not alway very smooth and it can happen that a video
            doesn't appear but at least it is working. Strange that it isn't working when compiling but only with the exec...
            I tried to deploy it on linux too but no improvment this time.

            1 Reply Last reply
            0
            • SGaistS Offline
              SGaistS Offline
              SGaist
              Lifetime Qt Champion
              wrote on last edited by
              #6

              @Lilie-0 said in Problem displaying videos with qmediaplayer and qvideowidget:

              NVD3DREL: Failed to run Algo 0 of Stream 0

              That looks like a Nvidia driver error, so there might be something to look at.

              Interested in AI ? www.idiap.ch
              Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

              1 Reply Last reply
              0

              • Login

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • Users
              • Groups
              • Search
              • Get Qt Extensions
              • Unsolved