Embed ffmpeg and ffprobe static binaries into your go program and use them without preinstalled binaries.
This project is inspired by ffmpeg-static.
We use go embed to embed the ffmpeg/ffprobe binaries as bytes in the go program. The real ffmpeg/ffprobe executable files would be created in the temp directory when you run the program.
With this package, you can use ffmpeg/ffprobe without preinstalling. It would be very helpful to run programs on serverless platforms (ie. lambda/Vercel).
Select the version that matches your environment:
-
Darwin
-
amd64
go get -u github.com/go-ffstatic/darwin-amd64
-
arm64
go get -u github.com/go-ffstatic/darwin-arm64
-
-
Linux
-
amd64
go get -u github.com/go-ffstatic/linux-amd64
-
arm64
go get -u github.com/go-ffstatic/linux-arm64
-
arm
go get -u github.com/go-ffstatic/linux-arm
-
386
go get -u github.com/go-ffstatic/linux-386
-
-
Windows
-
amd64
go get -u github.com/go-ffstatic/windows-amd64
-
386
go get -u github.com/go-ffstatic/windows-386
-
-
FreeBSD
-
amd64
go get -u github.com/go-ffstatic/freebsd-amd64
-
You can use os/exec
to execute ffmpeg/ffprobe directly. I also recommend using ffmpeg wrappers, for example:
Check examples/basic for more details.
If you want to run your program on multiple platforms (dev on darwin, deploy on linux, etc.), you need to use go:build
constrain for cross compile.
Check examples/cross-plaform for more details.
MIT