Question

I mainly code using the Qt library, which is cross-platform enough for my need. However, I found out that if I'd like to play a video file there are no good options for cross-platform video playback. The Phonon module doesn't seem to work on my machine and I am not sure if it is supported on the major platforms (Windows, OSX, Linux).

Are their any light-weight alternatives for simple video playback? I would be okay to change my video to any format as long as its playable cross-platform.

Was it helpful?

Solution 2

I found the Theora playback library to be very useful and only depends on the original theora library. Here is a simple Qt project I made that encapsulate everything needed to play (only video) theora media. You just type 'qmake' and you are good to go.

OTHER TIPS

I am considering libVLC as one option. Someone have already made a wrapper but it only supports Windows and Linux.

According to the documentation is appears Phonon needs third party libraries to work correctly. Have you installed the appropriate backend to the platform you're on?

From the documentation:

Backends

The multimedia functionality is not implemented by Phonon itself, but by a back end - often also referred to as an engine. This includes connecting to, managing, and driving the underlying hardware or intermediate technology. For the programmer, this implies that the media nodes, e.g., media objects, processors, and sinks, are produced by the back end. Also, it is responsible for building the graph, i.e., connecting the nodes. The backends of Qt use the media systems DirectShow (which requires DirectX) on Windows, QuickTime on Mac, and GStreamer on Linux. The functionality provided on the different platforms are dependent on these underlying systems and may vary somewhat, e.g., in the media formats supported.

Backends expose information about the underlying system. It can tell which media formats are supported, e.g., AVI, mp3, or OGG.

A user can often add support for new formats and filters to the underlying system, by, for instance, installing the DivX codex. We can therefore not give an exact overview of which formats are available with the Qt backends.

QtWebKit 2.2 has support for HTML5 media. It should (at least eventually) be pretty cross-platform, but probably has the same backend issues as Phonon. But a Q(Graphics)WebView with a <video> element could do the trick for a truly play-and-forget solution.

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