I'm trying to set-up a QVideoWidget in my app, but i get no audio/video. This is how i create the relevant objects:
m_player = new QMediaPlayer;
m_playlist = new QMediaPlaylist(m_player);
m_playlist->addMedia(QUrl::fromLocalFile("/home/username/Documents/test.mp4"));
m_widgetVideo = new QVideoWidget;
m_player->setVideoOutput(m_widgetVideo);
m_layout = new QHBoxLayout(this);
m_layout->addWidget(m_widgetVideo);
this->setLayout(m_layout);
m_playlist->setCurrentIndex(0);
m_player->play();
All i get is a black screen and no audio nor video. I don't know if I can post the MP4 file here (It's a test file downloaded from YouTube) so if anyone needs info about it, just ask me and I'll get it. Here is the result of running ffprobe on the test files: http://pastebin.com/xpMYbApY
QMediaPlayer->duration(); = -1
QMediaPlayer->supportedMimeTypes(); = ()
QMediaPlayer->errorString() = ""
Also, I have these gstreamer packages:
gstreamer0.10-alsa
gstreamer0.10-ffmpeg
gstreamer0.10-nice
gstreamer0.10-plugins-bad
gstreamer0.10-plugins-bad-multiverse
gstreamer0.10-plugins-base
gstreamer0.10-plugins-base-apps
gstreamer0.10-plugins-good
gstreamer0.10-plugins-ugly
gstreamer0.10-pulseaudio
gstreamer0.10-tools
gstreamer0.10-x
gst-launch-0.10 plays the files perfectly, does this means Qt actually can't find the installed GStreamer codecs?
The problem was the QMediaPlaylist. For some reason, it wasn't working. All I had to do to fix it was:
m_player->setMedia(QUrl::fromLocalFile("path/to/file"));