Create a video from a directX application

Started by
13 comments, last by chxfryer 19 years, 6 months ago
I take once that it is possible to create a video from a directX application with directX-Show. Is this to complex or exist a example of this? Thanks. Best regards pajofego
Advertisement
This is actually pretty difficult to do. It's quite hard to capture high-quality video and run a high-performance 3D application at the same time, since you are already utilizing the graphics hardware.

You may be able to use DirectShow, but in most cases, it isn't used. Check out FRAPS. I've used it a couple of times, and it seems to be a viable solution.
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
If you dont mind losing control over the frame rate can you not use StretchRect on a DirectShow video buffer with the Direct3D backbuffer as source?
It wouldnt be pretty of course (like you couldnt take a video while playing at any decent fps) but I should think you could take a snapshot every frame and create a video out of it.
________________
"I'm starting to think that maybe it's wrong to put someone who thinks they're a Vietnamese prostitute on a bull"       -- Stan from South Park
Lab74 Entertainment | Project Razor Online: the Future of Racing (flashsite preview)
I have also used fraps for video capturing but with my last 3D application on Win XP I have the problem that I can't record it.

Thanks,

pajofego
Are you trying to capture the video AND keep the game playable at the same time? If not, you could just copy the backbuffer to a bitmap every frame, then compress them into an AVI/MPEG or something.
Sean Henley [C++ Tutor]Rensselaer Polytechnic Institute
Quote:Original post by Sr_Guapo
Are you trying to capture the video AND keep the game playable at the same time? If not, you could just copy the backbuffer to a bitmap every frame, then compress them into an AVI/MPEG or something.


You may be able to keep your app quasi-playable, using Guapo's method. However, you must run the app once, and record all the input (from the mouse, keyboard, whatever) for each frame. Then, when you want to record, read the input back in and use it. That way, you can still be saving all the backbuffers to file (keeping every one of them in memory would be a killer), while using your real-time input. It won't even matter that the framerate is low (unless you have a lot of time-based calculations occuring, where elapsed time between frames is used).
Dustin Franklin ( circlesoft :: KBase :: Mystic GD :: ApolloNL )
Quote:Original post by dhanji
If you dont mind losing control over the frame rate can you not use StretchRect on a DirectShow video buffer with the Direct3D backbuffer as source?
It wouldnt be pretty of course (like you couldnt take a video while playing at any decent fps) but I should think you could take a snapshot every frame and create a video out of it.


I dont think you can. I am trying to do something very similar right now. The problem with this is the back buffer. All I do is save it to file. Now I cant "hack" into the back buffer of another application. (at least it seems) I end up having garbage in the file, although colors match (and size) with the front buffer, although the format seems to be wrong. (its just all clipped and moved around all over) I can upload a sample if someone wants to see it, along with the code. I might be just doing the surface handling wrong though. Any examples of getting a rendertarget or backbuffer and saving the resulting surface to file? Or at least a procedure I should follow?
Quote:Original post by circlesoft
This is actually pretty difficult to do. It's quite hard to capture high-quality video and run a high-performance 3D application at the same time, since you are already utilizing the graphics hardware.

You may be able to use DirectShow, but in most cases, it isn't used. Check out FRAPS. I've used it a couple of times, and it seems to be a viable solution.


FRAPS is just close to amazing in my opinion. If I can get close to that performance, I'll be one happy programmer. =P

It really makes me wonder how it works.

Quote:Original post by pajofego
I have also used fraps for video capturing but with my last 3D application on Win XP I have the problem that I can't record it.

Thanks,

pajofego


Do you mind sharing how is your application different from others you captured before. This might give us an idea on why FRAPS is failing, and it might unravel how FRAPS works.
By the way the only way to take anti-aliased screenshots is using GetFrontBufferData(). At least this is what the dx docs say...

GetFrontBufferData performance is just unacceptable. (one full second on my laptop, which is top of the line)
Quote:Quote:Original post by dhanji
If you dont mind losing control over the frame rate can you not use StretchRect on a DirectShow video buffer with the Direct3D backbuffer as source?
It wouldnt be pretty of course (like you couldnt take a video while playing at any decent fps) but I should think you could take a snapshot every frame and create a video out of it.



I dont think you can. I am trying to do something very similar right now. The problem with this is the back buffer. All I do is save it to file. Now I cant "hack" into the back buffer of another application. (at least it seems) I end up having garbage in the file, although colors match (and size) with the front buffer, although the format seems to be wrong. (its just all clipped and moved around all over) I can upload a sample if someone wants to see it, along with the code. I might be just doing the surface handling wrong though. Any examples of getting a rendertarget or backbuffer and saving the resulting surface to file? Or at least a procedure I should follow?


you can save teh backbuffer to a file. Thats cake. use GetRenderTarget or GetRenderTargetData then use D3DXSaveSurfaceToFile.
I have done it many times to take screenshots and they turn out fine.
________________
"I'm starting to think that maybe it's wrong to put someone who thinks they're a Vietnamese prostitute on a bull"       -- Stan from South Park
Lab74 Entertainment | Project Razor Online: the Future of Racing (flashsite preview)

This topic is closed to new replies.

Advertisement