C# 使用 .NET 技术录制屏幕视频
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/397754/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Record Video of Screen using .NET technologies
提问by Chris Craft
Is there a way to record the screen, either desktop or window, using .NET technologies.
有没有办法使用 .NET 技术记录屏幕(桌面或窗口)。
My goal is something free. I like the idea of small, low cpu usage, and simple, but would consider other options if they created a better final product.
我的目标是免费的东西。我喜欢小巧、低 CPU 使用率和简单的想法,但如果他们创造了更好的最终产品,我会考虑其他选择。
In a nutshell, I know how to take a screenshot in C#, but how would I record the screen, or area of the screen, as a video?
简而言之,我知道如何在 C# 中截取屏幕截图,但如何将屏幕或屏幕区域记录为视频?
Thanks a lot for your ideas and time!
非常感谢您的想法和时间!
采纳答案by driis
There is no need for a third party DLL. This simple method captures the current screen image into a .NET Bitmap object.
不需要第三方 DLL。这个简单的方法将当前屏幕图像捕获到 .NET Bitmap 对象中。
private Image CaptureScreen()
{
Rectangle screenSize = Screen.PrimaryScreen.Bounds;
Bitmap target = new Bitmap(screenSize.Width,screenSize.Height);
using(Graphics g = Graphics.FromImage(target))
{
g.CopyFromScreen(0,0,0,0,new Size(screenSize.Width,screenSize.Height));
}
return target;
}
I am sure you can figure out how to capture a smaller portion of the screen, if that is needed :-).
如果需要,我相信您可以弄清楚如何捕获屏幕的一小部分:-)。
回答by PEZ
There is a dll out there that can do it. Don't remember the name of it but it's used by Jing. A friend of mine implemented a screen recorder in just a few minutes by using that dll, just for testing. Check out Jing and you'll probably find the dll they use.
有一个 dll 可以做到这一点。不记得它的名字,但它被Jing 使用。我的一个朋友在几分钟内使用那个 dll 实现了一个屏幕录像机,只是为了测试。查看 Jing,您可能会找到他们使用的 dll。
回答by driis
You can use Windows media Encoder SDK to build a c# application to record the screen. There are in-built options to record the entire desktop, a particular window or a portion of the screen.
您可以使用 Windows media Encoder SDK 构建 ac# 应用程序来录制屏幕。有内置选项可以记录整个桌面、特定窗口或屏幕的一部分。
回答by chatura
You can use Media Encoder SDK but it is not supported on Windows 7.
您可以使用 Media Encoder SDK,但它在 Windows 7 上不受支持。
回答by Fuel
You may try this opensource utility: ScreenRecord (http://screenrecord.codeplex.com/) it's based on AForge.NET
你可以试试这个开源工具: ScreenRecord ( http://screenrecord.codeplex.com/) 它基于 AForge.NET