Skip to content

Instantly share code, notes, and snippets.

@tmbdev
Created December 29, 2014 05:27
Show Gist options
  • Save tmbdev/66f71f8fc8973f9eb4c8 to your computer and use it in GitHub Desktop.
Save tmbdev/66f71f8fc8973f9eb4c8 to your computer and use it in GitHub Desktop.
simple webcam server in Shell
#!/bin/bash
port=8899
send_header() {
cat <<EOF
HTTP/1.0 200 OK
Content-Type: image/jpeg
Refresh: 10
Connection: Close
EOF
}
while true; do
(
{ send_header; vgrabbj -i sxga -d /dev/video0 -a -z 10 -q 100; } | nc -l $port
) > /tmp/server.out 2>&1
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment