• Advertisement
Sign in to follow this  

Rendering to .AVI or other video format

This topic is 4618 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

Ok, I have a program that I am working on, and I want to be able to export a video file from the program. What I need is some code snippets or a tutorial (couldn't find any on google) for how to export what direct3D is rendering to a video file, frame by frame. I am running in a DirectX 8.1 environment. Thank you in advance :)

Share this post


Link to post
Share on other sites
Advertisement
One of the big things you need to think about is "constant-time" rendering (not sure of a better term)...

You'll probably want to render your movie at 20-30fps, but the added overhead of grabbing the screen and writing/encoding it to a disk might well make this a challenge (unless you've got a very powerful piece of kit).

As a consequence you probably want to set up some constant time deltas such that, as far as your code is concerned, every frame takes place at 1/xth of a second intervals. Thus if your engine goes faster, your movie is done quicker, if your engine is going too slowly the result is still good. Either way the finished product is the same.

This also raises problems with "directing" your movie whilst recording - as that could well require some sort of record/playback mode.

I'm off home now so can't make a longer post, but I've got a few links/ideas kicking around for the actual technology behind it. I'll try and remember to post them later this evening [smile]

hth
Jack

Share this post


Link to post
Share on other sites
JJ recommended fraps to me, here.

It records avi of your directX output, and has a demo so you can try it first (30seconds max avi length), then it was only 30 bucks.

Not so good if you want to play live, but I was using it with pre recorded animation and a soundtrack and it produced some great results for me.

Huge files, so they need to be compressed after somehow, like windows movie maker.

Share this post


Link to post
Share on other sites
What I am trying to do is create a PCPR - Pre-Computed Physics Renderer. I want the user to be able to set up a physical scene, then render the results to a video file - not in real time. This means that you can have a ridiculous amount of physical entities being simulated, and you can see what it looks like if it were in real time because you can watch the video file.

Share this post


Link to post
Share on other sites
Quote:
Original post by sipickles
Huge files, so they need to be compressed after somehow, like windows movie maker.

Eek - don't be touching Windows Movie Maker if you have any sort of concern over movie quality [smile]

It's a great piece of software for knocking up some competant-looking movies; but the WMV compression it uses is a bit horrific - even on maximum settings. I was quite surprised, as I've seen some good quality WMV around, but it absolutely mutilated my F1-car video [oh]

Quote:
Original post by AnonymousTipster
This means that you can have a ridiculous amount of physical entities being simulated, and you can see what it looks like if it were in real time because you can watch the video file.

You definitely need to look into what I was talking about with constant time per frame. It's this non-realtime nature that meant I couldn't use Fraps (Which, as sipickles said, is excellent). Coming from a physics background, I doubt you'll have problems here [wink]

Moving on... all of the pre-made solutions that I've seen in my travels (of which I have done quite a lot of research!) work great for recording game demos and other real-time applications; but most fall down when it comes to composing a non-realtime demo to appear as though it were realtime. I think its very likely you're going to have to roll-your-own.

hth
Jack

Share this post


Link to post
Share on other sites
This is what I was expecting, what I need is a piece of code that will go into my program that I can send the surface containing one frame of data every time a frame is rendered (probably variable frame rate) and turn it into a video file.
Alternatively, I can save the surface as a series of bitmaps (which I know how to do), but i'd need some code within my program that turns an image stream into a video file, then cleans up the 'working' bitmaps.

Share this post


Link to post
Share on other sites
Quote:
Original post by AnonymousTipster
Can DirectShow export data (Surfaces) to video formats? Or would the vfd.lib (Video for Windows) be a better solution?

I've heard that DirectShow can do this sort of thing, however I don't know of any specifics - I try to stay away from DirectShow programming [smile]

VFW is a good option, apparently it's quite easy to set-up and use; but I can't say any more - it's on my todo list [wink]

Jack

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement