diff --git a/dsSupport/ConvertMovie/Convert.go b/dsSupport/ConvertMovie/Convert.go index b8ca5a15..25781771 100644 --- a/dsSupport/ConvertMovie/Convert.go +++ b/dsSupport/ConvertMovie/Convert.go @@ -11,19 +11,19 @@ func main() { ConvertUtil.InitDir(source) //2、对视频文件进行切片 ConvertUtil.Cut(source) - //2、切片完成后,尝试进行转码 + //3、切片完成后,尝试进行转码 var childMovie = ConvertUtil.GetAllCutChild(source) for i := range childMovie { ConvertUtil.ConvertToH264Mp4(childMovie[i]) } - //3、生成拼接的索引文件 + //4、生成拼接的索引文件 ConvertUtil.GenerateIndexTxt(source, childMovie) - //4、合成MP4 + //5、合成MP4 ConvertUtil.Merge(source) - //5、清除垃圾 + //6、清除垃圾 ConvertUtil.ClearRubbish(source) - //6、查看转换结果 + //7、查看转换结果 ConvertUtil.ShowMovieInfo(source) - //7、转码为M3U8 + //8、转码为M3U8 ConvertUtil.ToM3u8(source) } diff --git a/dsSupport/Utils/ConvertUtil/ConvertUtil.go b/dsSupport/Utils/ConvertUtil/ConvertUtil.go index cf4e5d59..05a87d09 100644 --- a/dsSupport/Utils/ConvertUtil/ConvertUtil.go +++ b/dsSupport/Utils/ConvertUtil/ConvertUtil.go @@ -22,8 +22,8 @@ func init() { } const WorkingPath = "/" -const WorkingCutPath = "Cut/" -const WorkingMp4Path = "Mp4/" +const WorkingCutPath = "/Cut/" +const WorkingMp4Path = "/Mp4/" /** 功能:获取指定源文件的不同工作目录 @@ -31,7 +31,7 @@ const WorkingMp4Path = "Mp4/" 时间:2020-07-09 */ func getWorkingPath(source string, p string) string { - return runDir + `/Working/` + source[0:2] + "/" + source[0:36] + "/" + p + return runDir + `/Working/` + source[0:2] + "/" + source[0:36] + p } /** @@ -48,7 +48,7 @@ func getTargetPath(source string)string{ 时间:2020-07-09 */ func getSourcePath(source string) string{ - return runDir + `/Source/` + source[0:2] + "/" + source[0:36] + "/" + return runDir + `/Source/` + source[0:2] + "/" } /** @@ -179,7 +179,7 @@ func ToM3u8(source string) { CommonUtil.Exec(ffmpeg, getTargetPath(source), `-i`, getTargetPath(source)+source[0:36]+".mp4", `-f`,`segment`, `-segment_time`, `60`, `-segment_format`, `mpegts`, `-segment_list`, - getTargetPath(source)+source[0:36]+"/"+source+`.m3u8`, `-c`, `copy`, `-bsf:v`, `h264_mp4toannexb`, + getTargetPath(source)+source[0:36]+`.m3u8`, `-c`, `copy`, `-bsf:v`, `h264_mp4toannexb`, `-map`, `0`, getTargetPath(source)+source[0:36]+`_%04d.ts`) //删除mp4 os.Remove(getTargetPath(source)+source[0:36]+".mp4")