Use 'motion' to detect motion using a camera (e.g. USB webcam). Capture pictures and video's from motion events, and keep them in an archive.