diff --git a/src/common.h b/src/common.h index 3009788..f7d6198 100644 --- a/src/common.h +++ b/src/common.h @@ -32,7 +32,7 @@ using namespace std; -#define APP_VERSION "3.6.t4" +#define APP_VERSION "3.6.t5" #define APP_NAME "JustMotion" #define APP_TARGET "jmotion" #define DATETIME_FMT "yyyyMMddhhmmss" diff --git a/src/record_loop.cpp b/src/record_loop.cpp index a5440cb..7942c35 100644 --- a/src/record_loop.cpp +++ b/src/record_loop.cpp @@ -52,24 +52,36 @@ void RecordLoop::init() restart(); } -QString RecordLoop::camCmdFromConf() +QStringList RecordLoop::camCmdFromConf() { - auto ret = "ffmpeg -hide_banner -y -i '" + shared->recordUri + "' -strftime 1 -strftime_mkdir 1 "; + QStringList ret; + + ret.append("ffmpeg"); ret.append("-hide_banner"); ret.append("-y"); ret.append("-i"); + ret.append(shared->recordUri); if (shared->recordUri.contains("rtsp")) { - ret += "-rtsp_transport udp "; + ret.append("-rtsp_transport"); + ret.append("udp"); } if (shared->vidCodec != "copy") { - ret += "-vf fps=" + QString::number(shared->recFps) + ",scale=" + shared->recScale + " "; + ret.append("-vf"); + ret.append("fps=" + QString::number(shared->recFps) + ",scale=" + shared->recScale); } - ret += "-vcodec " + shared->vidCodec + " "; - 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 += shared->buffPath + "/live/%014d.mkv" + shared->streamExt; + ret.append("-vcodec"); ret.append(shared->vidCodec); + ret.append("-acodec"); ret.append(shared->audCodec); + + ret.append("-reset_timestamps"); ret.append("1"); + ret.append("-sc_threshold"); ret.append("0"); + ret.append("-g"); ret.append("2"); + ret.append("-force_key_frames"); ret.append("expr:gte(t, n_forced * 2)"); + ret.append("-segment_time"); ret.append("2"); + ret.append("-f"); ret.append("segment"); + + ret.append(shared->buffPath + "/live/%014d" + shared->streamExt); return ret; } @@ -114,10 +126,9 @@ void RecordLoop::restart() waitForFinished(); } - auto cmdLine = camCmdFromConf(); - auto args = parseArgs(cmdLine.toUtf8(), -1); + auto args = camCmdFromConf(); - qInfo() << "start recording command: " << cmdLine; + qInfo() << "start recording command: " << args.join(' '); if (args.isEmpty()) { diff --git a/src/record_loop.h b/src/record_loop.h index d3f167a..c721fb4 100644 --- a/src/record_loop.h +++ b/src/record_loop.h @@ -31,8 +31,8 @@ private: QTimer *seedtimer; QTimer *checkTimer; - quint64 getLatestSeed(); - QString camCmdFromConf(); + quint64 getLatestSeed(); + QStringList camCmdFromConf(); public slots: