ffmpeg -framerate 30 -i frame_%04d.png -c:v libvpx-vp9 -pix_fmt yuva420p -b:v 0 -crf 32 output.webm — set -framerate to your animation’s rate. Or upload a ZIP of the frames to the free PNG sequence to WebM converter. In our test 90 frames of 1080p, 135 MB of PNGs, became under 1 MB of WebM with the alpha intact.Export the frames with alpha
The frames must contain transparency before anything else matters. In After Effects, render a PNG sequence with Channels set to RGB + Alpha. In Blender, enable Film → Transparent and save PNG as RGBA. In Spine, Unity or other tools, pick PNG with an alpha channel. Name the frames with a fixed number of digits — frame_0001.png, frame_0002.png — so they sort in order.
This step causes more failed conversions than the command itself. When we encoded frames that had been saved as plain RGB, the WebM even carried the ALPHA_MODE=1 tag — and was completely opaque. A tag is not proof; the frames have to hold real transparency.
The FFmpeg command
From the folder with the frames:
ffmpeg -framerate 30 -i frame_%04d.png -c:v libvpx-vp9 -pix_fmt yuva420p -b:v 0 -crf 32 output.webm
-frameratemust come before-iand match your animation. Leave it out and FFmpeg assumes 25 fps: in our test a 24 fps animation that should last 3.75 seconds came out at 3.6 seconds, slightly too fast.-i frame_%04d.pngmeans four-digit numbers. For other naming, use-pattern_type glob -i "*.png"on macOS or Linux; it worked identically in our test.-pix_fmt yuva420pkeeps the alpha. With RGBA frames FFmpeg picked it by itself in our test, but stating it protects you if anything else in the command forcesyuv420p, which produced an opaque file.-crf 32balances size and quality; lower is better quality and a bigger file.- Many guides add
-auto-alt-ref 0. It is only needed for VP8; with VP9 the alpha came through either way in our tests.
How big the result is
| Input / output | Size |
|---|---|
| 90 PNG frames, 1920×1080 with alpha | 135 MB (about 1.5 MB per frame) |
| WebM, VP9, CRF 32 | 0.23 MB per second |
| WebM, VP9, CRF 32, scaled to 720p | 0.10 MB per second |
In an earlier test this setting gave a 30-second 1080p clip under 10 MB with clean edges. Adding -deadline realtime -cpu-used 8 -row-mt 1 encoded about seven times faster for a file roughly a third larger.
Common errors
- “Could find no file with path …” — the pattern does not match the names. Check the digit count (
%04d= 0001) and whether numbering starts at 0 or 1; add-start_number 1if it starts higher. - Video plays too fast or too slow —
-framerateis missing or wrong. - Background is black or opaque — the PNGs have no alpha, or the command forces
yuv420p. Open one frame in an image editor to check. - Partly transparent, partly not — a mix of RGB and RGBA frames, often from re-rendering part of the sequence. Re-export the whole sequence the same way.
Check the result
Open the WebM in Chrome or Firefox on a coloured page, or extract the alpha: ffmpeg -c:v libvpx-vp9 -i output.webm -vf alphaextract -frames:v 1 alpha.png. A black-and-white silhouette means the transparency is there. Note the -c:v libvpx-vp9 before -i: FFmpeg’s default VP9 decoder ignores alpha and would show a solid frame.
Without the command line
Zip the frames and upload them to the free PNG sequence to WebM converter: free for up to 10 seconds of frames (50 MB, 3 a day, frames above 1080p resized), or at full quality — up to 60 seconds at up to 60 fps, at the original size — from 2 credits, and the result is checked for real transparency before you download it.
How we tested
November 7, 2026, FFmpeg 6.1.1 with libvpx 1.14 on Ubuntu. Frames: 90 PNGs extracted from a 1920×1080, 23.976 fps background-removal result from this site, once as RGBA and once as plain RGB. Alpha was checked on frame 45 with the libvpx-vp9 decoder.
Common questions
What is the FFmpeg command for PNG sequence to WebM with transparency?+
ffmpeg -framerate 30 -i frame_%04d.png -c:v libvpx-vp9 -pix_fmt yuva420p -b:v 0 -crf 32 output.webm, with -framerate set to your animation's frame rate.
Why is my WebM from a PNG sequence not transparent?+
Usually the PNG frames were saved without an alpha channel. In our test, RGB frames produced a WebM tagged as transparent but completely opaque. Re-export the frames as RGBA.
Why does my WebM play at the wrong speed?+
FFmpeg assumes 25 fps for an image sequence unless -framerate is set before -i. A 24 fps animation then plays about 4% too fast.
Do I need -pix_fmt yuva420p?+
With RGBA frames FFmpeg selected it automatically in our test, but keep it in the command: if any option forces yuv420p, the alpha is dropped without an error.
How do I use frames that are not numbered with four digits?+
Change %04d to match, for example %05d for 00001, or use -pattern_type glob -i "*.png" on macOS and Linux to take every PNG in name order.