4

How can i make screenshoots to the entire game screen very fast? Somthing like 20-30 per second?(i want to convert them to video)

[[1]] I've tried WMEncoder.Results were that WMEncoder can capture the screen and regions of screen only in a video format (wma) using a set of preconfigured codecs. (29 fps best encode result).WMEncoder can not make screenshots.

[[2]] I've tried DirectX :

Surface s = device.CreateOffscreenPlainSurface(
Screen.PrimaryScreen.Bounds.Width,
Screen.PrimaryScreen.Bounds.Height,
Format.A8R8G8B8, Pool.SystemMemory);
device.GetFrontBufferData(0, s);
SurfaceLoader.Save("c:\\Screenshot"+i.ToString()+".bmp", ImageFileFormat.Bmp, s);

This works like gdi ..very slow....and it works only in DirectX 1.0 because SurfaceLoader does not exist in directX 2.0

Another way that i've read in some post is using :

s = device.GetBackBuffer(0, 0, Microsoft.DirectX.Direct3D.BackBufferType.Mono);

, but this maks screenshots only to the curent window.

[[3]] I've tried to use Taksi (at sourceforge.net)... but i don't know how to use it in c# and make it work.

Please help me out...

ehsanff
  • 41
  • 1
  • 6
  • 1
    You mentioned GDI, did you use `Bitblt` or the `System.Drawing` namespace? It's a huge difference in performance. – C.Evenhuis Aug 25 '11 at 07:03
  • So you don't want to take video, just because of performance issues (don't know will it affect perf.)? Convert them after the rest of the work? I wonder why you just take video, it will be simpler. EDIT: I saw your another question is to take video. That's strange, I think people interest in screencapturing more than taking video. – PythEch Aug 25 '11 at 08:24
  • Hmm, when I use this captures game screen too but don't know is it fast or slow: http://www.codeproject.com/KB/cs/DesktopCaptureWithMouse.aspx – PythEch Aug 25 '11 at 08:28

1 Answers1

1

You really want to hook into directx so you can make the calls as if you were that game/application. Below are a few sites that do this (most draw extra things, but i don't see why you couldn't save the backbuffer every x frames):

http://www.gamedev.net/topic/359794-c-direct3d-hooking-sample/

Disclamer: I've not tried this, so not sure what FPS you can get, however i would think this is the fastest method as you're doing it effectively from within the game.

ug_
  • 11,267
  • 2
  • 35
  • 52
George Duckett
  • 31,770
  • 9
  • 95
  • 162