Taking snapshot Vlc.DotNet.Form to variable Bitmap in C#

huangapple go评论135阅读模式
英文:

Taking snapshot Vlc.DotNet.Form to variable Bitmap in C#

问题

我们需要在C#中从UDP视频流中处理图像。在项目中,我们可以获取图像并将其保存到vlcControl的路径中。我们需要将这个图像存储在一个变量中,而不是存储在硬盘上的文件中。

请查看我的代码示例:

vlcControl1.TakeSnapshot(@"D:\a.jpg", 600, 400);

现在,我们需要在内存中创建一个地址或覆盖TakeSnapshot方法以解决这个问题。

我们尝试在内存中创建一个地址,或者覆盖TakeSnapshot方法。

英文:

We need to processing image in C# from UDP video stream. in project we can get image and save it to Path With vlcControl. We need to have this image in a variable and not inside a file on the hard drive.
Please see my code below:

vlcControl1.TakeSnapshot(@"D:\a.jpg", 600, 400);

Now we need to have an address in memory or override a method to solve the problem.

We tried to create an address in memory and another override a method TakeSnapshot

答案1

得分: 0

In libvlc3/LibVLCSharp3, there is no way to get a snapshot in memory.

如果你想在内存中获取所有帧,可以考虑使用此选项代替:https://code.videolan.org/mfkl/libvlcsharp-samples/tree/master/PreviewThumbnailExtractor

在LibVLC4中,仍然处于预发布阶段,有一个用于此目的的API:https://mfkl.github.io/libvlc/2020/07/23/Gracefully-surfacing-asynchronous-C-APIs-to-.NET.html

从该博客文章中,你可以看到以下用于创建快照的代码:

using var media = new Media(libVLC, new Uri("C:\\Path\\To\\Videos\\big_buck_bunny_720p_30mb.mkv"));
using var thumbnail = await media.GenerateThumbnail(time: 200, 
                                speed: ThumbnailerSeekSpeed.Fast, 
                                width: 200, 
                                height: 200, 
                                crop: false, 
                                pictureType: PictureType.Argb);
英文:

In libvlc3/LibVLCSharp3, there is no way to get a snapshot in memory.
If you want all frames in memory, you could consider this option instead : https://code.videolan.org/mfkl/libvlcsharp-samples/tree/master/PreviewThumbnailExtractor

In LibVLC4, still in prerelease, there is an APi for that :
https://mfkl.github.io/libvlc/2020/07/23/Gracefully-surfacing-asynchronous-C-APIs-to-.NET.html

From that blog post, you can see the following lines used to create a snapshot :

using var media = new Media(libVLC, new Uri("C:\\Path\\To\\Videos\\big_buck_bunny_720p_30mb.mkv"));
using var thumbnail = await media.GenerateThumbnail(time: 200, 
                                speed: ThumbnailerSeekSpeed.Fast, 
                                width: 200, 
                                height: 200, 
                                crop: false, 
                                pictureType: PictureType.Argb);

huangapple
  • 本文由 发表于 2023年5月14日 13:31:58
  • 转载请务必保留本文链接:https://go.coder-hub.com/76245988.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定