go-ffmpreg

module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 6, 2024 License: GPL-3.0

README

go-ffmpreg

empregge- sorry, uh... embedded ffmpeg WASM binaries with a small Go library wrapper

ffmpeg version: n5.1.5 (the latest version not reliant on pthreads)

yes, you will have to publicly acknowledge the fact you used ffmpreg as this is GPL

ffmpeg is built with GPLv3 code enabled and with the following external libraries:

  • libx264 (for H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10 encoding)
  • libwebp (for WebP encoding)
  • libmp3l*me (for mp3 encoding)
  • zlib

for a list of what ffmpeg supports (and what it requires external libaries for) see: https://www.ffmpeg.org/general.html#External-libraries

the resulting binaries are passed through many wasm-opt optimization passes focusing on speed, and size, such that the resulting embeddded binaries are each ~13MB

usage

see cmd/{ffmpeg,ffprobe} for examples

note since wazero runtime is not aware of a "working directory", all paths passed must be absolute relative to filesystem mount

build

podman build --file=build/build.dockerfile

alternatively with far more optimization passes

podman build --file=build/build.dockerfile --build-arg RELEASE=yes

then copy /build/{ffmpeg,ffprobe} from resulting image

the build system itself is separated into scripts found under build/, which are called by build/build.dockerfile. to build ffmpeg with a new external library add a new script for it under build/ that sources build/environ and outputs library header, archive and pkg-config (if any) to /vendor in the build image

future

  • more tests (hence why this library only has pre-releases)

  • finish stabilizing / documenting the API

  • update ffmpeg to n7.x.x when wasi threads are available

  • build with libjxl (JPEG XL), libvpx (VP8/9), libopus (Opus), some form of AV1 encode / decode

Directories

Path Synopsis
cmd
embed

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL