Motion

https://www.raspberrypi.org/forums/viewtopic.php?f=43&t=166287 modprobe 
https://hackernoon.com/spy-your-pet-with-a-raspberry-pi-camera-server-e71bb74f79ea modprobe 
https://www.linux.com/learn/how-operate-linux-spycams-motion and The Hackers Manual 2016 from Linuxmagazine.
/usr/local/etc/motion change motion-dist.conf to motion.conf
/usr/local/share/motion/examples
=== golang ===
https://github.com/laurent22/pmcctv This Go application captures images from a webcam. It supports motion detection, burst mode, and upload to a remote directory. A Go worker captures frames at regular intervals using ffmpeg. Then ImageMagick's compare tool is used to check if this frame is similar to the previous one. If the frames are different enough, they are kept, otherwise they are deleted. This provide very simple motion detection and avoids filling up the hard drive with duplicate frames. Optionally, a Go worker can be setup to automatically upload the frames to a remote server. Frames are copied using either scp or rsync, depending on what's available. Finally, another worker runs at regular intervals to clean up both the local and remote directory (by default, frames are kept for up to 7 days). Normally, the program captures one frame per second. However, when motion is detected, a "burst mode" is activated, in which case frames will be captured as fast as possible for the next 10 seconds, or for as long as motion is being detected.
Category:Opencv