|
|
|
@ -1,8 +1,8 @@
|
|
|
|
|
package ConvertUtil
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"dsSupport/Utils/FileUtil"
|
|
|
|
|
"dsSupport/Utils/CommonUtil"
|
|
|
|
|
"dsSupport/Utils/FileUtil"
|
|
|
|
|
"fmt"
|
|
|
|
|
"os"
|
|
|
|
|
"path"
|
|
|
|
@ -62,7 +62,7 @@ func Cut(source string) {
|
|
|
|
|
//3、输出的文件通配名称
|
|
|
|
|
targetPath := getPath(source, CutPath) + source[0:36] + `_%03d` + extension
|
|
|
|
|
//4、切片
|
|
|
|
|
CommonUtil.Exec(ffmpeg, `-fflags`, `+genpts`, `-i`, sourcePath,
|
|
|
|
|
CommonUtil.Exec(ffmpeg, runDir+"/Source/"+source[0:2]+"/", `-fflags`, `+genpts`, `-i`, sourcePath,
|
|
|
|
|
`-acodec`, `copy`, `-vcodec`, `copy`, `-f`, `segment`, `-segment_time`,
|
|
|
|
|
`300`, `-reset_timestamps`, `1`, `-map`, `0:0`, `-map`, `0:1`, targetPath)
|
|
|
|
|
}
|
|
|
|
@ -92,7 +92,7 @@ func GetAllCutChild(source string) []string {
|
|
|
|
|
func ConvertToH264Mp4(childMovie string) {
|
|
|
|
|
extension := path.Ext(childMovie)
|
|
|
|
|
childMovieMp4 := strings.Replace(filepath.Base(childMovie), extension, ".mp4", -1)
|
|
|
|
|
CommonUtil.Exec(ffmpeg, `-i`, childMovie, `-c:v`, `libx264`, `-strict`, `-2`,
|
|
|
|
|
CommonUtil.Exec(ffmpeg, getPath(childMovieMp4, CutPath), `-i`, childMovie, `-c:v`, `libx264`, `-strict`, `-2`,
|
|
|
|
|
getPath(childMovieMp4, Mp4Path)+childMovieMp4)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -135,7 +135,7 @@ func Merge(source string) {
|
|
|
|
|
os.Remove(Target + "/" + source[0:36] + ".mp4")
|
|
|
|
|
}
|
|
|
|
|
//合并
|
|
|
|
|
CommonUtil.Exec(ffmpeg, `-f`, `concat`, `-i`, indexName, `-c`, `copy`, Target+"/"+source[0:36]+".mp4")
|
|
|
|
|
CommonUtil.Exec(ffmpeg,getPath(source,Mp4Path) ,`-f`, `concat`, `-i`, indexName, `-c`, `copy`, Target+"/"+source[0:36]+".mp4")
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|