JustMotion/README.md

102 lines
4.2 KiB
Markdown
Raw Normal View History

# Motion Watch #
Motion Watch is a video surveillance application that monitors the video feeds
of an IP camera and records only footage that contains motion. The main
advantage of this is reduced storage requirements as opposed to continuous
recording because only video footage of interest is recorded to storage.
The entire app is designed to operate on just one camera but multiple instances
of this app can be used to operate multiple cameras.
### Usage ###
```
Usage: mow <argument>
-h : display usage information about this application.
-c : path to the config file.
```
### Config File ###
The config file is a simple text file that contain parameters that dictate the
behavior of the application. Below is an example of a config file with all
parameters supported and descriptions of each parameter.
```
# Motion Watch config file v1.0
#
# note all lines in this config file that starts with a '#' are ignored.
# also note to avoid using empty lines. if you're going to need an empty
# line, start it with a '#'
#
recording_stream = rtsp://1.2.3.4:554/h264
# this is the url to the main stream of the IP camera that will be used to
# to record footage if it contains motion.
#
detection_stream = rtsp://1.2.3.4:554/h264cif
# this is the low resolution secondary stream url of the IP camera the
# will be used to detect motion. it is never recorded. note: consider
# matching the fps of both streams for best results.
#
output_dir = /path/to/footage/directory
# this is the output directory that will be used to store recorded footage
# from the camera. the file naming convention uses date codes. it creates
# a subfolder for the date if it needs to and then stores the video file
# using the time.
#
diff_threshold = 210
# this application detects motion by loading back to back frames from the
# detection stream, converts them to gray scale and then compares the gray
# levels of each pixel of those frames. if the gray levels are significantly
# different, that will be considered motion. in an ideal world, the gray
# differences of each pixel should be 0 if there is no motion but cameras
# are not perfect so non-zero gray diffs on no motion footage can be common
# so that's where this threshold value comes in. 210 has been a decent
# value to use but this will entirely depend on the camera you are using.
#
duration = 60
# this sets the internal timer to check for any cached frames to record to
# permanent storage. warning: setting this value too high could cause the
# application to use too much memory.
#
post_cmd = move_the_ptz_camera.py
# this an optional command to run after the internal timer duration has
# elapsed. one great use for this is to move a ptz camera to the next
# position of it's patrol pattern. note: the command is not called if
# motion was detected.
#
pixel_size = 3
# this is the pixel size of the detected object or movement. this can
# prevent false positives due small moves in grass/plants or insects.
#
frames_post_motion = 60
# this is the amount frames to capture after motion was detected.
#
minimum_recording_frames = 90
# this is the minimum amount of frames needed before video footage is
# recorded to storage. this prevents video files that are too small to
# be of any use and reduces clutter. warning: setting this value too
# high could cause the application to use too much memory.
#
section_size = 100
# detection frames are read in y axis sections and then runs gray level
# comparisons in a separate thread for each section. this value is used
# to determine how wide each section will be and how many threads will be
# needed to process each section. example: a 380x240 frame with a section
# size of 100 will process 100x240, 100x240, 100x240 and 80x240 images
# in 4 threads.
```
### Build Setup ###
This application is currently only compatible with a Linux based operating
systems that are capable of building and installing the opencv API from source.
instructions on how to install opencv can be found [here](https://docs.opencv.org/4.x/df/d65/tutorial_table_of_content_introduction.html).
```
cd /path/to/Motion/Watch/source
mkdir ./build
cd ./build
cmake ..
make
sudo cp ./mow /usr/bin/mow
```