Overview¶
I have two IP cameras at home that I’d like to use for security, specifically motion-activated recording and notification of events when I’m away. The cameras (see my detailed unboxing/review of them on my blog) are 960P and 1080P, respectively. The current options for Free/Open Source software to do this aren’t adequate for me; ZoneMinder, the de-facto standard, doesn’t meet my resource constraints of being able to run on (or partially run on) a RaspberryPi 3 B+ and the other options I could find aren’t mature or lack features I need.
As a result, I’m building this. It’s a project composed of multiple services and intended to handle processing data from Motion (recordings and the metadata associated with them), storing it, and providing a viewing interface and notifications/alerts. The project is intended to be modular, utilizing a storage service (S3 or the local S3-compatible minio), a queue (Redis) and a database (MySQL) to connect a handler that runs on the same device as motion
(this could be anything from a RaspberryPi to a server), an asynchronous task worker for ingesting new data from motion, triggering notifications, and generating thumbnails, and a web frontend.
The architecture is intended to be decoupled, equally happy on a single fanless computer or in the cloud, and to allow separating realtime tasks (motion
for motion detection and recording, and ingesting its recordings and metadata into the system) from less-time-sensitive tasks (generating thumbnails for videos, etc.) and the user interface.
Architecture¶
The main architecture includes three pieces: motion_handler.py
that is triggered by motion
, the asynchronous task workers, and the web frontend. It relies on Redis, MySQL, and Amazon S3 or a local S3-compatible storage service (minio) as dependencies.
Motion Ingest¶
+---+ +-----------------+
|cam+----->RaspberryPi, etc.| ... N instances of
+---+ |motion_handler.py| cam -> motion_handler
+---+------------++
| |
| |
+------------------v----+ +v-----------------+
|redis "motion-incoming"| |S3 or minio bucket|
|queue | +-+-------^--------+
+-------------+---------+ | |
| | |
| | |
+-----------v------+ +------v-------+-----+
|data ingest worker+---->Video Thumbnail |
+------------------+ |Worker |
| +-----+----------+---+
| | |
| | +----v------------+
+v----------v--+ |user notification|
|MySQL Database| |worker |
+--------------+ +-----------------+
(generated by asciiflow Infinity - http://asciiflow.com/)
User Interface and Notifications¶
TBD.