Camera Server

From NYC Resistor Wiki

Notes on the camera server[edit]

Adjusting the v4l frame buffer[edit]

Before you do anything you have to run the following as root (sudo will not do).

#!/bin/sh
v4l-conf -c /dev/video0 -a 0xd8000000
v4l-conf -c /dev/video1 -a 0xd8000000
v4l-conf -c /dev/video2 -a 0xd8000000
v4l-conf -c /dev/video3 -a 0xd8000000

There is a script /usr/bin/fix-v4l which will do this.

Using mplayer to look at a camera[edit]

mplayer -tv device=/dev/video0:driver=v4l:width=640:height=480:outfmt=i420:norm=ntsc \
  -vc rawi420 -vo xv tv://

Replace /dev/video0 with /dev/video1..3 for cameras 2..4.

Existing Monitor Solution[edit]

/usr/local/bin/videorecord.pl is run at startup. It works like this:

  1. Use mplayer to grab 10 frames from the camera (need 10 to get capture going reliably)
  2. Move the 10th frame to /var/www/localhost/htdocs/current.jpg
  3. Erase the other 9 frames
  4. Fork and ftp current.jpg to ftp.jplt.com in the background
  5. Record 60 seconds of m4v video to /var/www/localhost/htdocs/video/YYYY-MM-DD_hhhmmm.m4v
  6. Rinse and repeat

It runs as justin. I've hacked up some scripts to get it to init properly in the background, even though it's a perl script.

IMPORTANT: You will see a zombie process from the background ftp process occassionally. Don't panic, it will be cleaned automatically.