添加时间判断,避免切出过小的视频
This commit is contained in:
parent
37da5abad0
commit
adf4186156
@ -35,13 +35,11 @@ func RunFfmpegTask(ctx context.Context, task *dto.FfmpegTask) bool {
|
||||
result = runFfmpegForMultipleFile1(subCtx, task)
|
||||
}
|
||||
// 先尝试方法1
|
||||
if result {
|
||||
span.SetStatus(codes.Ok, "FFMPEG简易方法成功")
|
||||
return true
|
||||
}
|
||||
if !result {
|
||||
log.Printf("FFMPEG简易方法失败,尝试复杂方法转码")
|
||||
// 不行再尝试方法二
|
||||
result = runFfmpegForMultipleFile2(subCtx, task)
|
||||
}
|
||||
duration, err := GetVideoDuration(subCtx, task.OutputFile)
|
||||
if err != nil {
|
||||
span.SetAttributes(attribute.String("error", err.Error()))
|
||||
@ -53,10 +51,10 @@ func RunFfmpegTask(ctx context.Context, task *dto.FfmpegTask) bool {
|
||||
return false
|
||||
}
|
||||
if result {
|
||||
span.SetStatus(codes.Ok, "FFMPEG复杂方法成功")
|
||||
span.SetStatus(codes.Ok, "成功")
|
||||
return true
|
||||
}
|
||||
span.SetStatus(codes.Error, "FFMPEG复杂方法失败")
|
||||
span.SetStatus(codes.Error, "失败")
|
||||
return result
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user