From charlesreid1

Line 104: Line 104:
===Monitoring stream===
===Monitoring stream===


To monitor the camera stream, visit port 8080.
The monitoring stream is supposed to be available on port 8080. It was not.
 
quite literally the only thing open was port 8081, the control port:
 
<pre>
$ nmap 192.168.0.111
 
Starting Nmap 6.47 ( http://nmap.org ) at 2016-08-17 12:33 PDT
Nmap scan report for 192.168.0.111
Host is up (0.017s latency).
Not shown: 998 closed ports
PORT    STATE SERVICE
22/tcp  open  ssh
8081/tcp open  blackice-icecap
 
Nmap done: 1 IP address (1 host up) scanned in 1.78 seconds
</pre>


===Control stream===
===Control stream===

Revision as of 19:34, 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:

USBCamera1.jpg

USBCamera2.jpg

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:

MyFirstUSBWebcamPhoto.jpg

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:

USBWebcamPhoto2.jpg

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

Start motion daemon

To start the motion daemon:

$ sudo motion
[0] [NTC] [ALL] conf_load: Processing thread 0 - config file /etc/motion/motion.conf
[0] [ALR] [ALL] conf_cmdparse: Unknown config option "sdl_threadnr"
[0] [NTC] [ALL] motion_startup: Motion 3.2.12+git20140228 Started
[0] [NTC] [ALL] motion_startup: Logging to syslog
[0] [NTC] [ALL] motion_startup: Using log type (ALL) log level (NTC)
[0] [NTC] [ALL] become_daemon: Motion going to daemon mode
$ 

Ensure it is running:

$ ps aux | grep motion
root      3239 10.5  1.2  55940 10692 ?        Sl   19:30   0:01 motion

Ensure it is listening for connections:

$ sudo netstat -apt
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name
tcp        0      0 *:tproxy                *:*                     LISTEN      3239/motion

Monitoring stream

The monitoring stream is supposed to be available on port 8080. It was not.

quite literally the only thing open was port 8081, the control port:

$ nmap 192.168.0.111

Starting Nmap 6.47 ( http://nmap.org ) at 2016-08-17 12:33 PDT
Nmap scan report for 192.168.0.111
Host is up (0.017s latency).
Not shown: 998 closed ports
PORT     STATE SERVICE
22/tcp   open  ssh
8081/tcp open  blackice-icecap

Nmap done: 1 IP address (1 host up) scanned in 1.78 seconds

Control stream

To control the camera, visit port 8081.

Flags