I'm trying to play a movie using the QT Multimedia framework (5.0.1), but I only get a black screen with a mov coded with H.264.
int main(int argc, char *argv[])
{
QApplication a(argc, argv);
QWidget *mainWidget = new QWidget();
mainWidget->setGeometry(0,0, 1920, 1080);
QVideoWidget *widget = new QVideoWidget(mainWidget);
widget->setGeometry(0, 0, 1920, 1080);
QMediaPlayer *player = new QMediaPlayer;
QUrl localUrl = QUrl::fromLocalFile("test_mov.mov");
player->setMedia(localUrl);
qDebug() << "Player error state -> " << player->error();
qDebug() << "Media supported state -> " << QMediaPlayer::hasSupport("video/mov");
player->setVideoOutput(widget);
mainWidget->show();
player->play();
return a.exec();
}
The code compiles correctly and gives the following output on console, while the video widget remains black:
Player error state -> QMediaPlayer::NoError
Media supported state -> 1 // means "Probably supported"
I'm using Qt 5.0.1 on a Mac OSX 10.7.5. The file is correctly played by the player and ffmpeg -i test_mov.mov gives
Duration: 00:00:02.52, start: 0.000000, bitrate: 63708 kb/s Stream #0:0(eng): Video: h264 (Main) (avc1 / 0x31637661), yuv420p, 1920x1080, 63684 kb/s, SAR 1745:1920 DAR 349:216, 25 fps, 25 tbr, 25 tbn, 50 tbc
Does anyone knows what are the formats supported by QT Multimedia ?
Thank you