I am trying to get and display an video stream from a IP camera. I found some sample code here:http://answers.opencv.org/question/24012/reading-video-stream-from-ip-camera-i
.jpg refers to a single image file, while .mjpg gives access to the video stream. It's important to define the IP and the PORT used to connect.
Depending on the device you have and the settings defined in the web interface of the camera, the URL is going to be different:
VideoCapture camera = new VideoCapture("http://192.168.0.7:8080/?dummy=param.mjpg");
VideoCapture camera = new VideoCapture("http://192.168.0.7:8080/mjpeg.cgi");
VideoCapture camera = new VideoCapture("http://192.168.0.7:8080/mjpg/mjpeg.cgi");
VideoCapture camera = new VideoCapture("http://192.168.0.7:8080/video.mjpeg");
VideoCapture camera = new VideoCapture("http://192.168.0.7:8080/video.cgi?.mjpg");
When you access a valid URL via browser it should display the video stream. Once you find the address that works, simply pass it to VideoCapture constructor. In this examples I showed how to access the stream via HTTP, but the RTSP protocol is also supported.