Redirecting SDL video output to a movie file

Hello,

I have an application that uses simple SDL commands (nothing fancy like
3D or anything) to display 2D animations in Linux. I would like to
capture this video without having to use a video capture program such as
xvidcap.

I know there is a SaveBMP functions and I could in theory save every
frame to a file and then use another program to encode it as a movie.
However, the performance is terrible.

So my question is: is there a better way to do this? Could I get the
state of the screen at each frame (as a bitmap or other image data
structure) and use another library to make the video file as frames come
in? Has anybody done this? What would you recommend?

Thanks,
Marc–
When someone says, “I want a programming language in which I need only
say what I want done,” give him a lollipop.
– Alan Perlis

If you have a lot of time to read up on it, you could try integrating Ogg Theora encoding…

My DarkPlaces Quake1 engine saves Intel 4:2:0 codec (i420) .avi files directly, with no external libraries, and support for multi-gigabyte files - a necessity when saving in that raw format takes 1.5
bytes per pixel per frame, usually meaning tens of megabytes per minute (but still half of what RGB raw takes) - it’s the perfect format for transcoding at least.

That AVI code in DarkPlaces was FAR from easy, I wish there was an easy library for this sort of thing…

Marc Lanctot wrote:> Hello,

I have an application that uses simple SDL commands (nothing fancy like
3D or anything) to display 2D animations in Linux. I would like to
capture this video without having to use a video capture program such as
xvidcap.

I know there is a SaveBMP functions and I could in theory save every
frame to a file and then use another program to encode it as a movie.
However, the performance is terrible.

So my question is: is there a better way to do this? Could I get the
state of the screen at each frame (as a bitmap or other image data
structure) and use another library to make the video file as frames come
in? Has anybody done this? What would you recommend?

Thanks,
Marc


Forest ‘LordHavoc’ Hale
Author of DarkPlaces Quake1 engine and mod
http://icculus.org/twilight/darkplaces/
Address: 94340 Horton Road Blachly OR 97412
Phone/Fax: 541-925-4130