How to Eliminate Green Screen Halos and Spill From AI Mascot Animations
By the Charmotion team · Updated · How we write guides

Fix green halo and color spill in AI mascot video by keying the green at full resolution, choking the matte by a pixel or two, and removing green from edge pixels, then encoding with an alpha pixel format such as yuva420p. Halos are edge pixels that keep background color; spill is green light reflected onto the character.
Key takeaways
- Key the green from the largest copy of the video, before any resizing or re-encoding.
- Choke the matte by a pixel or two and remove green from edge pixels to clear halos.
- Despill only where green is the dominant channel, and protect any color that is meant to be green.
- Encode with yuva420p and confirm the alpha with ffprobe before you ship.
- Safari has been reported to ignore WebM alpha, so serve a HEVC alpha MOV alongside it.
What causes green halos and color spill in AI mascot video?
A halo and spill are two separate defects that often appear together. A halo is a thin green fringe, or a dark or light outline, around the edge of the character. Spill is green light that the mascot picks up from the background, so its face, limbs or fills look tinted green even away from the edge.
Many AI video tools return opaque MP4 files, so a mascot is often generated on a flat green background and keyed afterwards. The key creates three common problems:
- Semi-transparent edge pixels still carry green from the background, which shows as a halo.
- Anti-aliased outlines sit between the mascot and the background. A loose threshold leaves a fringe, and a tight one eats the outline.
- Re-encoding and resizing smear the alpha. Chroma subsampling in 4:2:0 formats softens the edge, and scaling after the key blends green back in.
Spill is a whole-character problem. It comes from light bouncing off the green screen onto the artwork, so a tighter key does not fix it. You need a despill step. For how loops and frame seams behave in generated clips, see how to make a seamless loop AI video, and for alpha basics in generated footage see AI video generators with a transparent background.
How to fix green screen halo and color spill on AI generated mascot video?
Work through these steps in order. Each one is quick to redo, so change one value at a time and compare zoomed frames.
- Start from the largest copy you have. Key before any scaling. Keying a downsized file blends green into the edge pixels, which makes the halo harder to remove.
- Pick a key color the mascot does not use. If the character contains green, key a different flat color. Sample the background on several frames, not one, because AI video often drifts in brightness.
- Tighten the key, then soften it. Start with a low similarity so only the background is removed. Then add a little blend to soften the outline. Check the edge at 400% zoom.
- Choke the matte by one or two pixels. Shrinking the alpha removes the last green fringe. Most editors have a choke or contract command for this.
- Despill the edge and the body. Where green is the largest channel, pull it down toward the average of red and blue.
- Encode with an alpha format and check it. Use yuva420p for WebM, then confirm the output with ffprobe as shown in the last section.
If the halo returns after the choke, the key is still too loose. Go back to step three rather than adding more choke, because heavy choking thins thin strokes such as whiskers, antennae and eyelashes.
Which FFmpeg commands keep the alpha channel?
FFmpeg gives you direct control over the key and the encode. The commands below assume a build that includes the libvpx-vp9 encoder. Check the filter options in your own build with ffmpeg -h filter=chromakey, because flags can change between versions.
To key a green clip and write a transparent WebM in one command:
ffmpeg -i raw_green.mp4 -vf "chromakey=0x00FF00:0.12:0.08,format=yuva420p" -c:v libvpx-vp9 -pix_fmt yuva420p -auto-alt-ref 0 -b:v 2M -an keyed.webmThe chromakey filter takes a color, a similarity and a blend value. The values 0.12 and 0.08 are starting points, not settings for every clip. Tune them on the frame with the hardest edge.
For a two-pass VP9 alpha encode, run the first pass to a null output and the second pass to the file. Both passes use yuva420p. On Windows, replace /dev/null with NUL.
ffmpeg -i keyed.mov -c:v libvpx-vp9 -pix_fmt yuva420p -auto-alt-ref 0 -b:v 2M -pass 1 -f null /dev/null
ffmpeg -i keyed.mov -c:v libvpx-vp9 -pix_fmt yuva420p -auto-alt-ref 0 -b:v 2M -pass 2 -an keyed.webmIf you have a numbered PNG sequence, the frames must be RGBA PNGs with a real alpha channel. A PNG that was flattened onto green has no alpha to keep, and the key will have to do the work.
ffmpeg -framerate 30 -i frame_%04d.png -c:v libvpx-vp9 -pix_fmt yuva420p -auto-alt-ref 0 -b:v 2M -an mascot.webmWhen you re-encode an existing alpha WebM, put the VP9 decoder before the input. Without it, FFmpeg's native VP9 decoder drops the alpha. The alpha_mode tag flags the alpha in the output.
ffmpeg -c:v libvpx-vp9 -i input.webm -c:v libvpx-vp9 -pix_fmt yuva420p -auto-alt-ref 0 -b:v 2M -metadata:s:v:0 alpha_mode=1 -an output.webmIf your editor exports ProRes 4444 with alpha, convert that MOV to WebM with the same yuva420p command. ProRes encoder settings differ between tools, so use your editor's export preset rather than copying a flag set from a blog post.
How do you remove green from the edge and the body without changing the colors?
Despill changes only the green channel, and only where green is the dominant channel. Most mascot colors have more red or blue than green, so a despill pass leaves them alone. A green object on the character is the exception, and it needs protection.
- Protect anything meant to be green. Mask it out of the despill, or key the background in a different color.
- Check blues and whites after the pass. A heavy pass can turn light blues and off-whites muddy.
- Repeat only when a tint remains. Each extra pass moves the colors further from the original artwork, so compare against the source frame after every pass.
On a flat-color mascot, despill is usually a single step. On a textured or painted character, keep the change small. The edge is the priority: a clean outline matters more than a perfect color in the interior, because viewers judge the silhouette first.
Why does transparent WebM look wrong in Safari, and what should you serve instead?
WebM with VP9 alpha displays transparency in Chromium-based browsers and Firefox. A Svgator guide states that Chrome, Edge and Firefox show the alpha channel of a VP8 or VP9 WebM, while Safari ignores it. Other reports are less consistent, and the Chrome team's alpha transparency post covers the WebM side only. Test on the devices your audience uses.
Apple's HEVC with alpha is the Safari route. Apple introduced it for Safari on iOS 13 and macOS Catalina. It can be encoded with AVFoundation presets, avconvert, or FFmpeg on macOS. Other browsers generally do not render its alpha layer, so a fallback is usually needed. For the file format trade-offs, see transparent MP4 and HEVC with alpha.
A common pattern is a MOV with HEVC alpha for Safari and a WebM with VP9 alpha for everything else. Browsers try the sources in order and can accept a file type before failing to play it, so test the markup in each browser:
<video autoplay loop muted playsinline>
<source src="mascot-hevc.mov" type="video/quicktime">
<source src="mascot-vp9.webm" type="video/webm">
</video>For the page-level setup of transparent video, see transparent video on websites.
How do you test a transparent mascot video before you ship it?
Test the file on the backgrounds it will meet. A key that looks clean on white can show a green fringe on a dark page, and a fringe that is invisible at normal size becomes obvious on a retina screen.
- Play the clip over dark, light and saturated backgrounds, and zoom to 400% on the outline.
- Check the pixel format with ffprobe (command below). The output should read pix_fmt=yuva420p.
- Play the file in Safari, Chrome and Firefox, and on a phone.
- Check the file size against your budget. Lower -b:v if needed, then recheck the edge.
ffprobe -v error -select_streams v:0 -show_entries stream=codec_name,pix_fmt -of default=nw=1 mascot.webmIf the output reads yuv420p, the alpha was lost in the encode, and viewers will see a solid background. If the clip will be exported as a GIF, note that GIF transparency is on or off, so faint edge fringes become more visible; see how to make GIPHY stickers from a mascot. The transparent video checker is a quick way to review a file before upload.
If your mascot comes from Charmotion, its transparent WebM (VP9 alpha) and transparent MOV (HEVC alpha) exports are already keyed, so start from those and run the same checks on your real background. Exports do not use credits, and the formats available on each plan are listed on the how-it-works page.
Remove green halo and color spill from an AI mascot video
- Key before scaling. Key the green from the largest copy of the video, before any resizing or re-encoding.
- Pick a key color. Choose a flat key color the mascot does not use, and sample the background across several frames.
- Tighten, then soften the key. Start with a low similarity so only the background is removed, then add a little blend to soften the outline.
- Choke the matte. Shrink the alpha by one or two pixels to remove the last green fringe.
- Despill the edge and body. Reduce green only where it is the dominant channel, and protect any color that is meant to be green.
- Encode and verify. Encode WebM with yuva420p and MOV with HEVC alpha, confirm the pixel format with ffprobe, and check edges on dark and light backgrounds.
Frequently asked questions
Can I skip keying if my AI tool can export transparency?
Yes, if the tool exports real alpha. Check its documentation for an alpha output option, because many video generators return only opaque MP4 files (as of December 2026). Wan Alpha, a research model from WeChat's computer vision team, generates RGBA video, which shows the format exists, but it is research code. Even with real alpha, check the frames for a fringe.
Why does my key work on some frames but not others?
AI video often shifts brightness and color between frames, so one threshold does not fit the whole clip. Sample the background on several frames, use a slightly looser similarity, and check the frames with the most motion. If the drift is large, regenerate the clip on a flatter background rather than tuning the key harder.
Should I deliver WebM or MOV?
Deliver both. WebM with VP9 alpha covers Chromium-based browsers and Firefox, and HEVC alpha MOV covers Safari. Shipping only one file is the usual cause of a black or solid edge on one platform, so serve the pair and test the source order in each browser.
Do I need to key a Charmotion export?
No. Charmotion's transparent WebM and transparent MOV exports already carry alpha, so keying them a second time can add fringe instead of removing it. Run the edge checks on your real background, and if an edge needs work, go back to the source and re-export.
Sources
- Alpha transparency in Chrome video, Google Chrome
- FFmpeg alpha masking (VP9 WebM), Curiosalon
- Process VP9 WebM video with alpha channel, Salivity
- What is a WebM file?, SVGator
- Using HEVC video with alpha, Apple
- How Charmotion delivers animations (formats by plan), Charmotion