Loading...
Loading...
Turns an AI-generated (or filmed) clip of a character or product into a transparent, web-ready animation by shooting it on a flat chroma plate and keying it with per-frame plate measurement and edge unmixing. Delivers stacked-alpha MP4 that plays with transparency in every browser including Safari, VP9 alpha WebM, or keyed WebP frame sequences for scroll scrubbing. Use when an animated subject has to sit over page content, between layers of type, or over a 3D scene, when someone asks for "transparent video", "video with alpha", "remove the background from this clip", or when a generated video has a background that should not be there.
npx skill4agent add moh4696/open-3d-skills alpha-cutout| File | What it does |
|---|---|
| Places a cut-out subject on a key plate with headroom; picks the key colour the subject clashes with least |
| Keys a clip or still into stacked MP4, VP9 alpha WebM, RGBA WebP frames or PNGs |
| Plays a stacked-alpha MP4 with transparency on a canvas (WebGL), with |
pip install numpy opencv-python-headless pillowpython3 scripts/plate.py subject.png plate.png --size 1350x1800 --fit 0.8motion-assetsThe background must remain a completely flat, uniform, pure chroma-key magenta (exact RGB 255, 0, 255) filling the entire frame, with no shadows, no floor, no gradient, no vignette and no scenery. Locked-off camera.
python3 scripts/key.py clip.mp4 --png check/ --frame-list 0,40,80,120 # inspect first
python3 scripts/key.py clip.mp4 --stacked hero-1080.mp4 --width 1080
python3 scripts/key.py clip.mp4 --stacked hero-720.mp4 --width 720 # phones
python3 scripts/key.py clip.mp4 --frames serve/lg --width 960 --start 0 --end 78--pngF = (C - (1 - a) K) / a--png| You see | Do |
|---|---|
| A thin outline that follows the subject | |
| Holes in light or shiny parts | That colour is too close to the key. Regenerate on a different key ( |
| Pink or green wash over the whole background | The plate gradient is stronger than usual; check the measured plate colours and raise |
| A detail changed colour mid-clip (a cap turned green) | Model drift, not a keying fault. Recolour that hue in those frames, or regenerate |
| Coloured line round the subject after compression | Already handled: colour under transparent pixels is the subject's own edge colour pushed outward, so chroma subsampling has nothing foreign to bleed in. |
| Output | Plays in | Use for |
|---|---|---|
| Every browser, Safari and iOS included | Looping heroes, characters, anything that plays |
| Chrome, Edge, Firefox. Not Safari | A plain |
| Everywhere | Scroll-scrubbed motion (see |
import { AlphaVideo } from "./alpha-video.js";
const hero = new AlphaVideo(document.querySelector("canvas.hero"), innerWidth > 900 ? "hero-1080.mp4" : "hero-720.mp4");
hero.onready = () => document.body.classList.add("hero-ready");
function frame() { hero.draw(); requestAnimationFrame(frame); }
requestAnimationFrame(frame);{ loop: false, autoplay: false }hero.seek(seconds)frame-capturepython3 -m http.serverprefers-reduced-motion: reduce--png