Recording game play

I'm not sure if this is the correct place to ask the question, but it does say "ask newbie questions" so here goes.

I've seen a few videos online of people recording game play or videos of academic simulations. I was wondering if anyone knows how that's done? Is it something that people code themselves or are the applications that will record video from a window?

It's not to difficult to output TGA, BMP or TIFF files every frame but this can slow your app down on an older computer. An easier way to do this is just to use software like snapz pro: http://www.ambrosiasw.com/utilities/snapzprox/ or something like it.

It depends on the quality you need. The easiest method with vaguely ok quality is to take the S-Video output of a Mac into a suitable video camera input or video capture box/card into another Mac. It's not particularly hi-def (actually it's pretty lo-def) but usually the frame rate is watchable. Rather handy for debugging btw

There are capture apps (I think Ambrosia's Snapz records video), but they tend to be more useful for office apps and not so good for recording gameplay.

If you need to do serious gameplay capture for promos etc. then there are some pretty high end capture rigs that syncronise to the video output and capture in hi-def. but They're expensive! (assuming Apple don't build them into iMovie at WWDC today of course)

It's C++, threaded, and requires boost; If that doesn't turn you off ( there's a lot of c++ haters out there ), it should be easy-enough to separate from the rest of the framework, should you want to integrate it.

Hey TomorrowPlusX, that's excellent! It's been a while since I looked through your game framework. I was thinking about writing a movie capture class just a few weeks ago but decided against it because the whole screenshot thing is so slow that I couldn't imagine actually doing a movie! So I have some questions for you:

1) is it actually fast enough to be of any real use (even without compression)?
2) it appears that all of your movie stuff is in the recording group, is this true?
3) you don't mind if I rip off your recording code do you? I'd have to re-write it to exorcize the C++ of course... (I don't hate C++, I just can't/won't work with it.)

AnotherJake Wrote:Hey TomorrowPlusX, that's excellent! It's been a while since I looked through your game framework. I was thinking about writing a movie capture class just a few weeks ago but decided against it because the whole screenshot thing is so slow that I couldn't imagine actually doing a movie! So I have some questions for you:

1) is it actually fast enough to be of any real use (even without compression)?
2) it appears that all of your movie stuff is in the recording group, is this true?
3) you don't mind if I rip off your recording code do you? I'd have to re-write it to exorcize the C++ of course... (I don't hate C++, I just can't/won't work with it.)

It's all yours! Do with it what you will.

Answers:

#1) The performance is good, but not great. IIRC I can capture 800x600 on my MBP at 30fps without stress -- a better programmer than me would be able to make it faster. That being said, compression is done by Qt on a separate thread while grabbing. As a side note, I experimented with direct serialization of the framebuffer to disk, and I was bottlenecked by my MBP's hard drive write speed. The bottleneck now is Qt's compression. I profiled the actual grab of pixels and was able easily to get 60fps in fullscreen (IIRC, again). It's doing something with that data that is trouble.

#2) More or less correct. 99% of it's in there, but there are likely a few helper bits outside. Shouldn't be impossible to extract.

#3) It's your pet peeve. My warning: I'm using boost for smart pointers and threading. I use smart pointers pervasively, so you'll have to take that into consideration. Boost.threads will be easily replaced with pthreads. If I were you, I'd just write a C wrapper to it...

I know people have their reasons to hate C++ , but hell, I say use the right language for the job. I use C, C++, ObjC and python all the time.

Awesome! Looks like it's worth the trouble then. I'll probably look closely through the code since I'm curious how you did it anyway. Looking at your screenshot code, your coding style/problem solving is very similar to mine, so I might be able to figure out what you're doing with the movie code. I might just write a wrapper for it though, as per your suggestion, I don't know. I can easily use pthreads so that won't be a problem. Heck my stuff's almost always threaded already anyway, so Cocoa is already in threaded mode (thinking out loud). I might just be able to drop it in. We'll see. It's not high on my priority list at the moment, but movie capturing has been something I've been thinking about. Hopefully I can get to it within a week or two.

2) My last provably successful recording was made may 3rd ( the creation date of the demo recording I linked to ).

3) I checked out of SVN the last version of SGF before may 3rd, and it crashes, too.

I guess there is no step four. All I can tell is that it used to work, and now it doesn't. I've spent the last hour and half picking through my svn changelog and can't find anything I've done since may 3rd which even *touched* my recording code. Once I got recording working reliably, I basically left it alone.