warning: Error opening file (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:578)

5.8k Views Asked by At

I cannot access ipcamera on opencv, I'm using ipcctrl app to view camera preview and it's working fine, but when I try to paste the URL into my code it displays warning: Error opening file (/build/opencv/modules/videoio/src/cap_ffmpeg_impl.hpp:578) what's the problem here ?here is the proof that it is working fine in ipcctrl

cv::Mat imgFrame1;
cv::Mat imgFrame2;

cv::VideoCapture capVideo;
const std::string videoStreamAddress = "http://admin:[email protected]:8088/mjpeg.cgi?user=USERNAME&password=PWD&channel=0&.mjpg";

std::vector<Blob> blobs;

cv::Point crossingLine[2];

int carCount = 0;
std::ofstream writer;
writer.open("cars.txt");
writer.close();

capVideo.open(videoStreamAddress);
if (!capVideo.open(videoStreamAddress)) {                                                 // if unable to open video file
    std::cout << "error reading video file" << std::endl << std::endl;      // show error message
    _getch();                   // it may be necessary to change or remove this line if not using Windows
    return(0);                                                              // and exit program
}
1

There are 1 best solutions below

0
On BEST ANSWER

I already solved this problem, turns out that I have an incorrect URL for the videostream address, the hard part is my camera is not that known and had a little documentations about how to configure it. I used the ispy app to generate a proper URL for my kedacom camera, tested it on VLC and on the app and viola ! it worked.