-max_event_secs is not being honered correctly. EventLoop was not
 calculating the amount the hls clips to grab from live correctly.
 chanaged it to properly calculate file count based on hls segment
 size.

-updated the documentation as the current version nears stable
 release.
This commit is contained in:
Zii 2023-06-01 16:11:58 -04:00
parent 71df7d1eb5
commit 4bf260c0ae
3 changed files with 25 additions and 39 deletions

View File

@ -4,22 +4,18 @@ 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 of an IP camera and records only footage that contains motion. The main
advantage of this is reduced storage requirements as opposed to continuous advantage of this is reduced storage requirements as opposed to continuous
recording because only video footage of interest is recorded to storage. 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 ###
``` ```
Usage: mow <argument> Usage: mow <argument>
-h : display usage information about this application. -h : display usage information about this application.
-c : path to the config file(s). -c : path to the config file used to run a single camera instance.
-v : display the current version. -d : path to a directory that can contain multiple config files.
each file found in the directory will be used to run a
note: multiple -c config files can be passed, reading from left camera instance.
to right. any conflicting values between the files will -v : display the current version.
have the latest value from the latest file overwrite the
the earliest.
``` ```
### Config File ### ### Config File ###
@ -49,30 +45,20 @@ cam_name = cam-1
# name will also be used to as the base directory in web_root. if not # 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. # defined, the name of the config file will be used.
# #
pix_thresh = 150 max_event_secs = 30
# 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 # this is the maximum amount of secs of video footage that can be
# recorded in a motion event. # recorded in a motion event.
# #
img_thresh = 10000
# this application uses 'magick compare' to score the differences between
# two, one second gapped snapshots of the camera stream. any image pairs
# that score greater than this value is considered motion and queues up
# max_event_secs worth of hls clips to be written out as a motion event.
#
max_events = 100
# this indicates the maximum amount of motion event video clips to keep
# before deleting the oldest clip.
#
post_secs = 60 post_secs = 60
# this is the amount of seconds to wait before running the command # 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 # defined in post_cmd. the command will not run if motion was detected
@ -105,8 +91,7 @@ web_font = courier
### Setup/Build/Install ### ### Setup/Build/Install ###
This application is currently only compatible with a Linux based operating This application is currently only compatible with a Linux based operating
systems that are capable of installing opencv. The following 3 scripts make systems that are capable of installing the QT API.
building and then installing convenient.
``` ```
sh ./setup.sh <--- only need to run this once if compiling for the first sh ./setup.sh <--- only need to run this once if compiling for the first

View File

@ -24,7 +24,7 @@ Camera::Camera(QObject *parent) : QObject(parent)
shared.maxLogSize = 100000; shared.maxLogSize = 100000;
shared.skipCmd = false; shared.skipCmd = false;
shared.postSecs = 60; shared.postSecs = 60;
shared.evMaxSecs = 10; shared.evMaxSecs = 30;
shared.webRoot = "/var/www/html"; shared.webRoot = "/var/www/html";
shared.webBg = "#485564"; shared.webBg = "#485564";
shared.webTxt = "#dee5ee"; shared.webTxt = "#dee5ee";
@ -266,7 +266,8 @@ bool EventLoop::exec()
{ {
auto event = shared->recList[0]; auto event = shared->recList[0];
auto name = event.timeStamp.toString(DATETIME_FMT); auto name = event.timeStamp.toString(DATETIME_FMT);
auto vidList = backwardFacingFiles("live", ".ts", event.timeStamp, shared->evMaxSecs / 2); auto maxFiles = shared->evMaxSecs / 2; //there's 2 secs in each hls segment
auto vidList = backwardFacingFiles("live", ".ts", event.timeStamp, maxFiles / 2);
if (vidList.isEmpty()) if (vidList.isEmpty())
{ {
@ -276,7 +277,7 @@ bool EventLoop::exec()
{ {
vidList.removeLast(); vidList.removeLast();
vidList += forwardFacingFiles("live", ".ts", event.timeStamp, shared->evMaxSecs / 2); vidList += forwardFacingFiles("live", ".ts", event.timeStamp, maxFiles / 2);
for (auto &&hist : shared->evtHist) for (auto &&hist : shared->evtHist)
{ {

View File

@ -28,7 +28,7 @@
using namespace std; using namespace std;
#define APP_VER "3.0.t10" #define APP_VER "3.0.t11"
#define APP_NAME "Motion Watch" #define APP_NAME "Motion Watch"
#define APP_BIN "mow" #define APP_BIN "mow"
#define REC_LOG_NAME "rec_log_lines.html" #define REC_LOG_NAME "rec_log_lines.html"