Wednesday 4 June 2014

How to make timelapse trail cam videos

I've had my Trail Camera sited in a variety of places in my garden for a few months now, with varying degrees of success.  The camera is described in this post, and can be configured to capture either video or images.

The theoretical maximum resolutions of each mode are:
Video: 640 x 480
Image:  8 Mega Pixels - I'm not sure how this translates to an actual resolution

It has night and daytime modes, Night time illumination is achieved via the in-built infra-red (IR) LEDs that surround the camera.  Not surprisingly, captured image quality is much better in daylight.  The following images are the full 8MP.

It also has a weird intermediate mode, which seems to be in low light where the IR illuminators haven't come on, however its IR filter has come off which give some interesting images.  In the following set, the top image is low light in the evening.  IR illuminators havent come on, but the internal IR filter is off the camera leading to this 'ghostly' image.  The one below is a true night time image - illuminated by the camera's IR LEDs.

Interestingly, it looks like the image resolution is automatically dropped for night time images as the field of view seems narrower - these two images are taken approx 6 hrs apart without the camera having been moved.  For the best quality images I've found that a cloudless sky with a full moon gives the best images, producing a more evenly lit scene.  My favourite bit of footage so far is that of a badger mother + cub tucking into a slow worm.  I've uploaded the original clip here:

Pros & cons
Using a trail cam is a great way of observing wildlife behavior that you wouldn't normally see (I did cheat a bit and put down peanuts in the area in front of the camera an in the long grass to keep the badgers interested).  One limitation is that once its set to video or images, it stays that way until changed.  A cool option would be to have it take a high res image, then capture a video clip - unfortunately not an option.

Make a time-lapse of still images
I've found that on some nights I have a load of okay-ish images, but nothing that would win any prizes.  I took a leaf out a stop-frame animation project I did with one of my kids on her Raspberry Pi.  I used the same approach generating the video in a post I did on how to make time lapse videos of clouds.
The advantage of doing this is that you effectively increase the resolution of the video, since I'm using the higher resolution still images.  The result is kind of jerky but I think its an interesting effect.  The following clips are encoded at 4fps:

To achive this, I've used mencoder in Ubuntu - but this should work on a mac PC too.  There's an install guide for mencoder on the Rapsberry Pi here, but you're better off running in a full-fat linux system such as Ubuntu or on a Mac PC.

ls *.jpg > list.txt
mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=8000000 -vf scale=1920:1080 -o video.avi -mf type=jpeg:fps=4 mf://@list.txt

Selection of 'Time-lapse' videos from Trail cam still images: 
These are best viewed full-screen with HD option selected

1) Adult female badger 'in-milk'.  You can see that this badger's udders are clearly visible suggesting she has cub(s)

2) Soggy female badger and her cub.  I cant be sure this is the same female badger, but if so, this is one of her cubs with her.

3) ...and finally badger cub on its own:

Make use of poor quality inages
I had one night where many badgers stopped by for peanuts, but unfortunately I either had rain on the lens, or its was misty.  The resulting images were no use, but strung together into a time-lapse, gives an idea of what is going on.... Lots of badgers

Still used to create the following time-lapse

I'll sign off with a couple of new additions: