You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
736 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

package ConvertUtil
import (
"dsSupport/Utils/ShellUtil"
"os"
"path"
)
//运行的目录
var runDir string
func init() {
runDir, _ = os.Getwd()
}
/**
功能:对指定的视频文件进行切片
作者:黄海
时间2020-07-08
*/
func Cut(source string) {
//1、源视频文件
sourcePath:=runDir+"/Source/"+source[0:2]+"/"+source
//2、获取文件后缀
extension:= path.Ext(source)
//3、输出的文件通配名称
targetPath:=runDir+`/Target/`+source[0:36]+`_%03d.`+extension
//4、切片
cmdLine := runDir + `\ffmpeg\ffmpeg.exe -fflags +genpts -i ` + sourcePath + ` -acodec copy -vcodec copy -f segment -segment_time 300 -reset_timestamps 1 -map 0:0 -map 0:1 ` + targetPath
ShellUtil.ExecCommand(cmdLine)
}