Capture SDL/OpenGL video output

Did anybody ever work out a way to capture the video
output from an SDL/OpenGL window and write to an
AVI file?

a1

mal content wrote:

Did anybody ever work out a way to capture the video
output from an SDL/OpenGL window and write to an
AVI file?

Change the SDL_SwapBuffers() function in SDL, add a glReadPixels() call
to read video memory to a buffer. Write that buffer to frame_XXX.pnm (or
whatever image format you see fit).
Then compress all these files to an avi file using a video encoding
program (for example, mencoder).

Stephane

Sounds good. I see I was thinking about the problem the wrong way!

I’ll give it a go.

Cheers,
a1On 2/17/06, Stephane Marchesin <stephane.marchesin at wanadoo.fr> wrote:

mal content wrote:

Did anybody ever work out a way to capture the video
output from an SDL/OpenGL window and write to an
AVI file?

Change the SDL_SwapBuffers() function in SDL, add a glReadPixels() call
to read video memory to a buffer. Write that buffer to frame_XXX.pnm (or
whatever image format you see fit).
Then compress all these files to an avi file using a video encoding
program (for example, mencoder).

Alternatively, if you’re into masochism, you could link your program
against ffmpeg (the library used by mencoder/mplayer, among others),
and directly output AVI-files. I recently received a patch for my game
to use that approach (it’s kind of hackish though). If you want to see
how it can be done, follow the instructions at:
http://www.aeruder.net/software/rpl2mpg.htmlOn 2/17/06, mal content <artifact.one at googlemail.com> wrote:

Change the SDL_SwapBuffers() function in SDL, add a glReadPixels() call
to read video memory to a buffer. Write that buffer to frame_XXX.pnm (or
whatever image format you see fit).
Then compress all these files to an avi file using a video encoding
program (for example, mencoder).

Sounds good. I see I was thinking about the problem the wrong way!


Regards,
Rasmus Neckelmann