fastest method to capture game screen shots in c#?(more than20 images per second)

南楼画角 提交于 2019-12-09 00:15:11

问题


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...


回答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.



来源:https://stackoverflow.com/questions/7186085/fastest-method-to-capture-game-screen-shots-in-cmore-than20-images-per-second

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!