Question

I have been trying to play video formats *.wmv, *.mp4 with QMediaPlayer and QVideoWidget in Qt5.2. I just followed the expample and here is my code:

mp =new QMediaPlayer(this);
vw = new QVideoWidget(this);
QMediaPlaylist* playlist = new QMediaPlaylist(this);
playlist->addMedia(QUrl::fromLocalFile("C:/Users/Public/Videos/Sample Videos/Wildlife.wmv"));
playlist->setCurrentIndex(1);
mp->setPlaylist(playlist);
mp->setVideoOutput(vw);
setGeometry(100,100,400,500);
vw->setGeometry(0,0,300,400);
show();
play();

I have installed the K-Lite codecs. When I play the same files using Media Player Classic or Win Media Player the files play well and the the Lca and FFmpeg icons show up in the tray.

But with Qt 5.2 I am not able to see any visuals for any video file. Only for wmv files I am able to hear audio(no visual).

I have searched a lot on the web and everybody points to codecs which I believe I have. Does the configuration of the K-Lite codecs matter? I have used the default codecs. I have built Qt with the Win media foundation too. So I am at a loss to understand what is wrong here. Platform is win7 32. Any help is appreciated. Do let me know if I have to reading anything or any article or blog. Thank you.

Was it helpful?

Solution

It was the video card. It needed a video card that supports OpenGL Version 2.1 or more. Once I upgraded the video card to GeForce 210 which supports OpenGL 3.3 and installed the default K-Lite Codecs I was able to play all videos and audio.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top