From 1115bed7e2e2d4d676caa5297e6bfe56b9bcd5bb Mon Sep 17 00:00:00 2001 From: Jerry Yan <792602257@qq.com> Date: Sat, 8 Feb 2025 10:59:53 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=88=87=E5=89=B2=E9=80=BB?= =?UTF-8?q?=E8=BE=91=EF=BC=8C=E6=8F=90=E5=89=8D=E6=A3=80=E6=B5=8B=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E5=A4=B9=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.go | 8 +++++++- util/ffmpeg.go | 3 ++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/main.go b/main.go index 57d4360..a1c5527 100644 --- a/main.go +++ b/main.go @@ -46,6 +46,13 @@ func main() { // 设置日志输出到文件 log.SetOutput(logFile) + _, err = os.Stat(config.Config.Record.Storage.Path) + if err != nil { + log.Println("录像文件夹配置失败", err) + return + } else { + log.Println("录像文件夹配置有效") + } // 每两秒定时执行 for { // 执行任务 @@ -61,7 +68,6 @@ func main() { break // 提前返回,避免不必要的循环 } } - log.Printf("处理任务结束, TaskID:【%s】,DeviceNo: %s\n", task.TaskID, task.DeviceNo) } } else { log.Println("同步任务失败:", err) diff --git a/util/ffmpeg.go b/util/ffmpeg.go index c66286a..5f839ae 100644 --- a/util/ffmpeg.go +++ b/util/ffmpeg.go @@ -177,10 +177,11 @@ func QuickVideoCut(inputFile string, offset, length int64, outputFile string) (b FfmpegExec, "-hide_banner", "-y", - "-ss", strconv.FormatInt(offset, 10), "-i", inputFile, "-c:v", "copy", "-an", + "-reset_timestamps", "1", + "-ss", strconv.FormatInt(offset, 10), "-t", strconv.FormatInt(length, 10), "-f", "mp4", outputFile,