屏幕捕捉的最快速的方法

编程入门 行业动态 更新时间:2024-10-13 14:22:35
本文介绍了屏幕捕捉的最快速的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我想写为Windows平台抓屏程序,但我不确定如何捕获屏幕。我知道的唯一方法是使用GDI,但我很好奇是否还有其他的方法来进行此事,并且,如果有,这将产生最少的开销?速度是当务之急。

I want to write a screencasting program for the Windows platform, but am unsure of how to capture the screen. The only method I'm aware of is to use GDI, but I'm curious whether there are other ways to go about this, and, if there are, which incurs the least overhead? Speed is a priority.

该抓屏程序将是记录游戏画面,虽然,如果这确实缩小了选择,我还是打开了跌出此范围内的任何其他建议。知识是不坏,毕竟。

The screencasting program will be for recording game footage, although, if this does narrow down the options, I'm still open for any other suggestions that fall out of this scope. Knowledge isn't bad, after all.

修改:我碰到这篇文章就来了:各种捕获方法屏幕。它把我介绍给做它,做它的方式的DirectX的Windows媒体API的方式。它提到在禁用硬件加速功能可以显着提高捕获应用程序的性能的结论。我很好奇,这是为什么。任何人都可以填补空白失踪我?

Edit: I came across this article: Various methods for capturing the screen. It has introduced me to the Windows Media API way of doing it and the DirectX way of doing it. It mentions in the Conclusion that disabling hardware acceleration could drastically improve the performance of the capture application. I'm curious as to why this is. Could anyone fill in the missing blanks for me?

修改:我读到抓屏程序如Camtasia的使用自己的捕获驱动程序。可能有人给我它是如何工作的深入解释,为什么它是更快?我可能还需要在实施类似的东西指导,但我敢肯定有现有的文件呢。

Edit: I read that screencasting programs such as Camtasia use their own capture driver. Could someone give me an in-depth explanation on how it works, and why it is faster? I may also need guidance on implementing something like that, but I'm sure there is existing documentation anyway.

另外,我现在知道了FRAPS如何记录画面。它挂钩底层图形API从后面缓冲区中读取。据我了解,这比从正面缓冲区中读取的速度更快,因为你是从系统内存读取,而不是视频RAM。你可以阅读文章here.

Also, I now know how FRAPS records the screen. It hooks the underlying graphics API to read from the back buffer. From what I understand, this is faster than reading from the front buffer, because you are reading from system RAM, rather than video RAM. You can read the article here.

推荐答案

这是我用来收集单个帧,但是如果你修改这个并保持两个目标打开所有的时间,那么你可以流到磁盘使用文件名的静态计数器。 - 我不记得在那里我发现了这一点,但它已被修改,这要感谢谁

This is what I use to collect single frames, but if you modify this and keep the two targets open all the time then you could "stream" it to disk using a static counter for the file name. - I can't recall where I found this, but it has been modified, thanks to whoever!

void dump_buffer() { IDirect3DSurface9* pRenderTarget=NULL; IDirect3DSurface9* pDestTarget=NULL; const char file[] = "Pickture.bmp"; // sanity checks. if (Device == NULL) return; // get the render target surface. HRESULT hr = Device->GetRenderTarget(0, &pRenderTarget); // get the current adapter display mode. //hr = pDirect3D->GetAdapterDisplayMode(D3DADAPTER_DEFAULT,&d3ddisplaymode); // create a destination surface. hr = Device->CreateOffscreenPlainSurface(DisplayMde.Width, DisplayMde.Height, DisplayMde.Format, D3DPOOL_SYSTEMMEM, &pDestTarget, NULL); //copy the render target to the destination surface. hr = Device->GetRenderTargetData(pRenderTarget, pDestTarget); //save its contents to a bitmap file. hr = D3DXSaveSurfaceToFile(file, D3DXIFF_BMP, pDestTarget, NULL, NULL); // clean up. pRenderTarget->Release(); pDestTarget->Release(); }

更多推荐

屏幕捕捉的最快速的方法

本文发布于:2023-11-30 13:52:52,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1650226.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:屏幕   快速   方法

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!