Is there a possibility to limit the brightness change via the CHDK script? What I've tried is saving the brightness value of the last shot, the recent measurement and set the shutter speed using set_tv96_direct to their average value. Here of course a fixed ISO was set, but usage of ND filter was selected by camera. Due to the heavy amount of changes the result looked horrible. Next I limited maximum difference of tv96 values. There the result was much better, but still does not look good.
What kind of a scene and lighting changes are involved? For an outdoor scene, keeping one area consistent can lead to extreme changes in other parts.
It may be useful to define "limit the brightness change" in more specific terms. It sounds like you want to keep the exposure value consistent from frame to frame, but is it:
* Average value of the whole scene
* Value of specific areas
* Value of the majority of the scene, excluding outliers like the sun.
*
As wateringz says, you can control the ND filter from CHDK. The exact ND value varies a bit between cameras, but it's usually close to 3 stops. If you half shoot, you can get the Bv and from that you can use the APEX equation to set all the other parameters, including the ND state.
The metering mode in the Canon firmware may let you fine tune what part of the of the scene the Canon firmware measures for the Bv.
In the CHDK 1.4 development version, you can measure user specified areas of the raw buffer from script and calculate exposure changes from that. However, this feature is under development. The functionality generally works, but things may change from build to build. Using it may require a significant amount of scripting on your part. See
http://chdk.setepontos.com/index.php?topic=11081.msg119265#msg119265 if you are interested. To use this you would probably need to take two exposures, one for metering, and one for the actual timelapse. You could delete the metering image from script.