Merge branch 'master' of 10.10.14.250:huanghai/dsMin

master
wubin 5 years ago
commit 0c5dde59b6

@ -11,19 +11,19 @@ func main() {
ConvertUtil.InitDir(source) ConvertUtil.InitDir(source)
//2、对视频文件进行切片 //2、对视频文件进行切片
ConvertUtil.Cut(source) ConvertUtil.Cut(source)
//2、切片完成后,尝试进行转码 //3、切片完成后,尝试进行转码
var childMovie = ConvertUtil.GetAllCutChild(source) var childMovie = ConvertUtil.GetAllCutChild(source)
for i := range childMovie { for i := range childMovie {
ConvertUtil.ConvertToH264Mp4(childMovie[i]) ConvertUtil.ConvertToH264Mp4(childMovie[i])
} }
//3、生成拼接的索引文件 //4、生成拼接的索引文件
ConvertUtil.GenerateIndexTxt(source, childMovie) ConvertUtil.GenerateIndexTxt(source, childMovie)
//4、合成MP4 //5、合成MP4
ConvertUtil.Merge(source) ConvertUtil.Merge(source)
//5、清除垃圾 //6、清除垃圾
ConvertUtil.ClearRubbish(source) ConvertUtil.ClearRubbish(source)
//6、查看转换结果 //7、查看转换结果
ConvertUtil.ShowMovieInfo(source) ConvertUtil.ShowMovieInfo(source)
//7、转码为M3U8 //8、转码为M3U8
ConvertUtil.ToM3u8(source) ConvertUtil.ToM3u8(source)
} }

@ -22,8 +22,8 @@ func init() {
} }
const WorkingPath = "/" const WorkingPath = "/"
const WorkingCutPath = "Cut/" const WorkingCutPath = "/Cut/"
const WorkingMp4Path = "Mp4/" const WorkingMp4Path = "/Mp4/"
/** /**
@ -31,7 +31,7 @@ const WorkingMp4Path = "Mp4/"
2020-07-09 2020-07-09
*/ */
func getWorkingPath(source string, p string) string { 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 2020-07-09
*/ */
func getSourcePath(source string) string{ 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`, CommonUtil.Exec(ffmpeg, getTargetPath(source), `-i`,
getTargetPath(source)+source[0:36]+".mp4", getTargetPath(source)+source[0:36]+".mp4",
`-f`,`segment`, `-segment_time`, `60`, `-segment_format`, `mpegts`, `-segment_list`, `-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`) `-map`, `0`, getTargetPath(source)+source[0:36]+`_%04d.ts`)
//删除mp4 //删除mp4
os.Remove(getTargetPath(source)+source[0:36]+".mp4") os.Remove(getTargetPath(source)+source[0:36]+".mp4")

Loading…
Cancel
Save