Skip to content
/ pycam Public
forked from osmaa/pinymotion

Raspberry PI h264 camera motion detector and recorder with cloud storage and Telegram notifications

License

Notifications You must be signed in to change notification settings

vedmant/pycam

 
 

Repository files navigation

pinymotion

Python implementation of a motion detecting H.264 camera for Raspberry Pi

Leveraging the ability of the Raspberry Pi camera to produce hardware-encoded H.264 video and the MMAL API's built-in facility for providing the H.264 motion vectors as a side-band stream, this Python script is able to detect moving objects in the field of view with plenty of CPU to spare -- it runs at about 25% CPU usage on the original single-core 700MHz Pi Model B!

The core of the motion detector works on 16x16 pixel motion vectors, within which it looks for larger areas of significant motion. By default, an area of at least 25 contiguous MV blocks, each with a vector of at least 10 units (in any direction) is required for motion to be considered. Finally, the detector expects to see 4 or more consecutive frames with movement. Adjusting these three parameters will impact the sensitivity of the recorder.

All hard work is performed by PiCamera http:https://picamera.readthedocs.io/en/release-1.12/ and Numpy/Scipy http:https://docs.scipy.org/doc/.

In principle, the same approach could be used with USB and network cameras producing H.264 streams. Those do not provide the handy motion vector side channel, though, so a H.264 parser and motion vector extractor will be required.

TODO

  1. Add installation instructions to readme

About

Raspberry PI h264 camera motion detector and recorder with cloud storage and Telegram notifications

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages

  • Python 100.0%