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 { }
}
But I also need to get a stream from an IP camera. Any ideas what would be the best way to get it?