Open Caterpillar-cmd opened 2 years ago
The sample code Task Frames of Video do not work, "imaging" and "t" are not declared.
buf := bytes.NewBuffer(nil) err := ffmpeg.Input(inFileName). Filter("select", ffmpeg.Args{fmt.Sprintf("gte(n,%d)", frameNum)}). Output("pipe:", ffmpeg.KwArgs{"vframes": 1, "format": "image2", "vcodec": "mjpeg"}). WithOutput(buf, os.Stdout). Run() if err != nil { panic(err) } return buf } reader := ExampleReadFrameAsJpeg("./sample_data/in1.mp4", 5) img, err := imaging.Decode(reader) if err != nil { t.Fatal(err) } err = imaging.Save(img, "./sample_data/out1.jpeg") if err != nil { t.Fatal(err) }
go get -u github.com/disintegration/imaging
The sample code Task Frames of Video do not work, "imaging" and "t" are not declared.