Taking videos

Blitz3D Forums/Blitz3D Programming/Taking videos

mintybreath(Posted 2007) [#1]
Hi everyone, i was wondering if there was any easy way to be able to record video footage of my game within the game. I know all about Fraps and such, but i meen, make it so you click a button, and it records a video into a file, through the game, and not an external program.

I was just wondering, because i thought it would be pretty cool to add to games. I am making a 2d game and used the Savebuffer() command to take screenshots, then i thought taking videos would be cool.

Any help would be appreciated. Thanks. :)


Mr. Slat(Posted 2007) [#2]
Well then...instead of taking just one screenshot, make your program to take a screenshot each frame, and save it directly to the file....

just wondering if that wouldn't take a lot of the computers CPU?

I use this just for recording little clips for presentations in the intro...

i'll give you some hints that you can follow....

CopyRect 0, 0, GraphicsWidth(), GraphicsHeight(), 0, 0, BackBuffer(), ImageBuffer( Image )

Remember that it may be frontbuffer() instead of backbuffer(). depends in what you're using.

Then you can save the image to the file.

The next thing you'll need is to make a code that can recognize each image from the file, and draw them on your screen...you'll need millisecs() command to control the time for the next image to be drawn

Like: period = Millisecs()

if millisecs() > period + 500 then
-> Draw the next image



and that's it.....easy to talk but with hard work you'll do it :P


mintybreath(Posted 2007) [#3]
Ya, that idea did occur to me, but the only problem is, each frame would be saved as a picture, giving the user hundreds and hundreds of pictures. That wouldnt be so user friendly i think..

Unless there is someway to save them as a video file or something that i dont know about.


Mr. Slat(Posted 2007) [#4]
Well .Avi Files works like that.... that's why they're so big.....unless you know a way of compressing the images, you'll have to save each frame


Mr. Slat(Posted 2007) [#5]
Well...have you though in recording the sound....?

that won't be easy... I don't know a way of recording it.... there may be a dll for this

you should probably search for it...


Mr. Slat(Posted 2007) [#6]
Found this for you....

http://www.blitzbasic.com/codearcs/codearcs.php?code=845

or this one

http://www.blitzbasic.com/codearcs/codearcs.php?code=1111

There's some functions that may be of interest.....

you just have to sync the recorded sound with the clip...

remember that you can also make just one pic with a lot of frames Like image = createimage(GraphicsWidth(), GraphicsHeight(), 100), and count each frame to a variable x, and save it to imageBuffer(image, x)


mintybreath(Posted 2007) [#7]
Oh thanks alot mr slat. My game has no sound at the moment, so saving it as a .AVI file will work for now. Ill also try those dlls you got me. Thanks for all your help mr slat. :)


mintybreath(Posted 2007) [#8]
One more thing, this is kinda of off topic, but still has a bit to do with videos.

Is there any way to load videos into the game and play it through the program?

I am not sure if there is a way, but if there is that would be really helpful with something else i am doing.


jfk EO-11110(Posted 2007) [#9]
Hate to say it, but MCISendString is crap. Very unreliable IMHO. (at least for anything other than simple audio). Better use this one to save AVI:
http://www.blitzbasic.com/codearcs/codearcs.php?code=1661

Then again, I think it's a bad idea to record a game as a movie, because it will slow down the game unbearably. Games with a replay function use a macro recorder: simply store the user actions and the millisecs time when they happened (relative to when the game started) and then fake the game engine by "reusing" the recorded actions. For this you may do something simple as this:

if mode=replay then
 key1=mydata(1, count)
else
 key1=keydown(203)
endif

...
if key1 then navigate and so on