I try to get a webcam image direct to my PHP script on a debian system. For this, I tried to open a file handling to /dev/video0, but that doesn't work. Using the software "streamer" I got an image to the disk, the webcam works on /dev/video0
I don't want to save the image to the disk first, because I need to refresh it in a short interval. My idea is to get an image direct to the standard output and use php passthru to pipe the output to the client browser:
$header("Content-type: image/jpeg");
passthru('avconv /dev/video0 someparamters for direct output');
I hoped that avconv has the option to push the image to the standard output, but I could not find any option like this. Is there a possibility to get the webcam image (via avconv or another tool) direct in php as an binary stream?
Thanks a lot! Sebastian
This works without the need of a temporary file:
(from https://gist.github.com/megasaturnv/a42ed77d3d08d0d3d91725dbe06a0efe)
This also works in an img tag: https://gist.github.com/megasaturnv/6e5965732d4cff91f2e976e7a39efbaa