瀏覽代碼

修复 HLS 导出细节

Signed-off-by: allan716 <[email protected]>
allan716 3 年之前
父節點
當前提交
3460697381
共有 1 個文件被更改,包括 11 次插入10 次删除
  1. 11 10
      pkg/ffmpeg_helper/ffmpeg_helper.go

+ 11 - 10
pkg/ffmpeg_helper/ffmpeg_helper.go

@@ -287,14 +287,14 @@ func (f *FFMPEGHelper) ExportVideoHLSAndSubByTimeRange(videoFullPath, subFullPat
 		return err
 	}
 
-	// 先剪切
-	videoExt := filepath.Ext(fileName)
-	cutOffVideoFPath := filepath.Join(outDirPath, frontName+"_cut"+videoExt)
-	args := f.getVideoExportArgsByTimeRange(videoFullPath, startTimeString, timeLength, cutOffVideoFPath)
-	execFFMPEG, err := f.execFFMPEG(args)
-	if err != nil {
-		return errors.New(execFFMPEG + err.Error())
-	}
+	//// 先剪切
+	//videoExt := filepath.Ext(fileName)
+	//cutOffVideoFPath := filepath.Join(outDirPath, frontName+"_cut"+videoExt)
+	//args := f.getVideoExportArgsByTimeRange(videoFullPath, startTimeString, timeLength, cutOffVideoFPath)
+	//execFFMPEG, err := f.execFFMPEG(args)
+	//if err != nil {
+	//	return errors.New(execFFMPEG + err.Error())
+	//}
 	//// 转换 HLS
 	//args = f.getVideo2HLSArgs(cutOffVideoFPath, segmentTime, outDirPath)
 	//execFFMPEG, err = f.execFFMPEG(args)
@@ -302,8 +302,9 @@ func (f *FFMPEGHelper) ExportVideoHLSAndSubByTimeRange(videoFullPath, subFullPat
 	//	return errors.New(execFFMPEG + err.Error())
 	//}
 
-	args = f.getVideoHLSExportArgsByTimeRange(videoFullPath, startTimeString, timeLength, segmentTime, outDirPath)
-	execFFMPEG, err = f.execFFMPEG(args)
+	// 直接导出
+	args := f.getVideoHLSExportArgsByTimeRange(videoFullPath, startTimeString, timeLength, segmentTime, outDirPath)
+	execFFMPEG, err := f.execFFMPEG(args)
 	if err != nil {
 		return errors.New(execFFMPEG + err.Error())
 	}