v3.6.t4
-ffmpeg arbitrarily limits %020d. backed it down %014d, not sure if that is true limit. 14 was tessted to work. -added file size checking in detect loop to prevent it from processesing unfinished video clips.
This commit is contained in:
parent
7ba06ab92b
commit
69bb706b6b
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
|
|
||||||
#define APP_VERSION "3.6.t3"
|
#define APP_VERSION "3.6.t4"
|
||||||
#define APP_NAME "JustMotion"
|
#define APP_NAME "JustMotion"
|
||||||
#define APP_TARGET "jmotion"
|
#define APP_TARGET "jmotion"
|
||||||
#define DATETIME_FMT "yyyyMMddhhmmss"
|
#define DATETIME_FMT "yyyyMMddhhmmss"
|
||||||
|
|
|
@ -32,6 +32,8 @@ void DetectLoop::init()
|
||||||
connect(pcTimer, &QTimer::timeout, this, &DetectLoop::pcBreak);
|
connect(pcTimer, &QTimer::timeout, this, &DetectLoop::pcBreak);
|
||||||
connect(deTimer, &QTimer::timeout, this, &DetectLoop::preExec);
|
connect(deTimer, &QTimer::timeout, this, &DetectLoop::preExec);
|
||||||
|
|
||||||
|
thread()->sleep(2); // delay detection kickoff by 2 seconds to allow RecLoop to buffer
|
||||||
|
|
||||||
pcTimer->start(shared->postSecs * 1000);
|
pcTimer->start(shared->postSecs * 1000);
|
||||||
deTimer->start(2000);
|
deTimer->start(2000);
|
||||||
|
|
||||||
|
@ -51,12 +53,15 @@ void DetectLoop::reset()
|
||||||
|
|
||||||
void DetectLoop::preExec()
|
void DetectLoop::preExec()
|
||||||
{
|
{
|
||||||
vidAPath = shared->buffPath + "/live/" + QString::number(shared->seed - 1).rightJustified(20, '0') + shared->streamExt;
|
vidAPath = shared->buffPath + "/live/" + QString::number(shared->seed - 1).rightJustified(14, '0') + shared->streamExt;
|
||||||
vidBPath = shared->buffPath + "/live/" + QString::number(shared->seed - 2).rightJustified(20, '0') + shared->streamExt;
|
vidBPath = shared->buffPath + "/live/" + QString::number(shared->seed - 2).rightJustified(14, '0') + shared->streamExt;
|
||||||
|
|
||||||
eTimer.start();
|
eTimer.start();
|
||||||
|
|
||||||
if (QFileInfo::exists(vidAPath) && QFileInfo::exists(vidBPath))
|
auto vidAInfo = QFileInfo(vidAPath);
|
||||||
|
auto vidBInfo = QFileInfo(vidBPath);
|
||||||
|
|
||||||
|
if (vidAInfo.exists() && vidAInfo.size() > 0 && vidBInfo.exists() && vidBInfo.size() > 0)
|
||||||
{
|
{
|
||||||
shared->seed += 1;
|
shared->seed += 1;
|
||||||
|
|
||||||
|
|
|
@ -18,7 +18,7 @@ RecordLoop::RecordLoop(shared_t *sharedRes, QThread *thr, QObject *parent) : QPr
|
||||||
seedtimer = 0;
|
seedtimer = 0;
|
||||||
shared = sharedRes;
|
shared = sharedRes;
|
||||||
|
|
||||||
sharedRes->seed = 3;
|
sharedRes->seed = 2;
|
||||||
|
|
||||||
connect(thr, &QThread::started, this, &RecordLoop::init);
|
connect(thr, &QThread::started, this, &RecordLoop::init);
|
||||||
connect(thr, &QThread::finished, this, &RecordLoop::deleteLater);
|
connect(thr, &QThread::finished, this, &RecordLoop::deleteLater);
|
||||||
|
@ -69,21 +69,21 @@ QString RecordLoop::camCmdFromConf()
|
||||||
ret += "-vcodec " + shared->vidCodec + " ";
|
ret += "-vcodec " + shared->vidCodec + " ";
|
||||||
ret += "-acodec " + shared->audCodec + " ";
|
ret += "-acodec " + shared->audCodec + " ";
|
||||||
ret += "-reset_timestamps 1 -sc_threshold 0 -g 2 -force_key_frames 'expr:gte(t, n_forced * 2)' -segment_time 2 -f segment ";
|
ret += "-reset_timestamps 1 -sc_threshold 0 -g 2 -force_key_frames 'expr:gte(t, n_forced * 2)' -segment_time 2 -f segment ";
|
||||||
ret += shared->buffPath + "/live/%020d" + shared->streamExt;
|
ret += shared->buffPath + "/live/%014d.mkv" + shared->streamExt;
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void RecordLoop::checkSeed()
|
void RecordLoop::checkSeed()
|
||||||
{
|
{
|
||||||
if (shared->seed >= 10000000000000000000ULL)
|
if (shared->seed >= 99999999999999ULL)
|
||||||
{
|
{
|
||||||
terminate();
|
terminate();
|
||||||
waitForFinished();
|
waitForFinished();
|
||||||
|
|
||||||
setupBuffDir(shared->buffPath, true);
|
setupBuffDir(shared->buffPath, true);
|
||||||
|
|
||||||
shared->seed = 3;
|
shared->seed = 2;
|
||||||
|
|
||||||
restart();
|
restart();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user