SunsetF15.lua documentation i.e. changes between set_b_14.lua and sunsetF15.lua
fudgey 2008/10/27
This is a modified (and improvement, I hope) version of Francesco Bonomi's
wonderful set_b_14.lua sunset timelapse script. This text file mainly documents
the various changes I've made. I have not touched the core of the script, i.e.
the exposure decision part. In that sense this version should work exactly as
set_b_14.lua.
If you are new to the script, you should see fbonomi's thread to find the
original version and especially its documentation:
Night-time time-lapseBe aware that I haven't tested modes other than M, and it's likely that
this version behaves differently if you are not using M mode (many cameras
have no M mode, I know). If you don't have M mode, Av is your best bet.
But then again, cameras lacking M mode often lack an iris as well.
Also, I'm using file I/O functionality recently introduced by reyalp. So
far it hasn't been tested on all cameras, and it's possible that horrible
things could happen. See install instructions below for precautions.
Now, about the changes:
I fixed the dark/bright frame toggling problem by optimizing the required
delays for each step of the process. As a side effect the script is of course
significantly faster, especially for cameras like mine that needed those
additional delays to prevent said problem.
I replaced the single shoot command with a series of commands to
shoot half -> override exposure -> shoot full -> release shutter, because
that gives me the chance to use propcases directly to adjust Tv and Sv for
the coming shot, instead of using the less reliable way thru set_tv* and set_sv*.
I'm using set_prop, but it's possible that set_tv96_direct and set_sv96_direct
could be used as direct replacements; I just didn't try it because I knew
set_prop would work (I'd have to check CHDK source code to see what those
commands do and/or test it). It shouldn't matter much that I used propcases as
the new propcase.lua makes it transparent across camera models.
Another speed optimization involves moving day exposure metering to be done
during shooting instead of its own half shoot, which was also an issue
during the night.
I also added and modified a big bunch of smaller things:
- Print remaining disk space in terms of frames and time on console. This
does not use Canon's approximations, which I have found to be very
pessimistic in my timelapses. Created f-disk.lua for this.
- Use new io commands for logging instead of print to keep console nice
and clean for better uses and to keep non-verbose log clean of unnecessary
console status messages for direct spreadsheet import. Created f-log.lua
for this.
- Moved frame count print to be done after frame instead of before sleep
(it seemed off by one to me).
- Added datestamp to complement timestamp so that a spreadsheet could better
calculate & plot things without wrapping around at midnight or requiring
plotting against frame counter. Created f-date.lua for this, and moved
timestamping functions from fb-lib.lua there.
- Moved datestamp to beginning of each log line (after ## which I didn't
remove as it's still useful for grepping those lines in verbose mode).
- Added temperature logging (all three sensors that may be available).
- For treaceability/repeatability, always log script version, parameters,
camera model and CHDK version information.
- Append log file instead of overwriting it (may not be a good idea for
users who never use card readers, though... but it can be easily changed
in f-log.lua by replacing '..name,"a")' with '..name,"w"))'.
- Disable IS at script start (I don't know if this works).
- Set manual focus mode at script start (this doesn't seem to work on my
a570is but maybe it works on someone else's camera?).
- Set focus during half-shoot for each shot (don't know if it works either,
especially if you aren't in manual focus mode).
It's set on each shot because there's been some problems to make it
stick previously. Related to this, I added a new parameter:
"Set focus to Inf". If "yes", focuses to infinity, if "no", script will use
the focus distance that was effective when the script started. It's
probably for the best to always use manual focus (and if you want to set
focus distance using auto focus, use focus lock..automatic focus will fail
during the night).
- Disable flash at script start (this one definitely works on my a570is)
- Changed Sv/Tv/period defaults a bit.
- Added two new parameters for JPEG settings (quality and resolution).
This is because I normally shoot full resolution "super fine" JPEG images,
but to conserve space I shoot my timelapses in normal or fine quality
wide angle (3072x1728 downscales nicely to 1080p 16:9 HD video).
Default is -1, which means the script will not alter these settings at all.
I don't know what the proper values are for all cameras, but from our wiki
I can tell that for probably all cameras JPG quality:
0=super fine, 1=fine, 2=normal
and JPG resolution (we can assume those numbers are always the same,
but availability may vary):
For a570is Digic III: 0,1,2,3,4,6,8 = L,M1,M2,M3,S,Postcard,W
For s3is Digic II: 0,1,2, 4, 8 = L,M1,M2, S, W
- Added new option: startup delay. Script will wait the specified number
of minutes before starting capture. It's useful when you have limited
card space and will not be around close enough to the sunset. You can
set up the camera in the morning, leave for work and not worry about
getting home in time to start the script.
- Start exposure at Tv equal to current user Tv (this is the value user
has set if in Tv or M mode) instead of a fixed value to provide quicker
startup.
- Use the brand new propcase.lua library for propcases.
- Fixed a tiny bug (I think) in fb-lib.lua: "if verbose" didn't work,
changed it to "if verbose==1". If it should have worked it's probably
an user error on my part or a CHDK bug.
- Additions to dummy.lua (the PC version, of course) to make new version
run on a PC (tested on Ubuntu's lua5.1)
- Named this version "Sunset F15"
Note that the script is evil and does not return settings it changes to values
from before calling the script. It uses some overrides which will not be visible
on the Canon OSD. So, the camera may be in a funny state after stopping the
script. Restart the camera after the script to be sure all OSD is up to date.
The script isn't ment to be stopped until the card is full or the battery
drains and then you'll be forced to shut the camera down anyway...
Before starting the script, I recommend you to:
-Disable IS (image stabilizer causes blur in long exposures)
-Disable focus beam
-Disable manual focus assist features
-Disable shot review
-Disable red eye removal
-Disable flash (until you verify that the script is able to disable your flash).
-Set camera to M mode (I haven't tested any other mode)
-Select a white balance preset (anything but AUTO is good, custom is best)
-Set manual focus (and focus to inf, and remember the new focus parameter
in the script and that it may or may not work for you).
Install instructions:
1) Get a new CHDK from
CHDK Download - build 0.6.6, revision #544 install it on an
empty card and run CHDK/SCRIPTS/TEST/LLIBTST.LUA to check how the new IO
library functions work on your camera. Report your findings to the thread here:
preliminary lua iolib and oslib portI suggested using an empty card because if that test fails miserably,
it's possible that it will corrupt the filesystem on your card, which
could lead to the need to re-format the card and loss of photos!
2) Place sunsetF15.lua to CHDK/SCRIPTS
3) Place everything in lualib/ to CHDK/LUALIB. You should already have
propcase.lua and GEN/*, so I didn't include them there.
If you need to use an older build, you can find the required
CHDK/LUALIB/propcase.lua and the entire CHDK/LUALIB/GEN directory from
the "pc" subdirectory (which you don't need on the camera, it's for
debugging the script on a PC outside the camera) or in a "complete"
zip archive of a new build.
4) In CHDK, load and start script sunsetF15.lua.
After each shot the script will update remaining time and remaining
number of frames counters on the script console. Keep in mind that
they are approximations calculated during the script run. They will
be very inaccurate at start. If your frame rate slows down at dark,
know that early in the morning the "remaining time" approximation
will be very optimistic, but "remaining frames" will be more accurate.
The script writes a log file to CHDK/LOGS/timelaps.log. It's always
appended, so you should remove it every now and then to prevent it
growing too big. The script logs various interesting things including
the script version and parameters and CHDK version you used, and
information of each shot (such as perceived brightness, Tv and Sv
used in the shot etc, and camera temperature sensor data).
The log is tab separated for instant import to spreadsheet apps.
If the iolib commands are not available for your camera, traditional
print() will be used instead. The log file will not be quite as
clean in that case, extra spaces will appear.
--------------------------------------------------------------------
TODO:
- Test & modify the script to work outside M mode if possible.
- End script on "menu" keypress + return propcases to startup values.
- There's no reason why flash with manual power shouldn't be allowed. Flash
will light up things close to the camera as well as traffic signs and
someone may find the effect useful. Don't know how smart it is to shoot
thousands of flash shots a few seconds apart, though...
--------------------------------------------------------------------
The script is attached below in a zip file. If you don't see it, you are not logged in the forum.