在c#中捕获游戏屏幕截图最快的方法?(每秒超过20张图像)
如何快速截取整个游戏屏幕?每秒 20-30 次之类的东西?(我想将它们转换为视频)
[[1]] 我尝试过 WMEncoder。结果是 WMEncoder 只能使用一组预配置的编解码器以视频格式 (wma) 捕获屏幕和屏幕区域。 (29 fps 最佳编码结果)。WMEncoder 无法截图。
[[2]] 我已经尝试过 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);
这就像 gdi ..非常慢......并且它仅在 DirectX 1.0 中工作,因为 DirectX 2.0 中不存在 SurfaceLoader
我在一些帖子中读到的另一种方法是使用 :
s = device.GetBackBuffer(0, 0, Microsoft.DirectX.Direct3D.BackBufferType.Mono);
,但这使得仅对当前窗口进行屏幕截图。
[[3]] 我尝试使用 Taksi (在 sourceforge.net)...但我不知道如何在 C# 中使用它并使其工作。
请帮帮我...
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...
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您确实想连接到 directx,这样您就可以像那个游戏/应用程序一样进行调用。下面是一些执行此操作的网站(大多数都绘制了额外的东西,但我不明白为什么你不能每 x 帧保存后备缓冲区):
http://www.gamedev.net/topic/359794-c-direct3d-hooking-sample/
免责声明:我还没有尝试过这个,所以不确定你能得到多少 FPS,但我认为这是最快的方法,因为你在游戏中有效地做到了这一点。
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.