Green Screen to Transparent WebM with ffmpeg

Last updated: · Written by the RenderAlpha team

Facts checked against the sources below on November 11, 2026. Commands and measurements run on FFmpeg 9.0.2 on November 11, 2026 with our own demo footage; playback was not retested for this guide.

A green screen is a way to make the background easy to remove, and ffmpeg can remove it. The chromakey filter turns one color into transparency, and a VP9 WebM can keep that transparency. This guide shows the command, then what happened when we changed its settings on a clip where the correct cutout was known.

Short answer

Key the green with chromakey, clean the green fringe with despill, and encode VP9 with alpha: chromakey=color=0x00b140:similarity=0.10:blend=0.10,despill=type=green, then -c:v libvpx-vp9 -pix_fmt yuva420p. On our test clip a similarity of 0.10 matched the known cutout closely, 0.20 made most of the subject transparent, and despill removed the green tint on the edges. Treat these numbers as a starting point for your own footage.

When keying is the right tool

Keying needs a background that is one flat color, lit evenly, and a subject that does not wear that color. If you have that, ffmpeg is free and exact. If the footage has a street, a room or a sky behind the subject, there is no single color to remove, and you need a different approach, covered at the end.

The source is usually an H.264 MP4, which has no alpha channel. Keying creates one. The output has to be a format that stores it: a transparent WebM for web pages and OBS, or ProRes 4444 for an editor. The format comparison explains how to choose.

The command

This is the command we ran on FFmpeg 9.0.2. The key color is sampled from the footage, not guessed: after H.264 compression the background of our clip read (0, 176, 64), one level off the (0, 177, 64) it was made with, so read the real value from a frame of your own clip.

FFmpeg’s filter documentation, which we opened on November 11, 2026, describes the two settings that matter.

SettingWhat the FFmpeg documentation says
chromakeyKeys in the YUV colorspace; the color you give it is replaced with transparency.
similarity0.01 matches only the exact key color, while 1.0 matches everything.
blend0.0 makes pixels either fully transparent or not transparent at all; higher values give semi-transparent pixels, more transparent the closer the color is to the key color.
despillRemoves contamination of foreground colors caused by the reflected color of a greenscreen or bluescreen.
Key out green, remove the green spill, write a VP9 WebM with alpha.
ffmpeg -i greenscreen.mp4 -vf "chromakey=color=0x00b140:similarity=0.10:blend=0.10,despill=type=green" -c:v libvpx-vp9 -pix_fmt yuva420p -b:v 0 -crf 30 -an keyed.webm

What the settings did on our test clip

To measure a key, you need to know the right answer. We took the cutout of a person from our own demo footage (a 5 second, 1280×720, 24 fps clip with a known alpha channel), composited it on a #00b140 background, saved that as an H.264 MP4, and keyed it back. Then we compared the keyed alpha with the original on frame 60 of 121.

The table shows the alpha error (average difference from the original on a 0 to 255 scale), how many edge pixels still leaned green, and the size of the VP9 file at CRF 30. “Green tint” means green exceeded both red and blue by more than 12 on a pixel that was at least 12 percent opaque.

The best result was similarity 0.10 with blend 0.10: the lowest alpha error and a file of 0.74 MB. Raising similarity to 0.15 started to eat the subject, and at 0.20 the key removed most of the person, because neutral skin and clothing tones sit close to green in the YUV chroma plane. The edge-tint figure falls at 0.15 and 0.20 only because those settings remove so much; it is not an improvement.

SettingsAlpha error (0–255)Edge pixels with green tintFile size
similarity 0.05, blend 0.051.3658.3%0.77 MB
similarity 0.10, blend 0.001.2047.1%0.77 MB
similarity 0.10, blend 0.100.6843.8%0.74 MB
similarity 0.10, blend 0.10, despill0.680.0%0.80 MB
similarity 0.12, blend 0.100.7838.3%0.74 MB
similarity 0.15, blend 0.105.2927.7%0.88 MB
similarity 0.20, blend 0.1038.937.6%0.94 MB

Why despill is not optional

Keying decides how transparent each pixel is. It does not change the pixel’s color, so a hair strand that was half green background and half hair stays greenish. On a dark or light page that shows as a green outline. Adding despill=type=green took the share of tinted edge pixels from 43.8% to 0.0% in our test, at the cost of a file about 8% larger (0.74 MB to 0.80 MB).

What this test does not tell you

Our clip is synthetic: a clean cutout on a perfectly flat green, with none of the uneven lighting, shadows, wrinkles and green light bouncing off the screen that real footage has. Real green screen footage will key worse than the numbers above, and we had no real green screen footage to test. We also did not test a blue screen, the colorkey or hsvkey filters, or keying in an editor such as After Effects.

A WebM written this way carries its alpha, as the WebM guide shows with ffprobe. It still plays opaque in Safari, which ignores VP9 alpha (see why a transparent WebM turns grey or black in Safari), so test the file in the browsers your viewers use.

If there is no green screen

Most clips have a real background. A key cannot help there, and drawing a mask by hand frame by frame is slow. RenderAlpha removes the background from ordinary footage with AI and exports a transparent WebM, ProRes 4444 or GIF, up to 60 seconds per run. The specs page lists the limits. For stream overlays, the OBS guide covers what to check before you add the file.

Frequently asked questions

What similarity value should I start with?

On our test clip, 0.10 with blend 0.10 worked best, and values from 0.15 up began removing the subject. The FFmpeg documentation’s own example uses 0.1 and 0.2. Real footage has uneven green, so try a few values on a short section of your clip and look at the result over a contrasting color.

Should I use chromakey or colorkey?

The FFmpeg documentation says chromakey works in the YUV colorspace and colorkey in the RGB colorspace on 8-bit frames. We only tested chromakey, which is the one its own example uses for green screen footage.

Can I key out a blue screen?

chromakey takes any key color, and the despill documentation covers bluescreen as well as greenscreen. We did not test blue footage, so check the result on your own clip.

Will the hair edges be soft?

A transparent WebM stores partial transparency, so the blend setting can give soft edges. A GIF cannot: it has on or off transparency only, as the GIF guide explains.

Does this work without a green screen?

No. Keying removes one color, so a clip with an ordinary background has nothing to key. Use an AI background remover for that footage.

Sources

Primary sources we checked. The date is when we last opened each page.