Description and Background

Details

The OsKuroBox is a LinkStation/KuroBox/NAS with NightVision Motion Detection and Sound Detection/Recording. Initially, my project was to take a LinkStation2 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 features:

In this form it could also be used for video/audio surveillance or keeping an eye/ear on whatever. The range with the basic nightvision-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.

Installation

Essential Packages

OpenEmbedded

Debian

Extra Packages

Configuration/Usage

Motion

SoX

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:

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).

Webserver

Network

dyndns.org

First, you'll need to have an account a dyndns.org. Basic accounts are free. See the site for details.

Secondly, you'll need to configure and run ddclient. My current config at ddclient/ddclient.conf reads something like this:

See the ddclient site or ddclient man page for more details. Starting it is as simple as

ddclient

You may have to open ports up on your router in order for connectivity and access to work if you want to allow others outside to see your webcam images and any gallery pages. The dyndns.org site has some help/howto's for getting ddclient set up and network issues resolved.

Avahi/Bonjour

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

nano /etc/avahi/services/motion-realtime.service

and give it this content, so that the realtime Motion video image of your webcam will be visible via the web to your intranet.