Record at 1fps until motion/sound detected

Would be great if the camera recorded continuous video on the sdcard at 1fps, until motion/sound triggered then record at full speed for 30seconds after no further detections,
added bonus would be to also dump/record at full speed 30seconds before the event, eg if the camera had a 30second buffer in ram it could write.

This would allow longer storage of video on the sd card and potential extending the life of the sdcard with less write cycles.

may also need to cater playback speed, eg play 1fps or play at 10-15fps , which would give the impression of high speed scrubbing through the video.