Capturing OpenGL Output to Movie

I need to capture the output of my OpenGL app to a movie.

The solution needs to work on Windows and OS X.

Is there some sample code showing how to do this anywhere?

Also, what video formats are recommended? I’m currently leaning towards Quicktime but I’m open to suggestions.

The way I’ve created movies from my OpenGL programs in the past is to output each frame to a file (using PBOs and glReadPixels), then compile the frames into a movie using mencoder.

How?

I have a directory called “frames” which contains TGA files, then I run:

mencoder mf://frames/*.tga -mf fps=60 -ofps 60 -o out.mpg -ovc x264 -x264encopts bitrate=5000

This is no programmatic solution, but mencoder is available for multiple platforms…