diff --git a/README.md b/README.md index aa3bf7a..2253f7f 100644 --- a/README.md +++ b/README.md @@ -60,15 +60,26 @@ img_thresh = 80000 # 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. # -sch_sec = 60 -# this is the amount of seconds to wait in between running post_cmd. +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 sch_sec. one great use for this +# 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. # diff --git a/src/common.h b/src/common.h index d0dbd9b..b7a8918 100644 --- a/src/common.h +++ b/src/common.h @@ -34,7 +34,7 @@ using namespace std; using namespace std::filesystem; using namespace std::chrono; -#define APP_VER "2.1.t3" +#define APP_VER "2.2" #define APP_NAME "Motion Watch" #define REC_LOG_NAME "rec_log_lines.html" #define DET_LOG_NAME "det_log_lines.html" diff --git a/src/main.cpp b/src/main.cpp index 89d2513..8c3d4c7 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -51,11 +51,7 @@ void eventLoop(shared_t *share) if (wrOutVod(event, share)) { genHTMLvod(event.evName); - - if (exists("events")) - { - imwrite(string("events/" + event.evName + ".jpg").c_str(), event.thumbnail); - } + imwrite(string("events/" + event.evName + ".jpg").c_str(), event.thumbnail); } } catch (filesystem_error &ex) @@ -116,15 +112,18 @@ void upkeep(shared_t *share) } } +void rmLive() +{ + if (exists("live")) + { + remove_all("live"); + } +} + void recLoop(shared_t *share) { while (share->retCode == 0) { - if (exists("live")) - { - remove_all("live"); - } - auto cmd = "ffmpeg -hide_banner -rtsp_transport tcp -timeout 3000000 -i " + share->recordUrl + " -strftime 1" + @@ -136,6 +135,7 @@ void recLoop(shared_t *share) " stream.m3u8"; recLog("ffmpeg_run: " + cmd, share); + rmLive(); auto retCode = system(cmd.c_str());