Update to pygame-based video capture on Linux

I've been improving my vidcap tool for games that use pygame on Linux. If anyone wants to test it out and give me feedback, that would be great!

Download vidcap.py

0. Install dependencies: sudo apt-get install imagemagick vorbis-tools mencoder
 
1. Recording. Place vidcap.py into your source directory. Within your game, import it with "import vidcap". Then the recording will start when you call pygame.init(). That's all there is to it. (For best synchronization results, import vidcap before any of your other modules.)

2. Encoding. When you're done, simply run vidcap.py as "python vidcap.py" or whatever. This will create an AVI in the vidcap directory called vidcap.avi. Watch and enjoy!

If you want to try it out, I suggest recording and encoding a short clip before doing your whole walkthrough, to make sure everything looks right.


Features I haven't added yet:
  • The ability to stop and start the recording during the game.
  • Capture the mouse cursor.
  • Video acceleration. This is a feature where even if your computer only runs the game at 10fps, you can still record a video of what it would look like if it were running at 25fps. (You can't just speed up the video because the audio would get messed up, but I have an elaborate workaround.)

(log in to comment)

Comments

Any chance of a pyglet version or is it just better to use a dedicated recorder such as fraps
Unfortunately I don't know the first thing about pyglet, but I'd work on it if someone could help me. Basically I would only need the ability to do three things:
  1. Get a current timestamp with millisecond resolution 
  2. Save the current window to an image file
  3. Direct the audio stream to a file.

I suspect that, like with pygame, the first two are very easy and will take a few minutes to set up, and #3 would require an elaborate hack for which I wouldn't even know where to begin. If someone wants to figure out #3 for me I would definitely be willing to try to get it working with pyglet.

If you don't need to record sound, I could probably manage a version by myself.