Opencv read video stream from Zoneminder

asked 2013-11-12 12:41:28 -0600

nevermore gravatar image

Hello all,

I'm trying to read and display a video stream from Zoneminder on Ubuntu.

I am using eclipse with opencv. The code is here:

#include <cv.h>
#include <highgui.h>
using namespace cv;
int main(int argc, char *argv[])

   { Mat frame;
     namedWindow("video", 1);

//the next line is to capture the video stream of the URL from Zoneminder

      VideoCapture cap("http://10.11.225.229/cgi-bin/nph-zms?mode=jpeg&monitor=1&scale=100&maxfps=5&buffer=1000&connkey=456671&rand=1384280400");
     while ( cap.isOpened() )
     {
         cap >> frame;
         if(frame.empty()) break;

         imshow("video", frame);
         if(waitKey(30) >= 0) break;
     }

    return 0;
}

Note that I copied the URL(http://10.11.225.229/cgi-bin/nph-zms?mode=jpeg&monitor=1&scale=100&maxfps=5&buffer=1000&connkey=456671&rand=1384280400) from the image information on the monitor of zoneminder.

This code works for my webcam, as well as other ip cameras. I also tested the URL in VLC, and it works fine.

Does anyone know what should I do to read the video stream from Zoneminder?

Thank you very much!

edit retag flag offensive close merge delete