QVideoWidget not working with QVideoProbe
-
So I tried out the example in https://doc.qt.io/qt-5/qvideoprobe.html.
I set the video output to a QVideoWidget I created.
For some reason, some videos do not show up and QVideoWidget stays as a black screen.
If I delete the line "probe->setSource(player);", then it shows up again.
I checked with different kind of videos, and I think mp4 videos that have a framerate of 30fps or more aren't showing up.
Did anyone else have this problem? If so, how did you solve it?
Yes, I did not make the slot processFrame(QVideoFrame), but I don't think that is the source of the problem.Qt Version 5.15.2
MSVC2019 64bit
Windows 10
Using Windows Media Foundationmainwindow.cpp
#include "mainwindow.h"
#include "ui_mainwindow.h"MainWindow::MainWindow(QWidget *parent)
: QMainWindow(parent)
, ui(new Ui::MainWindow)
{
ui->setupUi(this);QMediaPlayer *player = new QMediaPlayer(); QVideoProbe *probe = new QVideoProbe; connect(probe, SIGNAL(videoFrameProbed(QVideoFrame)), this, SLOT(processFrame(QVideoFrame))); probe->setSource(player); player->setVideoOutput(ui->widget); player->setMedia(QUrl::fromLocalFile("C:/Users/user/Desktop/028.mp4")); player->play();
}
MainWindow::~MainWindow()
{
delete ui;
} -
Hi and welcome to devnet,
What are you doing in your processFrame slot ?
-
Does it happen with all video files ?
-
@SGaist No. It happens to only some of the files. Some files I could play with no problem, but some aren't. Most video files that had this problem had a framerate of 30. Video files with lower framerates had no problems. I don't think resolution is the problem, because I tried with small resolution videos with 30 fps and it still wasn't working.
Edit: Tried the same example with my other computer, and it's working well. Both computers are Windows 10.
-
Different set of codecs ?