I've been running motion for monitoring ip cameras for a couple of years now.
I haven't found much on line to help,optimize for a plug computer, so I thought I would write up what I've learned.
Hardware
I've used pogoplug V2 and V3 machines exclusively. The V2 is arm5 1200mhz with 256M RAM, the V3 is a dual core arm6 overclocked at 850MHZ.
Ive found the V3 better able to handle multiple cameras vs the V2. I'm currently running 4 cameras on the V3 and the "load" per top generally stays below 2, indicating the 2 CPUs can keep up with the load. Under the same conditions the V2 load exceeds 1 and continues to grow during periods of activity indicating the cpu isn't able to keep up with the requests.
although I've worked out some settings that keep the load near 1 on the V3 most of the time.
Tweaks
The big bottleneck seems to be during disk writes, so anything to reduce those seems to help
Creating individual movies for each event at least doubles the disk writes required vs just capturing jepg pictures. I also found it very painful to view them, since you can end up with hundreds of them in a day.
so I disable that feature with
$this->bbcode_second_pass_code('', 'Ffmpeg_capture_new off')
Instead, I use mencoder to create a single video each day from the jpegs. At 5 FPS, my daily video is 5 to 30 minutes long depending on the events of the day.
I have a cron job set that runs just before midnight, and I use the variables for date and time to make it all automated. Here is my script
$this->bbcode_second_pass_code('', 'mencoder "mf:///webcam/$(date +"%Y_%m/%d")/$1/*.jpg" -mf fps=5:type=jpg -ovc lavc -lavcopts vcodec=mpeg4:mbd=2:trell:vbitrate=1500 -vf scale=640:460 -oac copy -o /v5Video/webcam/timelapse/$(date +"%Y%m%d")$1movie.avi')
my jpegs are stored in /webcam/%Y_%m/%d/Camname/
%Y = Year in YYYY format
%m = month in MM format
%d = day in dd format
The files themselves are named %H%M%S%q-%v.jpg
%H =Hour ( 24 hour format)
%M =minute
%s=second
%q = frame# ( for that second)
%v
this naming convention works to ensure that mencoder puts them in the correct order.
in order to make sure that the date variables are correct when the script must start before midnight, but it can finish after midnight.
It appears that monitoring the video doesn't put that much load on the cpu, but recording it does, so be very cautious about how many pre and post action frames you keep. Mine saves 5 pre-event frames and 1 post event frames, then 2 frames per second during the motion. Most motion events takes less than 2 seconds. So a 2 second event will result in 9 jpegs. Adding 5 post event frames would add about 1/3 to that so the cpu is busy 1/3 longer with each event.
It's also important to use a mask file. Two of my cameras watch a busy street. With a mask file, motion knows to ignore the street, so I don't record every car going by. Instead it only records if the car comes in my driveway.
If your camera watches bushes or trees that get blown by the wind, you can use the mask file or turn on smart mask, which will automatically start ignoring areas with a lot of continous motion.
That having been said, you don't want to miss the important stuff. The threshold default setting is 1500. This means 1500 pixels must change in order to trigger an event. In order to set mine I turned on the text_changes feature and had someone walk around the yard to see what the reported pixel changes were! then adjusted accordingly. In my case I set it at 1000 and I occasionally record the neighbors cat in my yard.
The other important setting to look at is noise level. The default is 32. This doesn't appear to equate to pixels. With the default setting, my camera seemed to ignore any thing beyond about 15 feet from the camera, except really large objects. I adjusted mine to 8 and I might raise it to 10, but it picks up people from 30 feet away now.
Hope that helps someone,
Tom