如何获取IP摄像机流成C#? [英] How to get an IP camera stream into C#?

查看:765
本文介绍了如何获取IP摄像机流成C#?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我用AForge库,使这个小程序,显示从摄像头到一个PictureBox活饲料。

I've used AForge library to make this little program, that shows live feed from a webcam into a PictureBox.

private FilterInfoCollection VideoCaptureDevices;
private VideoCaptureDevice FinalVideoDevice;

private void Form1_Load(object sender, EventArgs e)
{
   VideoCaptureDevices = new FilterInfoCollection(FilterCategory.VideoInputDevice);
   try
   {
      foreach (FilterInfo VidCapDev in VideoCaptureDevices)
      {
         comboBox1.Items.Add(VidCapDev.Name);
         comboBox1.SelectedIndex = 0;
      }
      FinalVideoDevice = new VideoCaptureDevice(VideoCaptureDevices[comboBox1.SelectedIndex].MonikerString);
      FinalVideoDevice.NewFrame += new NewFrameEventHandler(FinalVideoDevice_NewFrame);
      FinalVideoDevice.Start();
   }
   catch
   {
      MessageBox.Show("No camera found. Please connect your camera and click RESET.");
   }
}

        //////////////////////////////////////////////////////////////////////////////////////////

void FinalVideoDevice_NewFrame(object sender, NewFrameEventArgs e)
{
   try
    {
       pictureBox1.Image = (Bitmap)e.Frame.Clone();
    }
    catch { }
}



但我还需要以获得一个IP摄像机的流。 ?任何想法将是最好的方式得到它。

But I also need to get a stream from an IP camera. Any ideas what would be the best way to get it?

推荐答案

与MJPEGStream来自同一AForge.net解决它:)

Solved it with MJPEGStream from the same AForge.net :)

MJPEGStream stream = new MJPEGStream("http://192.168.2.5:8080/videofeed");
            stream.NewFrame += new NewFrameEventHandler(video_NewFrame);
            stream.Start();

这篇关于如何获取IP摄像机流成C#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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