[-The Premise-]
To build a small box that does MPEG-2 video encoding, complete with archival and motion detection triggering (either by looking at the video or by having a motion detector attached to it). Each box will be connected to a surveillance camera and buffer its video to a central server. We planned to built a cheaper alternative to the AXIS 250S MPEG-2 Video Servers, which cost $800 each.

[-Hardware-]
Option 1 - Small Form Factor PC, processor dependent:
Video Capture Card - A card with a BT848 or BT878 chipset in a PCI slot.
Hard Disk Space - To store the captured MPEG-2 video streams.
CPU - Athlon XP1700+ to perform the video/audio encoding.


Option 2- Small Form Factor PC, hardware dependent:
Video Capture Card - A card with a BT848 or BT878 chipset in a PCI slot and MPEG-2 encoder chip.
Hard Disk Space - To store the captured MPEG-2 video streams.
CPU - Anything that can handle the audio encoding.

Shuttle SN41G2 - Small Form Factor Case with onboard LAN / sound input and output / video card / power.
I could not find any other small MicroATX/FlexATX cases.

At this point I had a decision to make: if we want to do MPEG2 encoding software-wise, we'll need a good processor and RAM. If we want to do it hardware-wise, we'll need a deep pocketbook for the capture card. It would probably be impractical to pay 200+ dollars to get a hardware encoder. However, I performed some tests and determined that to encode MPEG-2 at 30fps 720x480 progressive scan, we probably needed some hardware support. All-in-wonder cards are pretty pricey, and from doing research, don't have true hardware-based MPEG2 support (supposedly only speeds up the process by 15-20% or so). SAMPEG looked promising, as did the Kfir. We ordered a Kfir as it already had Linux drivers (more on that later).

Each box needed to send the compressed video out of a 100Mbit ethernet wire, so we don't need much hard drive sense, as we will not be doing a large amount of buffering.

In the future: the smaller the box, the better, as these are intended to be put in a drop ceilling. I wanted to look into some custom board design but did not have enough time. Axis does have reference boards I could program. I also looked into PC104-based boards, but found them to be way too expensive to be practical (a quick run-by on Ampro.com's website shows these in the upper 400-500s for a low-end model to 1000+ for something that could perform real-time MPEG2 encoding).

[-Software-]
An idea crossed my mind when I stumbled across this, which had a program called mpeg2encode, and found another program here called ImageMagick. I could probably write a script that used ImageMagick to convert files to YUV and frame-serve them to mpeg2encode. I discovered that Axis had a program called eye_get which can archive the images which can then be pushed from their cameras utilizing their own FTP facilities or be pulled off by a program running on the server. This project could be made INCREDIBLY easy by putting up Axis 2120 network cameras, using Linux boxes with very little processing power to run the scripts needed (eye_get->imagemagik->mpeg2encode). The 2120 even had built-in motion detection. However, the final target was to have progressive scan 704x480 30fps captures, which is beyond the specs of the Axis 2120.

However, I kept the idea of shipping JPEG frames and finishing the MPEG-2 compress elsewhere in mind. I can probably still use the imagemagik->mpeg2encode solution, using xawtv or bttvgrab to pull images from the capture card.

As for the capture card, I stumbled upon the follow websites:
http://pvr.sourceforge.net/
http://www.shspvr.com/forum/
http://ivtv.sourceforge.net/
which proved empty as their driver support was still in its early stages. I was poking around the V4L mailing list and found this:
"The new Hauppauge PVR card is a Bt878 with onboard MPEG 2 compressor and MPEG 2 decompressor hardware using the Kfir chipset. The Kfir MPEG2 chip does have linux drivers for it in the form of an
MPEG2 encoder card available via www.linuxtv.org. The Hauppauge PVR differs from www.linuxtv.org card in a few ways. It uses the same Kfir MPEG 2 chip, but Hauppauge have their own glue logic and interface asic. However, I have been talking to the right people in Hauppauge in the last few days and hopefully we can get all the information from them we need for a driver. If you use a Hauppauge WinTV PVR with the current bttv driver I've been told that video capture will work (with the Bt878 as normal) but you will not get any audio working as you need to initialise some of the new hardware to route the audio around the card. Of course the MPEG 2 chip will not work either."

This basically meant that our number one choice card, the WinTV, won't work. This is verified here; it only initializes for capture but can't use the MPEG2 chip. Again, the only thing that would probably work was the Kfir, so it was at this point we ordered one. It has a possible bug seen here, but we took our chances.

As for motion detection:
camE - rewrite of the xawtv webcam app
Camorama - Gtk/GNOME 2 webcam software
CamStream - C++/Qt collection of tools for webcams and other video-devices
GnomeMeeting - Linux H.323 compatible client for the Gnome desktop
Gqcam - QuickPict clone using GTK+ (for QuickCams)
Gspy - A Gnome security camera
Linux Motion Detection - watches a video device for activity
Motion - takes a snapshot when a change is detected
Nemesis - Linux video security system
ZoneMinder - Video motion detection and capture with user friendly web (PHP/MySQL) interface
I decided on ZoneMinder, with Nemesis being the backup to try if ZoneMinder didn't meet my expectations.

[-Stuff To Buy-]
CPU: AMD Athlon XP 1700+ - $50.00
Case: Shuttle SN41G2 - $260.00
Memory: KINGSTON KVR333X64C25/512 512MB 32x64 PC2700 DDR RAM - $63.00
HD: Maxtor 40GB 7200RPM Hard Drive Model # 6E040L0 OEM, DRIVE ONLY - $59.00

Software: Kfir Drivers on Gentoo Linux, using ZoneMinder to grab an image, analyze it, and send it to imagemagik->mpeg2encode if a change was detected (or ffmpeg as shown in this article).
The idea was the put the Kfir into this box and test it out, but I ran out of time.

[-What's Next-]
I will attempt to built the prototype above and also try to reprogram an Axis Video Server to do what we want it to do. Hopefully once the project is ironed out and tested, I can work toward an even smaller embedded solution, like the one here. Hopefully it won't cost $1400 either...

Next Step: Onto the prototype!

[-Thanks To-]
Christopher G. Atkeson
Newegg

Kenneth Yu, Last Updated 5.02.03