Problem displaying videos with qmediaplayer and qvideowidget
Lilie 0 last edited by
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
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 ?
Lilie 0 last edited by Lilie 0
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();
Are your test videos available somewhere ?
Lilie 0 last edited by Lilie 0
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.
NVD3DREL: Failed to run Algo 0 of Stream 0
That looks like a Nvidia driver error, so there might be something to look at.