Hi,
I try this basic code as told in forums/internet but the isOpened() method always returns false. I tried InetSocketAddress to connect 192.168.1.229 on port 554 and this was succedded. Also i can see the camera video stream from iSpy software (a custom Camera control software) with URL rtsp://192.168.1.229:554/H264/streamtype=0. So, i am sure that the device is working properly.
What might be the problem? Any ideas..:(
Version : OpenCV 2.4.9 wt. Java 1.8/1.6
public static void main(String[] args) {
int i=0;
System.loadLibrary(Core.NATIVE_LIBRARY_NAME);
VideoCapture capture = new VideoCapture("rtsp://192.168.1.229:554/H264/streamtype=0");
Mat image=new Mat();
double propid=0;
capture.open("rtsp://192.168.1.229:554/H264/streamtype=0");
if (capture.isOpened()) {
System.out.println("Video is captured");
int x=0;
while (x<18) {
x=x+1;
propid=capture.get(x);
System.out.println("Property Id is " + x + " value ="+ propid);
}
// grab 10 frames as a test
while (i<10) {
try {
//capture.retrieve(image); //same results as .read()
capture.read(image);
} catch (Exception e) {
System.out.println("Null Pointer Exception during Read");
}
i=i+1;
}
} else {
System.out.println("Camera can not be opened!");
}
capture.release();
System.out.println("VideoCapture is released");
System.exit(0);
}