Technical information about the files in this
directory, which supported The Amazing Chez Inwap
Backyard WebCam.
Note: The original set up was a
Pentium running Windows-95 and SnapCAP. It was replaced October
1998 by a 486-DX33 running Linux and a Sun SPARCstation working
in tandem. Last major hardware change: 9-Feb-1999.
By Joe Smith.
- Hardware
- Sony camcorder, Handycam Video 8, CCD-FX310
Mounted on a tripod just inside the sliding glass door facing
the backyard.
- VideoPix Video Frame Capture (VFC) card.
Plugs into an SBus slot on the SPARCstation, has 3 video inputs.
[SPARCclassic running SunOS-4.1.4 (Solaris-1.1.2)]
- Compiled binary programs
- Files that get uploaded
- Shell scripts and perl programs running on the home computers
- get-vfc - perl script to capture
images from all three inputs on the VideoPix card. Each image gets a
timestamp and is put into one of three directories: .video/1, .video/2
and .video/3.
- send-vfc - perl script to copy one
of the captured images to the primary web server.
Uses sunrise.pl to determine
daylight hours and sends the picture from the outdoor camera during the
day and the picture from the indoor camera during the night.
- Shell scripts and perl programs on the primary web server
- Other files
Image Capure
The Linux box that drives all this has two entries in crontab.
* * * * * backyard/get-vfc
*/5 * * * * backyard/send-vfc shell3.ba.best.com
The first one runs get-vfc once a minute. That perl
script decides whether it is time to grab a picture. If so, it connects to
the SPARCstation and runs vfc-snap there to snap a video frame capture on the
appropriate input port. The captured image is converted to JPG format and
text is added. The top says "Chez Inwap Outdoor Web Cam" or "Chez Inwap
Indoor Web Cam" and the bottom has the current date and time.
SPARCclassic workstation, running SunOS-4.1.4.
VideoPix SBus card.
Closeup of video input connectors.
The SBus card says "SnapShot Sun".
Cables; RCA to BNC for Video-1, RCA for Video-2, S-Video.
Image Transfer
The second 'cron' entry runs send-vfc every 5
minutes. This perl script selects the outdoor image during the day and
the indoor image during the night. It then copies the selected image
and capture.txt to the public_html/backyard directory on our primary web
server.
Two perl scripts are run every twenty minutes via 'cron' on the primary server
03 * * * * backyard/savecurrent.pl 00; backyard/hourly.pl -q
23 * * * * backyard/savecurrent.pl 20
43 * * * * backyard/savecurrent.pl 40
The first one, savecurrent.pl,
copies the current JPEG file (and its thumbnail GIF) from the
current-hour directory into the
current-today directory.
File Rotation
The second script, hourly.pl, moves any
thing older than 24 hours out of the current-today
directory to the current-yester directory.
Anything older than 48 hours is deleted.
Image Display
I had to resort to a bit of trickery to get the URL with
backyard/capture.jpg to work.
<A HREF="http://www.snapcap.com/">ArteMedia</A>'s
<A HREF="http://www.halcyon.com/artamedia/snapcap/wallofsnap.html">Wall
of Snap</A> and other sites refer to "capture.jpg", but the actual
image name keeps changing. The key is to convince the web server to run
a CGI script whenever "capture.jpg" was requested. This script,
capture.pl, reads
capture.txt for the name of the
JPEG file. It then sends the image (Content-type: image/jpeg) without
a Last-modified header so that browser won't cache the file.
That same script performs a different function when invoked as
<!--#exec cgi="capture.cgi"--> - it returns
<A HREF="mmDDHHSS.jpg"><IMG SRC="mmDDHHSS.jpg" WIDTH=320 HEIGHT=240></A>
This tells the browser to display the image at half size; clicking on the
image will display the full picture.
- UNIX httpd settings
- echo "AddType application/x-httpd-cgi capture.jpg" >>.htaccess
- ln capture.pl capture.jpg
- See above for crontab entries.
See also: Description of original set up
(Win95), recent pictures and
our gallery.