I'm trying to make a simple videoplayer using qt. However, I can't get the videowidget example that comes with qt to work, instead I get an error: "The QMediaPlayer object does not have a valid service". I'm using windows vista. Can I get the videos to play normally, even if that example isn't working? Is there any other simple way to test playing videos? Or is this a problem with qt?
-
1+1. I think it is useful if people are aware of the intended behavior, explained on the qt bugtracker as well. It is somewhat unfortunate though. – László Papp Jan 03 '14 at 00:42
-
Note that if anyone is here looking for the solution to this problem under linux, it can be caused by missing the libqt5multimedia5-plugins, apt-get install this fixed it for me. – Owl Feb 20 '22 at 00:40
2 Answers
Check this VideoWidget I created: https://github.com/MaximAlien/VideoWidget. The main thing here is that the video should be in web and QMediaPlayer handles everything for you. Example works with Qt 5 and higher.

- 51,870
- 39
- 111
- 135

- 2,197
- 1
- 22
- 26
This is expected on your Vista, unfortunately. See the relevant post from the maintainer:
On Windows XP, Qt Multimedia uses DirectShow (and WMF for Windows Vista and later). The DirectShow plugin binary is not included in the Qt 5.0 package (only the WMF plugin is). You need to compile QtMultimedia yourself, or just the DirectShow plugin in qtmultimedia/src/plugins/directshow
... in the following report on the Qt issue tracker:
Qt 5.0 and QMediaPlayer failure on Windows XP
The steps to build it on your would be:
- grab the tarball
- unpack it
- move into the qtmultimedia folder
- run qmake -r
- (n)make
- (n)make install
Please make sure qmake is properly in your PATH before doing this.

- 51,870
- 39
- 111
- 135
-
1Thanks, that explains why it doesn't work. How can I compile qt multimedia myself? – user2942080 Jan 03 '14 at 10:48
-
1Yes, finally after some difficulties I managed to get the example to work. Thank you so much for your help! – user2942080 Jan 04 '14 at 11:18
-
After compiling QtMultimedia, i rebuild my project and ran, however, it told me that directshow thread initializing failed. I'm using win10, and it used to work fine. What could be the reasons? – Nya Jun 12 '15 at 12:09