I'm using my Raspberry Pi with the RPi camera board to capture a time-lapse video of outdoor scenery using the
raspistill command. As I am uploading the photos to a server after I take each photo, I'm not using the in-built time lapse functionality, but instead running a cronjob which runs this script every minute:
filename=$(date +"%d%m%Y_%H%M-%S").jpg raspistill --width 1280 --height 960 --quality 100 --timeout 500 --encoding jpg -sh 0 -co 0 -br 50 -sa 0 -ev 0 --exposure snow --awb sun --ISO 100 --metering average --nopreview --output $PROJECTDIR/$IMAGEDIR/$filename # some additional code I use to upload the files.
As I'm running the same code to capture photos throughout the day and into the night, I need the code to chose appropriate shutter speeds that allow the image to be correctly lit.
One possible approach to getting consistent lighting is to fix a shutter speed. However, I found that this approach was not general enough. Setting
--ss 1000, or a shutter speed of 1ms, is great for sunny days, but a shutter speed at least four times as long is required for good images on cloudy days (forget about night photography!)
As such, I have to rely on the camera's internal metering. This gives me a degree of flexibility since it modifies the shutter speed according to the total light coming in, giving decent photos both in the day and in the night. However, using the default settings on the camera leads to images which are generally underexposed, whatever the conditions. I've tried playing around with
--brightness and so on, but the results are not consistent.
One approach that I've found to work is by changing the
--timeout settings on the camera. In general, the shorter the
--timeout chosen, the slower the shutter speed is likely to be (and the brighter the resulting image).
Without setting a fixed value for shutter speed, I've found that the Raspberry Pi chooses a good shutter speed in sunny conditions when
--timeout is set at 500. However, on cloudy days and for night-time, the resulting image from
--timeout 500 is too dark, and I have to reduce
--timeout to 200.
Here is a bit of data on the shutter speeds the camera chooses.
--timeout 500: exposure 1/1060 s
--timeout 200: exposure 1/366 s
If it helps for me to upload the images, please mention in a comment below.
--averagemetering - the documentation isn't clear as to how either works, but I thought
--averagewould be a sensible way to meter for outdoor images. I'm willing to try matrix too once I get my Pi back up running though.