Qt Mobility QtMultimediaKit vs Phonon

Recently, we had to use a Qt media library for a software consulting project. After doing some research and considering non-Qt libraries or embedding VLC, we decided to use Qt’s native solutions. Several websites (e.g. http://colin.guthr.ie/2010/05/qt-multimediamobility-vs-phonon-fight/) and even Qt (http://doc.qt.digia.com/qtmobility/multimedia.htmlhttp://blog.qt.digia.com/2009/09/09/multimedia-in-qt-whats-the-story/) have mentioned that Phonon is no longer being actively developed and Qt Mobility’s QtMultimediaKit is the way to go. In fact, Phonon will no longer be supported in Qt 5. However, we found out that Qt Mobility may not be quite ready for stable development.

Qt Mobility does not come standard with the Qt libraries binary release, which most Visual Studio developers use. So it has to be downloaded from here (yes, it’s the latest development branch so clearly it’s not that stable). When we tried to build the release from here it had a bug that would not allow it to compile with Qt 4.8.3. The gitorious version built correctly. And our tool built correctly. However, it failed to play our multimedia. The reason is that it attempts to use Window’s newer WPF (this was on Windows 7) backend to play multimedia. This backend is newer than DirectShow but it doesn’t as easily support all of the media formats that DirectShow supports (https://bugreports.qt-project.org/browse/QTMOBILITY-2066). If you’re using MPEG-4 or another new format, however, you should be fine but even then, Phonon is currently easier to use.

We needed to play a format that WPF doesn’t support so we rebuilt Qt Mobility with DirectShow support by downloading the DirectShow SDK and building the DirectShow libraries (already a difficult task on its own). You’re now ready to build Qt Mobility but if you’re using Visual Studio 2010 or later, you’ll run into this issue: http://qt-project.org/forums/viewthread/18016. The solution in that article solves that problem. But Qt Mobility still won’t detect that DirectShow libraries are available and so you’ll have to force the build in the DirectShow directory, which isn’t difficult.

However, even after all of this work, Qt Mobility still insisted on using WPF instead of DirectShow to play the video. So, though with some more work, it may have been possible to solve all of the issues, at this point we concluded Qt Mobility was probably not stable enough for an operational release and reassessed our possible solutions.

We decided to give Phonon a shot since it was included in Qt’s binary libraries release. In terms of code, Phonon is almost identical to Qt Mobility’s multimedia library so this was very easy to try. It just required a small qmake .pro file change (add Qt += phonon) and very minor code modifications. And Phonon played right out of the box.

So currently, if you’re developing operational software, we would recommend for you to stick with Phonon instead of the recommended Qt Mobility (the name is deceiving but it is meant for all platforms including desktop). Of course, Qt 5 is going to be released very shortly and hopefully will solve all of these issues with Qt Mobility. Even if it doesn’t, it will most likely be resolved very quickly since Qt Mobility’s inclusion in Qt 5 will mean it will get much more usage. But for now, we say, stick with Phonon!

Leave us a comment if you want some more information!

Leave a Reply