Difference between revisions of "Edimax"

From ZoneMinder Wiki
Jump to navigationJump to search
Line 40: Line 40:
?>
?>
</pre>
</pre>
http://www.zoneminder.com/forums/viewtopic.php?t=13587&highlight=cameras

Revision as of 18:16, 22 July 2009

  • IC1500

The edimax IC 1500 delivers a strange form of motion jpeg with a little help from a little script on your webserver you should be able to view the motion jpeg stream in zoneminder:

<?php
function handlejpeg($jpeg) {
  if(strlen($jpeg)) {
    echo "--video boundary--\r\n";
    echo "Content-length: ".strlen($jpeg)."\r\n";
    echo "Content-type: image/jpeg\r\n";
    echo "\r\n";
    echo "$jpeg"."\r\n\r\n";
  }
}
  @ini_set('zlib.output_compression', 0);
  @ini_set('implicit_flush', 1);
  header('Content-Type: multipart/x-mixed-replace;boundary=--video boundary--');
  $handle = fopen("http://admin:1234@<YOURHOST>/snapshot.cgi", "rb");	
  $cl=0;
  $jpeg=NULL;
  if ($handle) {
    while (!feof($handle)) {
        $buffer = fgets($handle, 4096);
        if(trim($buffer)=="--myboundary") {
           $CT=fgets($handle, 4096);
           $CL=fgets($handle, 4096);
           $crap=fgets($handle, 4096);
           $cl=preg_replace("/Content-Length: /",'',trim($CL));
           handlejpeg($jpeg,$i);
           $jpeg=NULL;
           for($j=0;$j<$cl;$j++) {
             $jpeg.=fgetc($handle);
           }
        }
    }
    fclose($handle);
}
?>

http://www.zoneminder.com/forums/viewtopic.php?t=13587&highlight=cameras