我在第二行收到“恐慌:退出状态254”。
你能找出我在这里犯的错误吗:
command := exec.Command("avprobe", "inputfile.mp4 -loglevel quiet -show_streams -frame_size -print_format -show_format -of json")
output, err := command.StdoutPipe();
if err != nil {
log.Panic(err)
}
if err := command.Run(); err != nil {
log.Panic(err)
}
json.NewDecoder(output).Decode(&struct1)发布于 2013-07-06 04:55:46
包exec
func Command
func命令(名称字符串,参数...string) *命令
例如,
arg := []string{
"inputfile.mp4",
"-loglevel", "quiet",
"-show_streams",
"-frame_size",
"-print_format",
"-show_format",
"-of", "json",
}
command := exec.Command("avprobe", arg...)发布于 2013-07-06 04:54:29
您正在运行的等价物是
avprobe "inputfile.mp4 -loglevel quiet -show_streams -frame_size -print_format -show_format -of json"我猜avprobe不喜欢那样,试试吧
command := exec.Command("avprobe", "inputfile.mp4", "-loglevel", ...)您还可以使用exec.CombinedOutput()来获取avprobe的输出并查看它显示的内容。
https://stackoverflow.com/questions/17495862
复制相似问题