Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Error while trying to display video stream from IP camera via Internet

I have small code which is able to display the IP camera using its local IP address. But when the camera is used by its Public IP address i am unable to get the live feed.

include "IpCamTest.h"

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

// This works on a D-Link CDS-932L
//const std::string videoStreamAddress = "http://aID:[email protected]:80/video.cgi?resolution=640x360&req_fps=50&.mjpg";
const std::string videoStreamAddress = "http://id:[email protected]:8088/video.cgi?resolution=640x360&req_fps=50&.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;
}

}

Error while trying to display video stream from IP camera via Internet

I have small code which is able to display the IP camera using its local IP address. But when the camera is used by its Public IP address i am unable to get the live feed.

include "IpCamTest.h"

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

// This works on a D-Link CDS-932L
//const std::string videoStreamAddress = "http://aID:[email protected]:80/video.cgi?resolution=640x360&req_fps=50&.mjpg";
"http://aID:[email protected]:80/video.cgi?resolution=640x360&req_fps=50&.mjpg";
const std::string videoStreamAddress = "http://id:[email protected]:8088/video.cgi?resolution=640x360&req_fps=50&.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;
}

}} warning: Could not find codec parameters (../../modules/highgui/src/cap_ffmpeg_impl.hpp:540) Error opening video stream or file