我有一个IP摄像头,我有它的rtsp连接。我不想在C#中连续捕获它的图像,并将它们存储在特定的文件夹中。我已经搜索过了,但大多数人都是通过http请求来做的,还没有人用过rtsp。有没有人在C#中通过rtsp做到了?
发布于 2020-09-29 01:26:15
Nager.VideoStream基于ffmpeg,因此可以很容易地跨平台使用。如果使用的是NewImageReceived事件,则可以将每个帧保存到特定文件夹中。
PM> install-package Nager.VideoStreamvar inputSource = new StreamInputSource("rtsp://wowzaec2demo.streamlock.net/vod/mp4:BigBuckBunny_115k.mov");
//var inputSource = new WebcamInputSource("Microsoft® LifeCam HD-3000");
var cancellationTokenSource = new CancellationTokenSource();
var client = new VideoStreamClient();
client.NewImageReceived += NewImageReceived;
var task = client.StartFrameReaderAsync(inputSource, OutputImageFormat.Bmp, cancellationTokenSource.Token);
//Console.ReadLine();
client.NewImageReceived -= NewImageReceived;
private static void NewImageReceived(byte[] imageData)
{
File.WriteAllBytes($@"{DateTime.Now.Ticks}.bmp", imageData);
}https://stackoverflow.com/questions/37109498
复制相似问题