Thursday, May 23, 2013

Time-Lapse photography using the RPi camera module.

I've already mentioned this excellent post on this topic which, for me at least, is truly groundbreaking.
Everything in this post works to perfection, but I'll just add some relatively minor personal observations here.

First, the red LED that turns on for every shot can be a nuisance if you're taking your time-lapse shots through a pane of glass as the LED reflects from the glass into the camera lens and shows up on your shots.
A potencial solution is a very minor addition to /boot/config.txt.
Unfortunately, this no longer works (look here, too).
However, as this is undoubtedly a firmware issue, I'm certain it'll be fixed in short order.
In the meantime, I'm using a couple of layers of insulating tape over the LED to avoid this problem.

The command used in the DesignSpark post to join up all of the time-lapse photos into a single .avi film is the following:

$mencoder -nosound -ovc lavc -lavcopts vcodec=mpeg4:aspect=16/9:vbitrate=8000000 -vf scale=1920:1080 -o tlcam.avi -mf type=jpeg:fps=24 mf://@stills.txt
This works fine but ONLY as long as all of your .jpg files contain data.
I have found that, occasionally, a dud file results with essentially 0 bytes of data.
The mencoder command will fail if it meets up with one of these files among the thousands, at least, that you may have.

What I like to do, before running the
# ls *.jpg > stills.txt
command is to cd to the directory with your .jpg's and run
$ ls -lR | sort -bnr | tail
This will give a list of the ten smallest (in terms of Bytes content) files.
If any of these contain 0 bytes (or really any ridiculously small number such as 3 B), delete them before producing your stills.txt file.
If you have more than ten dud files, you can append any number (as a negative) you want after "tail".
So, this command will list the smallest twenty files in your .jpg list.
$ ls -lR | sort -bnr | tail -20

No comments:

Post a Comment