package examples import ( "bytes" "fmt" "io" "os" ffmpeg "github.com/u2takey/ffmpeg-go" ) func ExampleReadFrameAsJpeg(inFileName string, frameNum int) io.Reader { 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 }