如何捕获我的桌面使用.NET的视频?我的、桌面、视频、NET

2023-09-04 01:41:53 作者:长夜星河散去

我想知道是否有任何的方式来捕捉拍摄我的桌面使用.NET的视频(截屏)?我不是在寻找一个截屏软件,而只是一种技术,可以让我产生自己我的桌面视频。

I would like to know if there is any way to capture a to capture a video (screencast) of my desktop with .NET? I am not looking for a screencast software, but simply a technique that would allow me to generate myself a video of my desktop.

我想到服用多种截图,但我不知道我怎么会用图像序列...

I thought of taking multiple screenshots, but I am not sure of how I could generate programmatically a video with a sequence of images...

是否有人有一个想法?

谢谢!

推荐答案

是啊,有很多方法可以做到这一点。这是一个使用WPF一个非常简单的方法。它的工作原理,我之前已经用它。

Yeah, there are many ways to do this. This is a very simple method using WPF. It works, I've used it before.

https://m.xsw88.com/allimgs/daicuo/20230904/6441.png", IO.FileMode.OpenOrCreate) X.Save(FS, System.Drawing.Imaging.ImageFormat.Png) X.Dispose() FS.Close() Loop End Sub Public Shared Sub ClearRecording() If My.Computer.FileSystem.DirectoryExists(tempDir) Then _ My.Computer.FileSystem.DeleteDirectory(tempDir, FileIO.DeleteDirectoryOption.DeleteAllContents) My.Computer.FileSystem.CreateDirectory(tempDir) End Sub Public Shared Sub Save(ByVal Output As String) Dim G As New Windows.Media.Imaging.GifBitmapEncoder Dim X As New List(Of IO.FileStream) For Each Fi As String In My.Computer.FileSystem.GetFiles(tempDir, FileIO.SearchOption.SearchTopLevelOnly, "*.png") Dim TempStream As New IO.FileStream(Fi, IO.FileMode.Open) Dim Frame = Imaging.BitmapFrame.Create(TempStream) X.Add(TempStream) G.Frames.Add(Frame) Next Dim FS As New IO.FileStream(Output, IO.FileMode.OpenOrCreate) G.Save(FS) FS.Close() For Each St As IO.FileStream In X St.Close() Next End Sub Public Shared Sub Start() snap = New System.Threading.Thread(AddressOf Snapshot) snap.Start() End Sub Public Shared Sub [Stop]() snap.Abort() End Sub Private Shared Function FormatString(ByVal S As String, ByVal places As Integer, ByVal character As Char) As String If S.Length >= places Then Return S For X As Integer = S.Length To places S = character & S Next Return S End Function End Class

下面是另一种方法,使用托管DirectX

Here is another method using Managed DirectX

http://www.mdxinfo.com/resources/screencapture.php

另一个资源:

HTTP://www.$c$cproject.com/ KB /音频视频/ CaptureScreenAsVideo.aspx