Connect to public IP camera in Java

asked 2015-12-11 10:58:12 -0600

JTrejo gravatar image

I'm trying to connect to a public IP camera ( in Java by using the following:

import org.opencv.core.Core;
import org.opencv.videoio.VideoCapture;

public class Main
    public static void main(String[] args)
        System.out.println("Welcome to OpenCV " + Core.VERSION);

        VideoCapture ip_cam = new VideoCapture();"");

        if (!ip_cam.isOpened())
            System.out.print("Error while trying to open the webcam");



However, it refuses to open. It doesn't throws any error messages nor anything. I've tried running it as admin, downgrading from OpenCV 3.0.0 to 2.4.11, trying to connect to a different IP camera.. nothing. Since it's such a simple program I just can't figure out what's wrong.

I'm using OpenCV 3.0.0, Eclipse Mars 1 4.5.1 and Win7 64bits.

edit retag flag offensive close merge delete



Check this answer here: ... I quickly tried with appending "?x.mjpeg" to your url and it worked (x can be anything). Although I don't know why, so I'm just adding that as comment.

RolandC gravatar imageRolandC ( 2015-12-12 02:48:35 -0600 )edit