496bac7d7e
I'm going to test a move away from opencv's videoio module. Videoio simply refuses to open any video file even with FFMPEG builtin. I tested old v2.2 code and even that failed on a fresh install of ubuntu sever so this tells me an update on opencv's side broke something. This issue is not new and frankly I'm tired of chasing it. I'm giving QT's QMediaPlayer a try to see how it works out. Will still need opencv for the absdiff and threshold functions, otherwise I would have dropped the API altogeather. Now that the app has QT::Multimedia, QT6 is now the minimum version it will support. CMakeList.txt and the setup script updated accordingly. |
||
---|---|---|
src | ||
.gitignore | ||
build.sh | ||
CMakeLists.txt | ||
install.sh | ||
LICENSE.md | ||
README.md | ||
setup.sh |
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(s).
-v : display the current version.
note: multiple -c config files can be passed, reading from left
to right. any conflicting values between the files will
have the latest value from the latest file overwrite the
the earliest.
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.
# Motion Watch config file
#
# 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 record footage.
#
web_root = /var/www/html
# this is the output directory that will be used to store recorded footage
# from the cameras as well as the web interface for the application.
# warning: this will overwrite any existing index.html files so be sure
# to choose a directory that doesn't have an existing website.
#
cam_name = cam-1
# this is the optional camera name parameter to identify the camera. this
# name will also be used to as the base directory in web_root. if not
# defined, the name of the config file will be used.
#
pix_thresh = 150
# this value tells the application how far different the pixels need to be
# before the pixels are actually considered different. think of this as
# pixel diff sensitivity, the higher the value the lesser the sensitivity.
# maximum is 255.
#
img_thresh = 80000
# this indicates how many pixels need to be different in between frames
# before it is considered motion. any video clips found with frames
# exceeding this value will be copied from live footage to event footage.
#
frame_gap = 10
# this is the amount of frames in between the comparison frames to check
# for pixel differences. the higher the value, the lower the cpu over
# head, however it does lower motion detection accuracy.
#
max_events = 40
# this indicates the maximum amount of motion event video clips to keep
# before deleting the oldest clip.
#
max_event_secs = 10
# this is the maximum amount of secs of video footage that can be
# recorded in a motion event.
#
post_secs = 60
# this is the amount of seconds to wait before running the command
# defined in post_cmd. the command will not run if motion was detected
# in the space before post_secs elapsed.
#
post_cmd = move_the_ptz_camera.py
# this an optional command to run with post_secs. one great use for this
# is to move a ptz camera to the next position of it's patrol pattern.
# note: the call to this command will be delayed if motion was detected.
#
max_log_size = 50000
# this is the maximum byte size of all log files that can be stored in
# web_root. whenever this limit is met, the log file will be deleted and
# then eventually recreated blank.
#
web_text = #dee5ee
# this can be used to customize the color of the text in the web
# interface. it can be defined as any color understood by html5 standard.
#
web_bg = #485564
# this can be used to customize the background color of the web
# interface. just like web_text, it also follows the html5 standard.
#
web_font = courier
# this will customize the text font family to use in the web interface.
# it is recommended to use mono-spaced font because this is also used to
# display logs and logs are best displayed in mono-spaced font.
Setup/Build/Install
This application is currently only compatible with a Linux based operating systems that are capable of installing opencv. The following 3 scripts make building and then installing convenient.
sh ./setup.sh <--- only need to run this once if compiling for the first
sh ./build.sh time or if upgrading from the ground up.
sh ./install.sh
note 1: be sure to run setup.sh and install.sh as root (or use sudo).
note 2: if building from scratch the following scripts will need to
be run in this order - setup.sh -> build.sh -> install.sh.