Skip to content

Instantly share code, notes, and snippets.

View AndrusGerman's full-sized avatar
🏠
Working from home

Andrus Diaz German AndrusGerman

🏠
Working from home
View GitHub Profile
@ArseniySavin
ArseniySavin / FirstFrame_ffmpeg.go
Last active May 29, 2022 14:13
Getting first frame used ffmpeg. Read / Write into stdin /stdout
func FirstFrame(path string, data []byte) (*bufio.Reader, error) {
cmd := exec.Command(path,
"-i", "-", // read from stdin
"-vframes", fmt.Sprint(1), // frame
"-s", fmt.Sprintf("%dx%d", 640, 360), // size
"-q:v", fmt.Sprint(2), // quality
"-f", "singlejpeg", // jpeg binary
"-", // read from stdout
)
// stdin read
https://gcc.gnu.org/
https://stackoverflow.com/questions/43580131/exec-gcc-executable-file-not-found-in-path-when-trying-go-build
gcc (the GNU Compiler Collection) provides a C compiler.
On Windows, install TDM-GCC(http://tdm-gcc.tdragon.net/download). The github.com/miekg/pkcs11 package uses cgo.
Cgo enables the creation of Go packages that call C code.
System Variables > PATH > add "C:\TDM-GCC-64\bin"