How to capture video stream via http with an IP camera using emgucv in c# -


i'm having hardest time trying find solution think simple. capture constructor (string) in emgu.cv should "create capture file or video stream."

however, cannot capture code in c# despite ip camera (axis) allowing video stream follows: request motion jpeg video stream -> http://myserver/axis-cgi/mjpg/video.cgi (by way, according manufacturer, "a successful request returns continuous flow of jpeg images. content type multipart/x-mixed-replace , each image ends boundary string .")

fyi, camera server require username , password login, haven't been able figure out how include capture yet, either... supposed make httpwebrequest first , capture, or supposed more complicated? not sure if login may issue since didn't specific error on this, suspect webrequest may necessay, don't know how include...

stripped down code in form.cs:

capture _capture = null; //camera string sourceurl = "http://192.168.0.90/axis-cgi/mjpg/video.cgi"; _capture = new capture(sourceurl); image<bgr, byte> imgoriginal = new image<bgr, byte>(_capture.retrievebgrframe().tobitmap()); 

then try display imgoriginal in imagebox. however, @ last step above, generates error says "unable create capture..." or this.

shouldn't simple emgucv or mistaken? if can me figure out how capture image, can take there processing images. thank in advance!

there few things might want try.

  1. first can use fiddler(its proxy monitor web traffic) check when application making request server response coming back.
  2. second if server requires authentication using http basic authentication might want try call url like

    string sourceurl = "http://username:password@192.168.0.90/axis-cgi/mjpg/video.cgi"; _capture = new capture(sourceurl);

or else have send parameters in authorization header

  1. you can use native cvinvoke function check if helps.the code this.

    capture _capture = new emgu.cv.cvinvoke.cvcreatefilecapture("http://username:password@192.168.0.90/axis-cgi/mjpg/video.cgi");

please refer this answer more info