Jump to content
  • Advertisement
Sign in to follow this  
pajofego

Create a video from a directX application

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

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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).

Share this post


Link to post
Share on other sites
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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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)

Share this post


Link to post
Share on other sites
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.

Share this post


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

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!