From 6cd9e15cb8f90d24b42368a8fc521eca792d4589 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=A4=8F=E6=A5=9A?= <771730766@qq.com> Date: Mon, 26 Jun 2023 11:04:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96FFmpeg=E6=88=AA=E5=9B=BE?= =?UTF-8?q?=E5=91=BD=E4=BB=A4=E6=A8=A1=E6=9D=BF=EF=BC=8C=E6=8F=90=E9=AB=98?= =?UTF-8?q?=E6=88=AA=E5=9B=BE=E6=88=90=E5=8A=9F=E7=8E=87=20(#2583)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit -t 0.001参数替换为-frames:v 1,只截图一帧 --- conf/config.ini | 2 +- server/FFmpegSource.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/conf/config.ini b/conf/config.ini index 0abe303a..5d1651ed 100644 --- a/conf/config.ini +++ b/conf/config.ini @@ -22,7 +22,7 @@ bin=/usr/bin/ffmpeg #FFmpeg拉流再推流的命令模板,通过该模板可以设置再编码的一些参数 cmd=%s -re -i %s -c:a aac -strict -2 -ar 44100 -ab 48k -c:v libx264 -f flv %s #FFmpeg生成截图的命令,可以通过修改该配置改变截图分辨率或质量 -snap=%s -i %s -y -f mjpeg -t 0.001 %s +snap=%s -i %s -y -f mjpeg -frames:v 1 %s #FFmpeg日志的路径,如果置空则不生成FFmpeg日志 #可以为相对(相对于本可执行程序目录)或绝对路径 log=./ffmpeg/ffmpeg.log diff --git a/server/FFmpegSource.cpp b/server/FFmpegSource.cpp index 564dca46..fa9044ed 100644 --- a/server/FFmpegSource.cpp +++ b/server/FFmpegSource.cpp @@ -39,7 +39,7 @@ onceToken token([]() { //ffmpeg日志保存路径 mINI::Instance()[kLog] = "./ffmpeg/ffmpeg.log"; 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"; + mINI::Instance()[kSnap] = "%s -i %s -y -f mjpeg -frames:v 1 %s"; mINI::Instance()[kRestartSec] = 0; }); }