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
After 3 to 4 weeks of hardwork,I found a 100% working solution for this
First of All you have to load the ffmpeg's dll file Dynamically i-e Using
System.loadLibrary("[NAME OF YOUR DLL FILE]")
You can find the required dll file in **opencv/build/x64/vc11/bin**
The name of DLL in my case is "opencv_ffmpeg2413_64.dll"
copy the file to default path of the Project and use
System.loadLibrary("opencv_ffmpeg2413_64");//You May have different File Name Depending on the Version of OpenCV Installed on your Computer
Then You can Simply use
VideoCapture ipcamera = new VideoCapture("[RTSP URL OF THE IP Camera]")//I used this Demo Link (rtsp://184.72.239.149/vod/mp4:BigBuckBunny_175k.mov)
.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.