Ask Your Question
1

How can I view Live stream from IP camera via internet using opencv?

asked 2014-01-19 21:10:41 -0600

xMayank gravatar image

updated 2014-01-21 02:09:17 -0600

I want to create an application which can display video stream from IP camera using Opencv and MFC, c++. I am able to get video from my IP camera over the lan, But wondering if its possible via internet.

Code I tried.

int main(int, char**) { cv::VideoCapture vcap; cv::Mat image;

// This works on a D-Link CDS-932L
const std::string videoStreamAddress =

"http://admin:[email protected]:80/video.cgi?resolution=640x360&req_fps=50&.mjpg"; //const std::string videoStreamAddress = "http://admin:[email protected]:8088/mjpg/video.mjpg";

//open the video stream and make sure it's opened
if(!vcap.open(videoStreamAddress)) {
    std::cout << "Error opening video stream or file" << std::endl;
    return -1;
}

for(;;) {
    if(!vcap.read(image)) {
        std::cout << "No frame" << std::endl;
        cv::waitKey();
    }
    cv::imshow("Output Window", image);

    if(cv::waitKey(1) >= 0) break;
}    }

Get warning "Could not find codec parameter ".

edit retag flag offensive close merge delete

Comments

Is it just a warning or does it fails to work due to that warning? Sometimes warnings are just parameters that could not be read to supply optimal performance, but it does actually work then.

StevenPuttemans gravatar imageStevenPuttemans ( 2014-01-21 02:00:49 -0600 )edit

3 answers

Sort by ยป oldest newest most voted
1

answered 2014-01-20 04:36:40 -0600

Will Stewart gravatar image

If you have a static IP address from your ISP, the answer is "Yes", though you have to 'port forward' the request via your router if you are wanting to directly connect to the camera. It is still possible if you have a non-static IP address, though a workaround is necessary in order to communicate IP address updates.

https://www.whatismyip.com/port-forwarding/

You also have to ensure your firewall is set to accept requests from whomever is allowed to access the camera feed.

edit flag offensive delete link more

Comments

@Will Stewart: Can you please explain it in simple terms , I have very limited knowledge of Networking.

xMayank gravatar imagexMayank ( 2014-01-20 06:04:42 -0600 )edit

You would need to send the stream out over your public static IP address at a specific port. Thus, the LAN IP address of the camera translates into a port on your public IP, which protects the numbering of and access to your LAN from the outside world.

http://netforbeginners.about.com/od/p/f/What-Is-Port-Forwarding.htm

Will Stewart gravatar imageWill Stewart ( 2014-01-22 22:08:41 -0600 )edit
1

answered 2014-01-20 04:38:31 -0600

I think it should be possible using the VideoCapture interface! You can use the open function to specify the location of the stream.

edit flag offensive delete link more
0

answered 2016-11-16 20:31:54 -0600

Hi to all,

Once a WiFi IP camera is set up, you can move it around anywhere in your Wifi zone and view its stream from anywhere in the world. This almost solved all the range issues for my robot, and so I decided to buy one and explore. ('almost' because I plan to capture and process frames from the IP camera using OpenCV in my laptop, and take decisions on the movement of the robot.

edit flag offensive delete link more

Comments

I'm trying to capture images from the wifi camera but you have problems with the wifi router

ninas gravatar imageninas ( 2019-08-15 17:15:58 -0600 )edit

Question Tools

Stats

Asked: 2014-01-19 21:10:41 -0600

Seen: 3,028 times

Last updated: Jan 21 '14