I came across a great piece of software for the Raspberry Pi the other day called PiKrellCam (not sure why its took me this long to find, it’s been around since 2015!). It allows you to create a motion capturing cctv system out of a raspberry pi and camera connected via CSI. The motion detection is pretty good and more advanced than most available on domestic cctv systems and its FREE!!
It even supports the use of servos for pan and tilt!
I recommend using atleast a Raspberry Pi 2 with the v2 8mp camera – the NoIR camera is a good choice to pair with an infrared illuminator for night time capture.
I’ve currently got mine to email me a thumbnail of the motion that triggered the capture.