Skip to content

go-ffstatic/ffstatic

Repository files navigation

ffstatic

Embed ffmpeg and ffprobe static binaries into your go program and use them without preinstalled binaries.

This project is inspired by ffmpeg-static.

How it works

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).

Installation

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

Basic Usage

You can use os/exec to execute ffmpeg/ffprobe directly. I also recommend using ffmpeg wrappers, for example:

Check examples/basic for more details.

Cross-platform

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.

License

MIT

About

Use ffmpeg and ffprobe in Go without pre-installed binaries.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published