0

I am working on a task in which I have to access live stream of an IP Camera (Edimax IC-3110P) using OpenCV 3. My Host system is Windows 10 and I have used Virtualbox to run Ubuntu 16.04 (Xenial) 64-bit. I am using C++ and Code::Blocks(IDE).

Finally I was able to access the livestream through Microsoft Visual Studio(in Windows 10) with the following program.

#include <stdio.h>
#include <opencv2/opencv.hpp>
#include <iostream>

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

// This works on a D-Link CDS-932L

const std::string videoStreamAddress = 
"http://admin:1234@192.168.2.3/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;
    }

    }

However, in Ubuntu with the same program in Code::Blocks it shows "Error loading stream video or file."

This camera doesn't support Linux OS but I can access the livestream through a browser's address bar(in Ubuntu) but not through my program.

Does anyone have any idea how to solve this?

Thank you.

Winbuntu
  • 127
  • 1
  • 4
  • 15
  • 1
    Is there any proxy configured for your browser? Looks like a network setting problem – Jean-Baptiste Yunès Apr 30 '18 at 12:05
  • 1
    try with `http://admin:1234@192.168.2.3/mjpg/1/video.mjpg` at least by [ispyconnect](https://www.ispyconnect.com/man.aspx?n=Edimax) you are missing the `/1/` not sure how true is this, since this changes for all camera models :S but is worth trying it out – api55 Apr 30 '18 at 12:50
  • I don't know about the proxy. I am using my office internet. How do I check it? @Jean-BaptisteYunès – Winbuntu Apr 30 '18 at 12:58
  • Still the same error when I changed the string. What do you mean by "ispyconnect" and how do I do that? @api55 – Winbuntu Apr 30 '18 at 12:59
  • 1
    that is the name of the webpage... they have the links for mjpeg and rtsp for several cameras... which sometimes cannot be found in the manual or by normal means... (I think they have a software too to connect to cameras...) Anyways, another question would be, how did you install OpenCV? – api55 Apr 30 '18 at 13:13
  • @api55 I did it through terminal in Ubuntu using a youtube video as a guide. I checked out the iSpyconnect website but do they have links for Ubuntu too? I am not sure how should I use it. – Winbuntu Apr 30 '18 at 13:18
  • 1
    @Winbuntu the links are via http or rtsp protocols, they are not dependent in OS (maybe on firewalls though). I asked about how it was installed, because you may try to use either FFMPEG or gstreamer (depending on which one was used at the moment). – api55 Apr 30 '18 at 13:56
  • https://www.youtube.com/watch?v=jS7To92cnds This is the youtube link how I installed Ubuntu through terminal. You can check it out. What do you think could be the problem here with the Livestreaming through Code::Blocks in Ubuntu? @api55 – Winbuntu Apr 30 '18 at 14:03
  • @api55 do you know what might be the solution? – Winbuntu May 02 '18 at 07:22
  • 1
    I am not sure what could be wrong... your library is compiled with libav ( similar to FFmpeg) if you followed that video.... you can always try to ping the camera from console... however for me it seems that either your opencv (and dependencies) version installed does not work with mjpeg or it could be some firewall of the vm. You can also try using python with cv2 and urllib to see if it works.. look to this [link](https://stackoverflow.com/questions/21702477/how-to-parse-mjpeg-http-stream-from-ip-camera) for a fast to copy python solution... – api55 May 02 '18 at 09:51
  • Thanks I will try it @api55 – Winbuntu May 02 '18 at 11:31

0 Answers0