Clutter Export

2009.08.19 in code, gnome, and summer of code

I had a painful experience trying to make the video of gnomines-clutter for my last post... it seems to be very hard to capture OpenGL apps under X with any reasonable framerate. Anyway... after finally getting one of the dozens of programs that I tried to work (I can't remember which one now...), I decided I'd try to fix the problem from a different angle.

I'm really only interested in exporting the output of Clutter views, mostly. So, I figured I'd hack up Clutter to output PNGs for each frame. I added a check for the CLUTTER_EXPORT_FRAMES environment variable (or the --clutter-export-frames argument); if it's set, I discard the system time and instead draw every frame (incrementing the master clock by 1/CLUTTER_DEFAULT_FPS, so that the "frame rate" of the output is adjustable). When clutter_stage_paint is called, I read the pixels of the stage and export them to incrementally-numbered PNGs in the current directory.

This should work in theory. In practice, for some reason, some animations randomly speed up or slow down. You can see it in the video (most specifically with the sliding bounces when you finish a level).

Video of Lights Off with this here.

Patch is here. It's not particularly attractive... but maybe once it works I'll make it make more sense...

I'll have to harass someone working on Clutter and see if we can make it work/what I'm doing that's so crazy, because I'd really love for it to work!

There's at least one other thing that needs to be taken into account: idle time. Since frames are only exported when the stage is painted, when you're just sitting there doing nothing, nothing is exported, so the video runs like you're very, very quick with the mouse :-) But I'll work on that later...

Anyway, this might all be crazy or pointless. If so, I apologize! In any case, it can't possibly be as crazy as Carol's first blog post in many months... which is quite entertaining and awesome all at the same time, and details from a layman's point of view what she worked on all summer (while making fun of most of our crew at the same time). It's nice to see her getting along with GCC, finally! :-)

Comments (legacy)

oskude

i have made good video captures of opengl apps with "glc".
but its website seems down ATM http://nullkey.ath.cx/projects/glc
here an article: http://linux.com/archive/feature/143775

Emmanuele Bassi

you're right: the patch is pretty evil. it's also going to cost you a lot in terms of performance.

personally, I've always found Istanbul worked fine for me for recording GL applications; others have used gtk-recordmydesktop whe Istanbul failed. the situation with recording applications is a bit dire — you have to try them all to find the one that works.

Aphax

I had to record output of an OpenGL program as well the other day and gtk-recordmydesktop failed to record the OpenGL window, while istanbul seemed to use a very low bitrate that I didn't seem to be able to adjust anywhere. After a small mishap with Istanbul where it saved the movie I recorded as ~/Desktop (i.e. replacing the directory with a file) deleting some important files, I pretty much just gave up and went to Windows and used fraps :/

Didn't try glc though, I might give that a try next time

Richard

Sorry to be annoying, but would it be possible to see the video in Theora? I haven't licensed a QuickTime decoder yet (though I suppose Flumotion might offer one?).