How do I convert an MP4 with a solid background into a transparent WebM?
An MP4 has no alpha channel, so you have to create one before encoding. If the background is one flat color (green, blue, black, or white), key it out with FFmpeg's colorkey or chromakey filter and encode VP9 with yuva420p. If the background is a real room, a key will not hold; use AI background removal first. Either way, deliver WebM for Chrome, Firefox, and OBS, and a separate HEVC-with-alpha file for Safari. ExportAlpha does not export HEVC-with-alpha.
Updated
Real background? Remove it, then download WebM
Upload the clip. WebM with alpha up to 60 seconds, or ProRes 4444 up to 8 seconds.
5 free credits on first sign-in for most new accounts. Trial stills capped at 5. No card required. Fair-use limits apply.
Pick a method from the background
| Your MP4 background | Method | Tool | Output |
|---|---|---|---|
| Flat green or blue screen | chromakey | FFmpeg, OBS, or an editor | VP9 WebM with alpha |
| Flat black or white, such as a rendered logo | colorkey | FFmpeg | VP9 WebM with alpha |
| Real scene (room, street) | AI matting | ExportAlpha, or another remover that writes alpha | WebM up to 60s, or ProRes 4444 up to 8s |
| Already has alpha (ProRes 4444 MOV) | Encode only. Do not key it. | FFmpeg | See ProRes MOV with alpha to WebM. This page does not repeat that command. |
Commands tested on FFmpeg 6.1.1
Tested October 9, 2026, FFmpeg 6.1.1, libvpx 1.14.0, on 320×180 synthetic clips (about half a second, no audio). Green screen: a red rectangle on flat green. Black: a white rectangle on flat black. White: a blue rectangle on flat white. Each output's keyed corner had alpha 0 when decoded with -c:v libvpx-vp9. The subject stayed opaque. A real shoot with spill, hair, or compression blocks was not part of this test. Raise or lower the similarity value if your screen is not this flat.
Flat green
ffmpeg -i input.mp4 -vf "chromakey=0x00FF00:0.25:0.05,format=yuva420p" -c:v libvpx-vp9 -b:v 0 -crf 30 -auto-alt-ref 0 -an output.webmFlat black
ffmpeg -i input.mp4 -vf "colorkey=0x000000:0.10:0.05,format=yuva420p" -c:v libvpx-vp9 -b:v 0 -crf 30 -auto-alt-ref 0 -an output.webmFlat white
ffmpeg -i input.mp4 -vf "colorkey=0xFFFFFF:0.10:0.05,format=yuva420p" -c:v libvpx-vp9 -b:v 0 -crf 30 -auto-alt-ref 0 -an output.webmFFmpeg's filter manual calls chromakey "YUV colorspace color/chroma keying" and colorkey "RGB colorspace color keying." colorkey's default key color is black. The similarity and blend numbers above are the ones that cleared these synthetic frames. Similarity 0.15 on the same green MP4 left the corner nearly opaque (alpha 252), because the green was no longer exact after H.264 yuv420p. They are not a universal setting.
The commands include -auto-alt-ref 0. On this FFmpeg build the encoder help describes that flag as alternate reference frames (2-pass only). The same green-screen command also wrote alpha when the flag was left off, so this page does not treat the flag as the step that creates transparency. ExportAlpha's solid-color keyer passes -auto-alt-ref 0. The AI export is stored from the video model and is not re-encoded with this command.
-an drops the audio track. The tested WebM files had a video stream and no audio stream.
Check the alpha plane
ffprobe -v error -select_streams v:0 -show_entries stream=pix_fmt:stream_tags=alpha_mode -of default output.webm
ffmpeg -hide_banner -c:v libvpx-vp9 -i output.webm -f null -On this build, ffprobe printed pix_fmt=yuv420p and alpha_mode=1. The second command, which forces the libvpx-vp9 decoder, printed yuva420p. Decoding with the default vp9 decoder kept the green (or black, or white) and set alpha to 255. If you sample pixels, use the libvpx decoder or you will think the key failed.
A smaller file for the web
-b:v 0 -crf 30 is the rate control used in the test. It produced a small WebM from a flat synthetic frame. A busy shot at 1080p will be larger. This page does not publish a target megabyte size. Keep the pixel format and do not add an audio track you do not need (-an). For a page player:
<video autoplay muted loop playsinline>
<source src="alpha.webm" type="video/webm" />
</video>Put the video over a colored element. Muted is what allows autoplay in current browsers. Safari still needs a second, HEVC-with-alpha source, which this command does not create. See transparent video for Safari and Chrome.
When a flat key is the wrong tool
Spill, hair, smoke, and compression blocks are outside what these synthetic tests covered. If the keyed edge is a hard fringe, do not keep raising similarity until the subject disappears. Remove the background with a matte instead. ExportAlpha accepts the MP4 (up to 60 seconds, 1080p, 200 MB) and writes WebM or a short ProRes 4444 MOV.
Frequently Asked Questions
Can FFmpeg remove a background from a normal MP4?
It can key one flat color. chromakey and colorkey set matching pixels to transparent, then you encode VP9 with alpha. FFmpeg does not know which person to keep in a real room. That needs a matte from an editor or from AI background removal.
What does yuva420p mean?
It is a pixel format with color plus an alpha channel. On FFmpeg 6.1.1 the encoder reported yuva420p while writing the WebM. A default ffprobe of the same file reported pix_fmt yuv420p and the tag alpha_mode=1. Decoding with -c:v libvpx-vp9 reported yuva420p and showed alpha 0 on the keyed pixels.
Why is my output WebM still black after chromakey?
Three separate cases showed up in testing. The default vp9 decoder ignores the alpha plane and the keyed pixels look opaque. A system player often composites transparency onto black even when alpha is present. And if the background was not one flat color, the key left the background in the color channels. Check alpha with the libvpx-vp9 decoder before you blame the file.
Should I use colorkey or chromakey?
FFmpeg documents chromakey as YUV color keying and colorkey as RGB color keying. colorkey's default key color is black. On a synthetic green screen stored as H.264 yuv420p, chromakey=0x00FF00:0.25:0.05 cleared the green (corner alpha 0). Similarity 0.15 left that corner nearly opaque (alpha 252). On synthetic black and white backgrounds, colorkey=0x000000:0.10:0.05 and colorkey=0xFFFFFF:0.10:0.05 cleared those colors. A real camera roll may need different similarity values. These tests used flat generated frames, not a studio shoot.
Will the WebM play with transparency in Safari?
Not as a transparent composite. WebKit bug 275908 says VP9 with transparency plays with a grey background rather than transparent. Ship a separate HEVC-with-alpha file for Safari. ExportAlpha does not export that file.
How do I make the transparent WebM smaller?
The tested command uses -b:v 0 -crf 30. A higher CRF number is smaller and less sharp. Do not convert the result to everyday H.264 MP4 to save space. That drops the alpha. See the guide How do I compress a video with an alpha channel?
Can I convert the WebM back to MP4 with transparency?
Not as everyday H.264 MP4. That codec does not store the alpha channel. The holes become a solid color. See the guide Does MP4 support a transparent background?
Sources
- FFmpeg filters, chromakey and colorkey: ffmpeg-filters.html (retrieved October 9, 2026). Commands above were run the same day on FFmpeg 6.1.1.
- WebKit bug 275908: grey background rather than transparent (status NEW, retrieved October 9, 2026).
- Does MP4 support a transparent background?
- Compress a video with an alpha channel
Skip the key when the background is a real place
Upload the MP4. The download is transparent WebM, or ProRes 4444 if the clip is 8 seconds or shorter.
5 free credits on first sign-in for most new accounts. Trial stills capped at 5. No card required. Fair-use limits apply.