This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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" |