Tuesday, September 22, 2009

Using Clutter and Gstreamer for Media Playback

I have been watching the clutter toolkit for sometime and putting together a couple of demo apps at the same time just to see what it can do. So with Fedora 12, there is a new clutter 1.0. Unfortunately none of my old demo apps work, so clutterdesk and couple of other thing would need to be converted to the clutter 1.0 api. So when I feel like it I'll probably get around to do it. But what was most interesting to me in clutter 1.0 was the new ClutterMedia actor. So I installed the components to use it, and it is based on GStreamer (which finally appears to produce pretty decent output for most media items).

So I created a simple playback area and actually had two videos (one ogg and the other quicktime) playing on a single "stage" with about 30ish lines of code. Could just play the media, but it seemed to work quite well.

Next was to see what it would take to get some information about the media. This was actually the difficult part, but luckily I was able to dig thru the totem code and find the information I needed.

Next was to create a gnome-mplayer like gui for it, but since I was playing with new toys, I decided to use GtkBuilder to do it. I used glade3 to create an XML file that gtkbuilder could read. As a side note, having Glade3 produce an include .h file that contained the XML in a const gchar would be a nice improvement, that way you could just include the .h file and go, nothing else to ship.

Had a few issues figuring out how to use it, but after awhile, I got it and produced something that looks like this. (This is the Harry Potter and the Half Blood Prince trailer, that I have stored locally).

Looks a lot like gnome-mplayer and I think I have about 4-6hrs into learning how to do all this. It is quite interesting and the toolkits are quite well thought out. So I'll continue to play with this demo on and off and see what comes out.

If you would like the code, I would be happy to email it to you.


brainstorm said...

Hi Kevin ! I'm actually interested on your clutter 1.0+gst code, could you please send it to me at brainstorm at nopcode org ?

Thanks !

Kevin said...


I actually created a new google code project for the code. So you can download the code from SVN there.


Rafa said...

Hello Kevin, which version of clutter-gst are are you using?
I am using clutter-1.0 and clutter-gst-0.8 and it's not working at all.


Kevin said...

rpm -qa clutter\* | sort

I think I posted in the changelog that you need clutter 1.2 or higher due to the usage of features only in 1.2. And clutter-gst 1.0

I'll enforce that in the configure.ac file.