Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Luke Miklos

video instead of screenshot????

This topic is 5343 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

anybody ever make a vid of their opengl app??? using just the computer of course... I figure it would be a lot more complicated than just taking a screenshot, but I was just wondering if anybody has done this or talked about doing this???

Share this post


Link to post
Share on other sites
Advertisement
Well for starters, you should probly learn how to take screenshots, second a video is just a bunch of still frames. So why dont you just take 20-30 screenshots per second(very slow as far as i know) then use your program(or some animation software) to save the files togeather into a video.

P.S. Im sorry for being so vague, i havent actualy implemented a system this way im just saying how i would do it if i had.

[edited by - HippieHunter on March 4, 2004 10:28:07 PM]

Share this post


Link to post
Share on other sites
Well, you would have to know how to use either directshow or windows AVI functions. One of nehe''s lessons gives a good head start. I happen to like directshow, so what I would do would be to
make a call to glReadPixels() every frame, and write my own routines to convert the raw RGB data into the appropriate pixel format for the frames of the movie, and pass it into the AVI functions. (or, in my case, a custom directshow filter).

Keep in mind that your framerate will be really, really bad, because glReadPixels is painfully slow, as is converting and writing real-time video. As an interesting side effect, If you are running some sort of timing system to make sure the performance is the same on different machines, then you are going to have to override it with the framerate for the video file. Remember that you are not rendering in real time anymore.

heres y. If you are rendering at 10 frames/sec, with a timing mechanism, then a moving ball moving at 1 unit per second will be 1 unit away after 1 second. If you render into a 30 frames/second avi file, when you play it back, the first thirty frames of the file will be recorded from the first 30 frames of the demo. However, those 30 frames will represent 3 seconds of data at 10 frames/sec, but they will be played in the avi file as 1 second of data at 30 frames/sec. thus, if the timing mechanism is allowed to account for a slow framerate, the avi file will be 3x too fast (at least in my demo)

whew...sorry about all that

Share this post


Link to post
Share on other sites
I made a video system for my screen shot system. The only problem with them is they are slow. Before running the video system I was getting around 600 FPS on my terrain engine, when I was in "Video Mode" it ran around 30 FPS (This is also applying a watermark to every frame also). It all depends on the codec you choose while making the video. If you create the video without any codecs (Uncompressed) it will run a lot faster, but who wants to download a 500mb video for a 30 second clip.

Anyway, here's the steps I took to create it:
A) To start out you need to include the video for windows header and library. (VFW.h and VFW32.lib)

B) After that I started out by creating a stucture to hold the video data. The video data would be the streams (The main stream, stream information, compression stream, etc), the video dimensions, etc. Heres how I created the video data structure:

struct VIDEODATA
{
PAVISTREAM Stream; //--The videos stream

bool VideoOK; //--Make sure the video process has no errors

PAVIFILE VideoFile; //--The video file

unsigned int VideoWidth; //--The videos frame width

unsigned int VideoHeight; //--The videos frame height

int NumberOfFrames; //--Current number of frames in the video

AVISTREAMINFO StreamInformation; //--The video streams information

PAVISTREAM CompressionStream; //--The videos compression stream

bool AllowCodecSelection; //--Allows manual selection of the codec

bool UseTransparentColor; //--Using a transparent color in the watermark

WATERMARKTRANSPARENTCOLOR TransparentColor; //--The watermarks transparent color

};


C) Then I created four prototypes to handle the video functions needed.

void BeginMovieCapture(char* Filename, bool AllowCodecSelection = true, bool EnableInProcessFlag = false);
//NOTE: EnableInProcessFlag is used so the statistics get

//turned off so the FPS and what not doesn't get captured.

//

void BeginMovieCaptureW(char* Filename, bool AllowCodecSelection = true, bool EnableInProcessFlag = false, char* Watermark = NULL, WATERMARKPOSITION WatermarkPosition = WP_BOTTOMLEFT, float Strength = 0.2f, bool UseTransparentColor = false, WATERMARKTRANSPARENTCOLOR TransparentColor = WATERMARKTRANSPARENTCOLOR(0));
//

void UpdateMovieCapture(unsigned int FramesPerSecond = 30);
//

void EndMovieCapture(void);

BeginMovieCapture(*) creates the AVI file, initializes it, and then opens it.

BeginMovieCaptureW(*) is the same as BeginMovieCapture(*) but sets it up to apply a watermark to the video frames.

UpdateMovieCapture(*) captures the current screen data, (not using glReadPixels, it uses the windows device context then blits the DIB bits to memory. This makes it compatible with Direct3D, SDL, OpenGL, etc.), then it applys the watermark if one is setup, then when the final result is ready it blits the image to the AVI stream which then write it to the file.

EndMovieCapture(*) closes all of the streams, closes the AVI file, and the calls the AVIFileExit() function.



For more information and an implementatin, I found this which will help you get started in creating one.

Best of luck,

-UltimaX-
Ariel Productions

"You wished for a white christmas... Now go shovel your wishes!"

[edited by - UltimaX on March 4, 2004 11:05:11 PM]

Share this post


Link to post
Share on other sites
sidenote - OMG... of course I know how to take a screen shot, thats simple & examples are all over the place.

THANKS GUYS, especially UltimaX!!! I''ll look into this stuff as soon as I can.

Question.... If you want better performance while you capture your video, can''t you just make an uncompressed video (no codecs) & then convert it afterwards?????

Share this post


Link to post
Share on other sites
You can make an uncompressed video and then convert but remember uncompressed video uses up a lot of space. When doing the video capture you may want to put the resolution your game runs at to something like 640x480 with a 16-bit colour depth to keep the size down.

[edit]I'd also recomend just saving a load of screen shots (i.e. one every frame) and then create a video using an external app or one you code yourself. If you go for this approach choose a format that allows some compression and which is quick to do. E.g. BMP with RLE encoding or PCX.

[edited by - Monder on March 5, 2004 5:44:12 PM]

Share this post


Link to post
Share on other sites
quote:
Original post by Luke Miklos
sidenote - OMG... of course I know how to take a screen shot, thats simple & examples are all over the place.

THANKS GUYS, especially UltimaX!!! I'll look into this stuff as soon as I can.

Question.... If you want better performance while you capture your video, can't you just make an uncompressed video (no codecs) & then convert it afterwards?????



You can do that, but the codecs the external program prob. uses is the same as the video system will use. So you might as well do it all in one step then having to waste time fiddling around with another program. When the system prompts for the codec, it gives the option for every codec on your computer I believe. The codec I like to use is Intel Indieo Video, it looks nice and compresses real good.

You can also do it the way Monder and HippieHunter suggested, but do you realize how much work it would be. You can use Jasc AnimationShop to do it, but why not spend the extra hour and add the feature to your screen shot system? What if you wanted a watermark on it? You would have to spend more time doing that also. With the video system you can just blit the watermark before sending it to the video stream.

They all have their pros and cons like always, but I follow my dads advice, you get what you pay for. Do you A)Spend an time taken individual screen shots, loading them into a program like AnimationShop, apply a watermark, then build the video file, or do you B)Spend the extra little time putting it into your system and have it do all of that automatically? I built mine in a couple of hours. Your going to spend a lot more time where you should't be with A.

EDIT
By the way, you're welcome

Have a good one,
-UltimaX-
Ariel Productions

"You wished for a white christmas... Now go shovel your wishes!"

[edited by - UltimaX on March 5, 2004 5:56:43 PM]

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!