- 1 Description and Background
- 2 Installation
- 3 Configuration/Usage
Description and Background
Initially, my project was to take a LinkStation and outfit it so it can take night-time infrared still snapshots and even movie clips of whatever wanders by the animal feeders in our back yard. It morphed into something a bit more involved. Here's what it does:
- night-time & daylight snapshots and movies, triggered by motion detection
- daylight time-lapse movies of the feeding area
- records sounds at feeding area and backyard area
- optional selective sound detection/silence trimming
- webserver for Motion's control webif and minimal real-time-image webcam (LAN only)
- avahi (Bonjour) to advertise (to LAN) these two web services provided by Motion
- webserver for a gallery page (internet access for outside world)
- dyndns.org client for DNS to accomodate internet access of above item
- cron-based scheduling, rotation and cleanout of the image files
- optional USB wireless capability (so no ethernet cable is needed)
- optional weatherproof housing for components (it rains and snows out there)
In this form it could also be used for video/audio surveillance or keeping an eye/ear on whatever. The range with the basic IR-capable camera that is used is limited, so I'm working out how to improve that with some auxiliary lighting. Higher-performance IR/nightvision-capable cameras could offer a better experience, especially if this were implemented on a machine with a faster, more powerful processor.
What's with the name?
- First, Oskuro=oscuro= dark, in spanish. Yeah, "Oscuro" was the only word I could find that had any semantic connection with "dark" and also had either a "Kuro" or "Link" in it.
- Secondly, this project is not without inspiration from others: sylver had produced the SeKuroBox years back and I liked the catchy name and the great concept, but I wanted to take the idea another direction. I had grown up on a farm and hunted regularly, so I'm fascinated by animals (especially the wild ones). It is essentially an LS outfitted with a night-vision camera and motion detection software, a "Late-Night CritterCam" if you will.
- The daytime camera has an integrated USB microphone, so I decided to add in sound recording capability. That's the "Plus" part.
Why the LS2?
Of all the LS boxes that Buffalo built, the LS2 is perhaps the least endowed, most restricted. It has no FPU, and only one serial port (which is used by the microcontroller). Well, if this much can be done w/ this box, more could be done with other boxes. This project will work best on a NAS device that has enough CPU power to process both sound and video.
- LS2 (or any Linux box w/ USB support, FPU and stronger processor are better),
- up to 2 USB cameras (compatible w/ either the gspca or the uvc driver),
- one Logitech QuickCam for Notebooks (w/ integrated USB microphone),
- one ViMicro NightVision USB WebCam,
- optional USB wireless stick or use of a wireless ethernet bridge,
- optional motion activated lighting (this is a non-computer item),
- optional weatherproof box(s)/housing(s) for all items if outside,
- long enough ethernet cable and electrical extension cord (or optional other power source).
- basic foonas lsmipsel/LS2 image,
- gspca webcam module,
- Motion + dependencies,
- SoX for sound recording/detection and silence trimming (http://www.linuxplanet.org/blogs/?cat=813),
- various other webcam-ish apps & scripts/configurations.
The official/current SoX man page gives a lot of good documentation. Still, I had to do some experimentation to get it to work on the LS mipsel w/ the results I was looking for. The hard part was minimizing/eliminating dropouts during recording, and editting out all the the uninteresting "silence".
There are two ways to use SoX to do surveillance recording and processing:
1. Record everything during a set timeslot of day, and then process out the silence during off-hours.
On my LS2 this would record a track in aiff format w/ no dropouts with quick/low quality:
rec -c 1 soundbite.aiff rate -q
To clean that clip up and remove the silence, something like this would work:
sox soundbite.aiff soundbite-cleaned.aiff silence 1 2 2% -1 2 2%
The best way that I've found to do this is to schedule cron to record sound during known good window times (like the first 4 hours of morning, last 3 hours before sunset, if you are trying to record bird calls), and then also schedule cron to process out the silence during the nighttime hours.
2. Record and trim out the silence on-the-fly, all in one step. This is ideal on units that have a processor that is more powerful than the LS2's mips. An example of such a command is this:
rec -c 1 --buffer 4096 clip$(date +%Y%m%d%H%M).aiff rate -q silence 1 00:00:0.1 .1% -1 00:00:0.1 .1%
which records single-channel (mono) sound using a 4MB buffer to a aiff file with time-stamped filename, using quick (fast, low quality) data rate, and edits out all silence under the .1% threshhold. The .1% threshhold is pretty low, and this would pick up us talking 15 feet away. The buffer and rate flags seemed to keep the load on the processor a little lower and minimize dropouts (though they will occur on slower machines).
Just about any service that runs in Unix/Linux can be advertised in a user-friendly way via Avahi/Bonjour so that users can pick it up effortlessly in web browsers, printer setup utilities or finders. Motion's Control Webif and Realtime Video are excellent candidates for this. In Gnome's Epiphany web browser and OS X's Safari, they would appear like this, respectively:
A default installation of Avahi should be just fine to start with. All you will probably need to add are two .service files to advertise to any Bonjour/Avahi capable browsers (Safari,Epiphany, etc.). We will assume that you are using the default ports of 8080 and 8081 for the Motion Control Webif and Motion Video, respectively. Create two files: First
and give it this content, so that the realtime Motion video image of your webcam will be visible via the web to your intranet.
<?xml version="1.0" standalone='no'?> <!DOCTYPE service-group SYSTEM "avahi-service.dtd"> <service-group> <name replace-wildcards="yes">%h Motion Realtime Image</name> <service> <type>_http._tcp</type> <port>8081</port> </service> </service-group>
should have the following content so the the Motion Control Webif will be advertised:
<?xml version="1.0" standalone='no'?> <!DOCTYPE service-group SYSTEM "avahi-service.dtd"> <service-group> <name replace-wildcards="yes">%h Motion Control Webif</name> <service> <type>_http._tcp</type> <port>8080</port> </service> </service-group>
You should not have to restart Avahi for this to be advertised - it should work immediately.