在8/10窗口技术中进行完全实时的屏幕捕获,无延迟 [英] fully real-time screen capture in window 8/10 technology without delay

查看:161
本文介绍了在8/10窗口技术中进行完全实时的屏幕捕获,无延迟的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我要使用C#或C ++创建一个非常快速且实时的远程服务,这没关系,但目前我正在使用c#。

I'm gonna create a very fast and real-time remote service with C# or C++ , doesn't matter , but currently I'm using c# .

好吧,我正在寻找和要求的是一种以最快的形状实时捕获Windows屏幕的方法。

okay , What I'm looking for and asking for is a way to capture windows screen at real time in fastest shape .

我知道互联网上已经有很多方法,但是问题是延迟 ...

I know the ways already is on internet but the problem is the delay ...



  • 我使用C# copyfromscreen ,对于1920x1080 [视频5帧]

  • ,延迟为92ms C# copyfromscreen 带有jpg编码器,1920x1080的延迟为36ms

  • 我使用Unity3D screenCapture 使用jpg编码器,1920x1080的延迟为38ms

  • 我使用C#Windows Desktop Duplication API ,1920x1080的延迟为19ms [视频中的3帧]

  • 我使用了带有jpg编码器的C#Windows Desktop Duplication API ,延迟为12ms对于1920x1080 [视频2帧]

  • 我使用了C ++ Windows 台式机复制API 和jpg编码器,对于1920x1080,延迟是9ms [视频2帧]

  • 我使用了带有jpg编码器的C#Windows DirectXCapture 对于1920x1080 [视频2帧]

  • I used C# copyfromscreen and the delay was 92ms for 1920x1080 [ 5 frame in video ]
  • I used C# copyfromscreen with jpg encoder and delay was 36ms for 1920x1080
  • I used Unity3D screenCapture with jpg encoder and delay was 38ms for 1920x1080
  • I used C# Windows Desktop Duplication API and delay was 19ms for 1920x1080 [ 3 frame in video ]
  • I used C# Windows Desktop Duplication API with jpg encoder and delay was 12ms for 1920x1080 [ 2 frame in video ]
  • I used C++ Windows Desktop Duplication API with jpg encoder and delay was 9ms for 1920x1080 [ 2 frame in video ]
  • I used C# Windows DirectXCapture with jpg encoder and delay was 16ms for 1920x1080 [ 2 frame in video ]

我以这种方式认为进度是正常的,直到我签出Windows 10/8 Task Bar Live Preview缩略图,并且它是完全实时的,没有1ms的延迟,这意味着帧对帧!

I thought the progress is normal at this way till I checked out Windows 10/8 Task Bar Live Preview Thumbnails and It's fully-real time with out 1ms delay that means frame to frame !

我尝试将所有方法的1920 x 1080尺寸调整为任务栏预览尺寸,但未做任何更改!

I tried to resize 1920 x 1080 from all methods to Task Bar Preview size but it didn't made any change !

注意:该程序不是通过Internet处理的,而是可以在本地网络上工作的。

Note : This program is not processing over internet it's gonna work on local network.

我猜测延迟是由于位图处理或其他原因造成的,但我不知道 [添加时间] ,这就是我的方式服务器上的过程图片:

I'm guessing the delay is because of bitmap processing or something but I don't know yet! [Times Added] Here's the way I process picture on server :

private static byte[] capture()
{
    Bitmap bmp = screenshot_DDAPI(); // Avarage Time : 29.6566ms
    MemoryStream ms = new MemoryStream();
    bmp.Save(ms, ImageFormat.Jpeg); // Avarage Time : 1.7101 ms
    return ms.ToArray(); // Avarage Time : 3.032 ms
}

任何人都知道Windows使用哪种技术和方法处理屏幕快照以显示任务栏实时缩略图吗?

Anybody knows which technology and method windows uses to process a screenshot to task bar live thumbnails ?

注意:如果此问题与堆栈溢出无关或不在主题范围内,请告诉我可以问我哪个堆栈类别?

Note : if this question is not related to stack-overflow or it's off-topic please tell me which stack category I can ask my question ?

谢谢

推荐答案

桌面复制API是最快的一种。捕获延迟为零。

Desktop duplication API is the fastest one. The capture delay is zero.

但是,捕获后,您将原始纹理数据下载到系统RAM中,以用于基于CPU的jpeg编码器。这就是花时间。实时缩略图不需要这样做,它们可以缩放GPU中的窗口纹理并使用GPU渲染,当源数据已经在VRAM中时,两者都很便宜。

However, after the capture, you’re downloading raw texture data into system RAM for CPU-based jpeg encoder. This is what taking the time. Live thumbnails don’t need to do that, they scale window texture in GPU and render it with GPU, too, both are very cheap when the source data is already in VRAM.

如果您真的想最小化延迟,请寻找基于GPU的JPEG编码器,该编码器可以从 B8G8R8A8_UNORM D3D11纹理中获取源数据。 JPEG比RGBA占用更少的空间(从而减少带宽),也就是说,您可能会更快地获得编码结果。

If you really want to minimize latency, look for GPU-based JPEG encoder that can take source data from B8G8R8A8_UNORM D3D11 texture. JPEGs take much less space (and therefore bandwidth) than RGBA, i.e. you’ll probably get the encoded result sooner.

这篇关于在8/10窗口技术中进行完全实时的屏幕捕获,无延迟的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆