Click here to Skip to main content
15,850,750 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:

I am trying to capture video from IP camera. The video is successfully streaming in web browser and vlc player. But when I try to capture the video in C# windows form using Emgu CV there is no video. Even the windows form doesnot show. When I pause the project the control always stays at Capture API.

Kindly help me on capturing RTSP stream from IP camera.

Best Regards

What I have tried:

I have tried capturing video stream from an IP camera
The code is as follows.
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
using Emgu.CV;
using Emgu.CV.Structure;
using Emgu.Util;

namespace emguCVIpCamera
    public partial class Form1 : Form
        Capture cap = null;
        public Form1()
            cap = new Emgu.CV.Capture(@"rtsp://");
            cap.ImageGrabbed += processFrame;

        private void processFrame(object sendor, EventArgs arg)
               Image<bgr, byte=""> frame = new Image<bgr, byte="">(720,576);
               frame = cap.RetrieveBgrFrame();
             // pictureBox1.Image = frame.ToBitmap();        
Updated 22-Sep-22 2:03am
Richard Deeming 22-Sep-22 9:33am    
Why are you calling Start twice? Try removing the first one, so that you attach the event handler before calling Start.

Also try moving the Start call out of the constructor and into the Loaded event.
Saira Kanwal 2022 23-Sep-22 0:33am    
I removed the first start and move the other start in the loaded function. But still no luck. It gets stuck in the cap=Emgu.CV.Capture("rtsp.....") Command and whenever I pause the simulation the control always points to this capture statement.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900