go 程序取流截图
// 根据URL调用ffmpeg 获取截图
func GetIpcScreenShot(ffmpegPath string, url string, screenShotPath string) string {
var params []string
params = append(params, "-rtsp_transport")
params = append(params, "tcp")
params = append(params, "-timeout")
// 10s
params = append(params, "10000000")
params = append(params, "-y")
params = append(params, "-i")
params = append(params, url)
params = append(params, "-ss")
params = append(params, "00:00:02")
params = append(params, "-vframes")
params = append(params, "1")
params = append(params, "-f")
params = append(params, "image2")
params = append(params, "-vcodec")
params = append(params, "png")
params = append(params, screenShotPath)
resp, err := CallCommandRun(ffmpegPath, params)
if err != nil {
fmt.Println(err.Error())
fmt.Println("获取截图出错,url为--->", url)
}
return resp
}