From e8ba94ba09b9a8150aa496108bfeae7c69270679 Mon Sep 17 00:00:00 2001 From: xiongziliang <771730766@qq.com> Date: Sat, 1 Feb 2020 22:58:21 +0800 Subject: [PATCH] =?UTF-8?q?=E8=BF=98=E5=8E=9F=E4=BB=A3=E7=A0=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- server/FFmpegSource.cpp | 5 ----- src/Record/MP4Recorder.cpp | 8 +++----- 2 files changed, 3 insertions(+), 10 deletions(-) diff --git a/server/FFmpegSource.cpp b/server/FFmpegSource.cpp index 0deb3bb2..d8a821c6 100644 --- a/server/FFmpegSource.cpp +++ b/server/FFmpegSource.cpp @@ -34,7 +34,6 @@ namespace FFmpeg { #define FFmpeg_FIELD "ffmpeg." const string kBin = FFmpeg_FIELD"bin"; const string kCmd = FFmpeg_FIELD"cmd"; -const string kSnap = FFmpeg_FIELD"snap"; const string kLog = FFmpeg_FIELD"log"; onceToken token([]() { @@ -42,12 +41,9 @@ onceToken token([]() { string ffmpeg_bin = System::execute("where ffmpeg"); //windows下先关闭FFmpeg日志(目前不支持日志重定向) mINI::Instance()[kCmd] = "%s -re -i \"%s\" -loglevel quiet -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264 -f flv %s "; - //利用ffmpeg进行抓拍 - mINI::Instance()[kSnap] = "%s -i \"%s\" -loglevel quiet -y -f mjpeg -t 0.001 -s 720*576 %s "; #else string ffmpeg_bin = System::execute("which ffmpeg"); mINI::Instance()[kCmd] = "%s -re -i \"%s\" -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264 -f flv %s "; - mINI::Instance()[kSnap] = "%s -i \"%s\" -y -f mjpeg -t 0.001 -s 720*576 %s "; #endif //默认ffmpeg命令路径为环境变量中路径 mINI::Instance()[kBin] = ffmpeg_bin.empty() ? "ffmpeg" : ffmpeg_bin; @@ -68,7 +64,6 @@ FFmpegSource::~FFmpegSource() { void FFmpegSource::play(const string &src_url,const string &dst_url,int timeout_ms,const onPlay &cb) { GET_CONFIG(string,ffmpeg_bin,FFmpeg::kBin); GET_CONFIG(string,ffmpeg_cmd,FFmpeg::kCmd); - GET_CONFIG(string, ffmpeg_snap, FFmpeg::kSnap); GET_CONFIG(string,ffmpeg_log,FFmpeg::kLog); _src_url = src_url; diff --git a/src/Record/MP4Recorder.cpp b/src/Record/MP4Recorder.cpp index 97cc9fac..a92f3fde 100644 --- a/src/Record/MP4Recorder.cpp +++ b/src/Record/MP4Recorder.cpp @@ -52,11 +52,10 @@ MP4Recorder::~MP4Recorder() { void MP4Recorder::createFile() { closeFile(); - auto strDate = getTimeStr("%Y-%m"); - auto strDay = getTimeStr("%Y-%m-%d"); + auto strDate = getTimeStr("%Y-%m-%d"); auto strTime = getTimeStr("%H-%M-%S"); - auto strFileTmp = _strPath + strDate + "/" + strDay + "/." + strTime + ".mp4"; - auto strFile = _strPath + strDate + "/" + strDay + "/" + strTime + ".mp4"; + auto strFileTmp = _strPath + strDate + "/." + strTime + ".mp4"; + auto strFile = _strPath + strDate + "/" + strTime + ".mp4"; /////record 业务逻辑////// _info.ui64StartedTime = ::time(NULL); @@ -67,7 +66,6 @@ void MP4Recorder::createFile() { + _info.strAppName + "/" + _info.strStreamId + "/" + strDate + "/" - + strDay + "/" + strTime + ".mp4"; try {