RaspberryPi/USB Camera: Difference between revisions
From charlesreid1
| Line 39: | Line 39: | ||
==Motion program for camera stream== | ==Motion program for camera stream== | ||
You can also stream from your camera using the motion program. | You can also stream from your camera using the motion program. (Apparently. Haven't gotten it working yet.) | ||
The problem: can't stream images using the motion program. I know the camera works with the Pi b/c I can capture still images, so it isn't a power issue. I can see motion dumping out still images, so it isn't a communication issue with the camera. | |||
===Installing motion=== | |||
<pre> | <pre> | ||
$ apt-get install motion | $ apt-get install motion | ||
</pre> | </pre> | ||
===Configuring motion=== | |||
Now modify the motion config file to allow for webcam streaming: | Now modify the motion config file to allow for webcam streaming: | ||
| Line 56: | Line 62: | ||
stream_localhost on | stream_localhost on | ||
webcontrol_localhost on | webcontrol_localhost on | ||
</pre> | </pre> | ||
| Line 64: | Line 69: | ||
stream_localhost off | stream_localhost off | ||
webcontrol_localhost off | webcontrol_localhost off | ||
</pre> | </pre> | ||
Streaming happens on port 8081 (also set in the configuration file). | |||
=Flags= | =Flags= | ||
Revision as of 19:24, 17 August 2016
Motivation
I'm done trying to get this cheap-o Pi camera, with the clumsy ribbon cable, to try and work. The whole design, all of it reeks of cheaply-manufactured hardware incapable of anything but the most inane projects. (Hence the plethora of "how to photograph your cat" videos, and nothing more interesting or heavy-duty.)
The Hardware
I ordered a USB camera (1080 P, 2 MP?) from Amazon:
Setup/Usage
The camera didn't come with instructions, but controlling it was insanely easy [1]:
$ apt-get install fswebcam $ fswebcam image.jpg $ python -m SimpleHTTPServer 8000
Then point browser to 192.168.0.111:8000, and voila, the image is there and ready:
Better Pictures
For best quality, use:
fswebcam -r 1280x720 --no-banner image.jpg
this results in a better image resolution without the obnoxious timestamp banner:
Motion program for camera stream
You can also stream from your camera using the motion program. (Apparently. Haven't gotten it working yet.)
The problem: can't stream images using the motion program. I know the camera works with the Pi b/c I can capture still images, so it isn't a power issue. I can see motion dumping out still images, so it isn't a communication issue with the camera.
Installing motion
$ apt-get install motion
Configuring motion
Now modify the motion config file to allow for webcam streaming:
$ sudo vim /etc/motion/motion.conf
change these lines:
stream_localhost on webcontrol_localhost on
to these lines:
stream_localhost off webcontrol_localhost off
Streaming happens on port 8081 (also set in the configuration file).
Flags
