demo save

This commit is contained in:
xingnaidong1
2022-01-06 17:28:07 +08:00
parent f66e081ea9
commit a538f53f13
43 changed files with 36551 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
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
}