RTSP link can not open Camera - Java H264 Stream [closed]

asked 2014-10-18 06:52:54 -0600

updated 2014-10-18 08:43:32 -0600

The problem is solved through this link : http://stackoverflow.com/questions/23199886/opencv-java-binds-videocapture-from-file-failing-silently After putting the OpenCV binaries path to Windowss' environment variable PATH and restart my Eclipse IDE, i will be able to get data from RTSP stream and any orher local file (for example avi) I can not post an answer because i am newbie and opencv prohibits me so i has just write to here. Regards, Eray

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);
}
edit retag flag offensive reopen merge delete

Closed for the following reason the question is answered, right answer was accepted by berak
close date 2014-10-20 01:55:22.821720