Hey! I'm new to CHDK, been hacking for just a few days with my SX60HS.
Sorry if this issue was still addressed here (it probably was), but I could not find the topic.
I found that (at least for this camera) it is not possible to detect motion while recording a movie, because the camera prevents access to the filesystem during video recording and the motion detection module fails to load.
I don't know whether there is an official way to do this, but the workaround I found was to make the motion detection module never unload from memory (by making _module_can_unload() return always false). This way, I just need to make a dummy call to md_detect_motion() before start recording in order to load the module and then I can use motion detection during recording.
- return camera_info.state.state_kbd_script_run == SCRIPT_STATE_INACTIVE;
+ return 0; //camera_info.state.state_kbd_script_run == SCRIPT_STATE_INACTIVE;