u2takey / ffmpeg-go

golang binding for ffmpeg
Apache License 2.0
1.67k stars 167 forks source link

"Imaging" not declared #56

Open Caterpillar-cmd opened 2 years ago

Caterpillar-cmd commented 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)
}
xycsys commented 1 year ago

go get -u github.com/disintegration/imaging