This feels like a huge cop-out. After failing to get it to compile from source or install from one of the .debs, I managed to get it to install with no problems at all using an Ubuntu .deb
motion_3.2.12-2ubuntu1_amd64.deb
This feels like a huge cop-out. After failing to get it to compile from source or install from one of the .debs, I managed to get it to install with no problems at all using an Ubuntu .deb
motion_3.2.12-2ubuntu1_amd64.deb
… well, not quite. But a big long bit of wood, a (really) heavy planter (which I usually use to sit on), and some parcel tape. Nothing that the BBC Springwatch tech-crew will feel too threatened by but I’m feeling pretty pleased with myself.
Sometimes thinking about things too much is a bad idea. I wanted the webcam, away from the building, pointing at the nestbox. And I couldn’t work out how to do it. So I went for a walk. Around the garden, and around the garage. And 10 minutes later …
Looking good but despite tweaking with mask files and experimenting with the configuration for motion I still end up with over 10,000 images at the end of the day, a random snapshot of which get upload to my flickr photostream.




















This crops up periodically and it surprises me that with all the free tools you get with linux that there’s nothing (that I can find, at least) that will allow me to keep a folder tree within a manageable size. I did write a shell script to do this but I’ve lost it. With a webcam using motion often triggering over 5000 images a day (four times that if it’s windy) I need to have some automated housekeeping to purge the older images.
I think what I had before was something that had a user-definable value (e.g. 5GB) and it would iteratively recurse a directory tree, deleting the older directories until the space taken up dropped below the threshhold. There are problems with this (e.g. accidentally Tagging or touching an old jpeg) that causes the directory time stamp to be updated. But all these thousands of jpegs are piling up and I’ll have to address this sometime soon.
Still loads of noise. Time for an extreme mask file:
That’s just a small area around the nest-box entrance. But still an awful lot of images
I wonder if motion is actually using the mask file. Presumably there’s a debug option I can switch on …
The tweaks don’t seem to be having much effect. Even with the lightswitch option set to 80, and the smart_mask_speed set to 10, it’s still pretty wild and windy out there.
# Dynamically create a mask file during operation (default: 0) # Adjust speed of mask changes from 0 (off) to 10 (fast) smart_mask_speed 10 # Ignore sudden massive light intensity changes given as a percentage of the picture # area that changed intensity. Valid range: 0 - 100 , default: 0 = disabled lightswitch 80
So it has to be the mask file. The way the mask file works is by using an identically sized image as the webcam and making all areas to be monitored white, and all not to be monitored black. Or is it the other way around? I did this using the gimp and after a couple of false starts it turned out to be pretty easy. Here’s my rough notes:
You need to save this as a ‘pgm’ file. For some reason a pgm file is huge compared to a jpeg, e.g.
-rw-r--r-- 1 dougie dougie 691254 2011-05-25 14:24 mask1 - 25May2011_1407.54-00.pgm -rw-r--r-- 1 dougie dougie 12639 2011-05-25 14:26 mask1 - 25May2011_1407.54-00.jpg
although I’m sure it’s possible to reduce the size there doesn’t seem much need at the moment.
Now it’s just a matter of pointing the appropriate option in motion.conf at the mask file and seeing what happens.
Here’s my first attempt:
Hmmmm, there are a few options in the motion.conf file I haven’t seen before. Or at least, that I can’t recall having seeing before. These look promising:
# Dynamically create a mask file during operation (default: 0) # Adjust speed of mask changes from 0 (off) to 10 (fast) smart_mask_speed 0 # Ignore sudden massive light intensity changes given as a percentage of the picture # area that changed intensity. Valid range: 0 - 100 , default: 0 = disabled lightswitch 0
The trouble with creating a mask file is that it assumes the camera stays fixed in the same position, and that’s pretty unlikely. So I’ll try tweaking these settings and see what happens. Far less effort. Currently running at about 1000 images an hour. Let’s see if I can get that down a bit …
So here’s the problem:
This is a USB webcam pointing at the nestbox. The software is motion, running on a Linux Mint box, and uploading to my flickr photostream using flickr_upload. There are a couple of homebrew shell scripts involved too.
The trouble is, even though the motion config file can be tweaked and various things twiddled to adjust various thresholds, most of which are black magic, all it needs is a windy day and I find I’ve got 40,000 or so JPEGS on my harddrive. All of blades of grass blowing in the wind.
So I think I’m going to have to create a mask file. I can’t remember how to do it, even though I’ve done it many times before. I’ll do that later. And I’ll write it down.