Media in pure Go
Most Go programs that need FFmpeg shell out to it and inherit a CLI's argument syntax and a process with the run of the disk. This is the other way: FFmpeg's libraries compiled to WebAssembly, driven from Go, and pointed at a filesystem that only exists in memory.
Start here
Why the reels needed an FFmpeg with no files on disk, and why the escape hatch turned out to be the useful part.
-
Introducing afmpeg and ffmpeg-wasi: FFmpeg with no install, no CGO, no diskFFmpeg in pure Go with no install, no CGO and no disk: a WebAssembly build running over an in-memory filesystem, and why it exists.
First Light
-
The escape hatch that turned out to be french doorsI wanted an FFmpeg that couldn't touch my disk. Building the interface to get one accidentally produced something considerably more useful.
Pioneering
How it works
A filesystem FFmpeg only thinks it has, several outputs from one pass, and progress without a stderr line to scrape.
-
FFmpeg thinks it has a diskFFmpeg assumes a disk it can seek around in. Giving it a convincing in-memory filesystem, and testing the behaviour that would hurt most first.
Pioneering
-
One input, many outputsafmpeg shipped single input to single output. Adding multi-pad filter graphs and multi-output muxing: one decode, two files, one pass.
Pioneering
-
A progress bar without a CLI to scrapeEvery FFmpeg progress bar I've seen scrapes the CLI's stderr. afmpeg has no CLI to scrape, so progress had to become part of the API instead.
Pioneering
What it costs to get right
A sandbox stops code execution and nothing else, a codec choice shaped by licensing, and a hang that only happened in one container format.
-
Sandboxed isn't safeA security review read "safely process untrusted media" and asked the harder question. A sandbox stops escape; it does not stop exhaustion.
Pioneering
-
An encoder on borrowed timeThe last US AVC patent expires in November 2027. Until then ffmpeg-wasi's H.264 encoder ships on sufferance, on Cisco's binaries taught to run under WASI.
Pioneering
-
The afternoon the agent earned its keepAdding stream-copy remux to a WebAssembly FFmpeg build, where writing Matroska hung forever and the identical MP4 path did not.
Pioneering
Where to next
- Security for a one-person estateWhere the sandbox argument sits alongside the rest of the untrusted-input posts.
- Building with AIThe agent that found the Matroska hang, and the rest of the agent work.