该程序的实现何时会捕获一个桌面屏幕 [英] Implementation of the program when will capture a screen of desktop

查看:106
本文介绍了该程序的实现何时会捕获一个桌面屏幕的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

亲爱的。

提示请。需要实现一个程序,以每秒24帧的速度捕获桌面屏幕到视频流,并通过rtmp-protocol发送到服务器。我应该开始使用你推荐使用的库吗?

Dear all.
Prompt please. Need to implement a program that will capture the desktop screen at 24 frames per second to video stream and send by rtmp-protocol to the server. Should I start and what do you recommend libraries to use?

推荐答案

最大的问题是你的每秒24帧要求。 Windows不是一个实时系统,因此,有可能,您可能无法提供准确的帧速率;一些延迟将是可能的。您可以使用多媒体系统计时器来提高可靠性,但它需要P / Invoke或C ++ / CLI(混合,托管+非托管模式)。你可以从这里开始:

http://msdn.microsoft.com/en-us/library/windows/desktop/dd757634%28v=vs.85%29.aspx [ ^ ],

http://www.pinvoke.net/default.aspx/winmm/timesetevent.html ?diff = y [ ^ ](P / Invoke已经为你完成了)。



也许你的时间可能不那么严格(考虑到你的目的),你可以使用.NET计时器之一:

http://msdn.microsoft.com/en-us/library/system.threading.timer%28v=vs.110%29.aspx [ ^ ],

http:// msdn .microsoft.com / zh-CN / library / system.timers.timer%28v = vs.110%29.aspx [ ^ ],

http://msdn.microsoft.com/en- us / library / system.windows.forms.timer%28v = vs.110%29.aspx [ ^ ] - 永远不要尝试将此计时器用于任何需要任何准确性,任何应该是大致周期性的,

http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatchertimer%28v=vs.110%29.aspx [ ^ ](主要针对WPF,仅适用于您的应用程序也使用WPF UI)。



可以进行屏幕截图在WPF或 System.Windows.Forms 中并且是微不足道的。希望您自己了解如何操作,具体取决于您的设置: http://bit.ly/1p36knv [ ^ ]。



留下更多困难的部分:使用RTMP协议: http://en.wikipedia.org/wiki/Real_Time_Messaging_Protocol [ ^ ]。



我将查看根据Google Code发布的LibRTMP.NET.Windows库,该代码随rtmp-mediaplayer提供: https:// code .google.com / p / rtmp-mediaplayer [ ^ ]。



-SA
The biggest problem is your "24 frames per second" requirement. Windows is not a real-time system, so, with some probability, you may fail to deliver exact frame rate; some delays will be possible. You can use multimedia-system timer to improve the reliability if it, but it will require P/Invoke or C++/CLI (mixed, managed+unmanaged mode). You can start here:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd757634%28v=vs.85%29.aspx[^],
http://www.pinvoke.net/default.aspx/winmm/timesetevent.html?diff=y[^] (P/Invoke already done for you).

Perhaps you may not be so strict about your timing (considering your purpose), the you can use one of .NET timers:
http://msdn.microsoft.com/en-us/library/system.threading.timer%28v=vs.110%29.aspx[^],
http://msdn.microsoft.com/en-us/library/system.timers.timer%28v=vs.110%29.aspx[^],
http://msdn.microsoft.com/en-us/library/system.windows.forms.timer%28v=vs.110%29.aspx[^] — never ever try to use this timer for anything which require any accuracy at all, anything supposed to be even approximately periodic,
http://msdn.microsoft.com/en-us/library/system.windows.threading.dispatchertimer%28v=vs.110%29.aspx[^] (specific mostly to WPF, can only be suitable if your application also uses WPF UI).

Screen capture is possible in WPF or System.Windows.Forms and is trivial. Hope you will find out how to do it yourself, depending on your settings: http://bit.ly/1p36knv[^].

It leave for more difficult part: the use of RTMP protocol: http://en.wikipedia.org/wiki/Real_Time_Messaging_Protocol[^].

I would look at the library LibRTMP.NET.Windows released under Google Code, supplied with rtmp-mediaplayer: https://code.google.com/p/rtmp-mediaplayer[^].

—SA


这篇关于该程序的实现何时会捕获一个桌面屏幕的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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