调整切割逻辑,提前检测文件夹配置

This commit is contained in:
Jerry Yan 2025-02-08 10:59:53 +08:00
parent fcf1e28fbd
commit 1115bed7e2
2 changed files with 9 additions and 2 deletions

View File

@ -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)

View File

@ -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,