So I've been playing and got this to work: It's giving me aprox 5 fps. I plan on rewritting it in C using INT instead of CHAR - should be 3? 4? times faster.
Code: Select all
<?php
$len=0; $data = ""; $curfrm = "";
$fd1 = @fopen ("/dev/video0", "rb");
while ( $data = fread ($fd1, 4096) )
{
$m = strpos($data, 'Exif');
if ($m > 0)
{
$tailofframe = substr($data, 0, $m-6);
$headofnew = substr($data, $m-6);
$curfrm = $curfrm . $tailofframe;
$len = strlen($curfrm);
$fn = "/run/shm/ras~.jpg";
$fd2 = @fopen ($fn, "wb");
fwrite ($fd2, $curfrm, $len);
fclose ($fd2);
shell_exec("mv /run/shm/ras~.jpg /var/www/html/ras~.jpg ; mv /var/www/html/ras~.jpg /var/www/html/ras.jpg" );
$curfrm = $headofnew;
} else {
$curfrm = $curfrm . $data;
}
}
?>
![Image](http://blackforest-co.com/cam1.jpg)
That's true color - this morning, the sun, the clouds, just right, the world is ... pastel.