/media-os:ffmpeg-chromakey [key-color] [input]from media-os
Chromakey, greenscreen, and compositing using ffmpeg filters including chromakey, colorkey, hsvkey, lumakey, backgroundkey, chromakey_cuda, despill, and overlay with alpha.
Ships in media-os. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
Read when SKILL.md points to them; scripts run unread.
Context: $ARGUMENTS
chromakey_cudabackgroundkey beats chromalumakey| Situation | Filter |
|---|---|
| Clean green/blue screen, even lighting | chromakey (YUV/UV) |
Need RGB-based pick or chromakey struggles | colorkey (RGB) |
| Uneven lighting, muddy green, hair detail | hsvkey |
| No color — separate on brightness only | lumakey |
| Locked camera, have a clean plate | backgroundkey (subtracts plate) |
| NVIDIA GPU available, must be fast | chromakey_cuda |
Always sample the ACTUAL green from your footage (screenshot a flat patch, eyedrop in Preview / ffplay with -vf format=rgb24). 0x00FF00 is pure green and almost never matches real screens (typical: 0x20B040 – 0x3EB34C).
similarity — how wide the color tolerance is. 0 = exact match only, 1 = everything. Typical 0.05–0.20. Start 0.10.blend — edge softness (feather). 0 = hard binary edge (aliased, bad), >0 = graded alpha. Typical 0.02–0.10. Start 0.05.Loop: bump similarity until the screen is gone and the subject's edges start chewing → back off one notch → then raise blend until edges look natural.
# Basic chromakey (YUV), preserves alpha on yuva420p
ffmpeg -i fg.mp4 -vf "chromakey=0x20B040:0.12:0.05,format=yuva420p" -c:v qtrle keyed.mov
Even after a clean key, green light reflected onto the subject's skin / hair / white shirt will show as a sickly fringe. Always run despill after the key, before compositing.
# Key then despill (green). Chain inside the same filter graph.
[0:v]chromakey=0x20B040:0.12:0.04,despill=type=green:mix=0.5:expand=0.1[keyed]
type=green or type=bluemix = strength of spill removal (0.2 subtle, 0.6 aggressive)expand = how far from detected pixels to push correction (0.0–0.3)overlay# Simple green key + composite onto bg.mp4
ffmpeg -i fg.mp4 -i bg.mp4 \
-filter_complex "[0:v]chromakey=0x00FF00:0.10:0.05[keyed];[1:v][keyed]overlay=shortest=1[out]" \
-map "[out]" -map 0:a? -c:v libx264 -crf 18 -pix_fmt yuv420p out.mp4
Order: background first ([1:v]), keyed subject on top ([keyed]). shortest=1 ends at the shorter input; drop it to run until the longer input finishes.
scripts/key.py — key / composite / identity-transparent subcommands; picks an alpha-capable codec based on output extension.Key and write a transparent ProRes 4444 mezzanine:
uv run ${CLAUDE_SKILL_DIR}/scripts/key.py identity-transparent \
--input fg.mp4 --output keyed.mov --color 0x20B040 --similarity 0.12 --blend 0.05
Full composite in one shot:
uv run ${CLAUDE_SKILL_DIR}/scripts/key.py composite \
--fg fg.mp4 --bg bg.mp4 --output out.mp4 --color 0x20B040 --despill green
Read references/filters.md when tuning per-filter options, picking an alpha-capable codec/container, comparing chromakey vs colorkey vs hsvkey, or looking up real-world green/blue hex samples.
chromakey and colorkey differ in color space. chromakey operates on YUV chroma (hue + chroma, ignores luma) — robust to brightness variation. colorkey operates on RGB distance — simpler but fails under uneven lighting.0x00FF00 is almost NEVER the actual screen color. Sample the source (screenshot + eyedrop) or use colorkey=0x00FF00:0.30:0.20 with a huge similarity to find the range.similarity typical 0.01–0.30; blend typical 0.00–0.20. blend=0 produces hard aliased binary edges — always raise it slightly.format=yuva444p over yuva420p for clean edges; yuva420p subsamples chroma + alpha and fringes on hair.qtrle, MOV + ProRes 4444 (prores_ks -profile:v 4444 -pix_fmt yuva444p10le), WebM + libvpx-vp9 -pix_fmt yuva420p, or a PNG image sequence.overlay=shortest=1 ends output at the shorter input — omit when the bg is shorter than the subject and you want it held.despill=type=green (or type=blue). Do NOT try to hide it by cranking similarity.chromakey_cuda requires NVIDIA hwaccel and MUST be bracketed: hwupload_cuda,chromakey_cuda=...,hwdownload,format=yuva420p.similarity is fighting you.-map 0:a? keeps the subject's audio (the ? makes it optional so the command doesn't fail if input has no audio).ffmpeg -i subject.mp4 -i newbg.mp4 \
-filter_complex "[0:v]chromakey=0x20B040:0.12:0.05,despill=type=green:mix=0.4[k];[1:v][k]overlay=shortest=1[out]" \
-map "[out]" -map 0:a? -c:v libx264 -crf 18 -pix_fmt yuv420p out.mp4
ffmpeg -i subject.mp4 -i newbg.mp4 \
-filter_complex "[0:v]hsvkey=h=120:s=0.7:v=0.3:similarity=0.05:blend=0.02,despill=type=green[k];[1:v][k]overlay[out]" \
-map "[out]" -c:v libx264 -crf 18 out.mp4
ffmpeg -i subject.mp4 -vf "chromakey=0x20B040:0.12:0.05,despill=type=green,format=yuva444p10le" \
-c:v prores_ks -profile:v 4444 -pix_fmt yuva444p10le -c:a copy keyed.mov
ffmpeg -i subject.mp4 -vf "chromakey=0x20B040:0.12:0.05,despill=type=green,format=yuva420p" \
-c:v libvpx-vp9 -pix_fmt yuva420p -b:v 4M -auto-alt-ref 0 keyed.webm
ffmpeg -i subject.mp4 -vf "chromakey=0x20B040:0.12:0.05,despill=type=green,format=rgba" \
-c:v png frames/keyed_%05d.png
ffmpeg -hwaccel cuda -i subject.mp4 -i newbg.mp4 \
-filter_complex "[0:v]hwupload_cuda,chromakey_cuda=0x00FF00:0.1:0.05,hwdownload,format=yuva420p[k];[1:v][k]overlay[out]" \
-map "[out]" -c:v h264_nvenc -cq 20 out.mp4
ffmpeg -i subject.mp4 -i plate.mp4 \
-filter_complex "[0:v][1:v]backgroundkey=threshold=0.08:similarity=0.1:blend=0.05[k];[0:v][k]alphamerge,format=yuva420p[out]" \
-map "[out]" -c:v qtrle keyed.mov
ffmpeg -i subject.mp4 -vf "colorkey=0x00FF00:0.30:0.20,format=yuva420p" -c:v qtrle keyed.mov
Cause: container/codec does not support alpha (e.g. MP4+libx264). Solution: switch to MOV+qtrle, MOV+ProRes 4444, WebM+libvpx-vp9 (yuva420p), or PNG sequence.
Cause: reflected green spill; key cannot remove reflected light.
Solution: chain despill=type=green:mix=0.5:expand=0.1 after the key filter, BEFORE the overlay.
Cause: blend=0 or too-low blend.
Solution: raise blend to 0.02–0.08. If still bad, switch output to format=yuva444p (no chroma subsampling on alpha).
Cause: similarity too high.
Solution: lower similarity, then switch to hsvkey (better tonal separation), and/or downstream roto for hard edges.
chromakey_cuda fails with "No device available"Cause: NVIDIA drivers / CUDA not available, or missing hwupload bracket.
Solution: confirm ffmpeg -hwaccels lists cuda. Always bracket: hwupload_cuda,chromakey_cuda=...,hwdownload,format=yuva420p.
overlay output ends earlyCause: shortest=1 set, and the keyed clip is shorter than bg.
Solution: remove shortest=1, or swap input order.
What SKILL.md sets; muted values are Claude Code's defaults
Three short reads, in order
110 skills in this plugin
/audio-coreaudioManipulate macOS audio at the Core Audio HAL layer: afinfo (audio file metadata), afplay (play), afconvert (convert format/rate/bit-depth/channel layout), say (TTS), SwitchAudioSource (change default input/output/system device — brew install switchaudio-osx), audiodevice CLIs (npm/Go variants), AppleScript via osascript to drive System Preferences Sound. HAL plugins at /Library/Audio/Plug-Ins/HAL/ load virtual drivers (BlackHole 2ch/16ch/64ch, Loopback, Background Music). Aggregate Device (drift-corrected multi-in) and Multi-Output Device via Audio MIDI Setup.app or AudioHardwareCreateAggregateDevice. Use when the user asks to change default macOS audio device, route audio between apps on Mac, install BlackHole, build an Aggregate Device, convert audio files with afconvert, or script Mac audio from the terminal.
/audio-jackRoute professional low-latency audio with JACK Audio Connection Kit (jackaudio.org): jackd server (ALSA/CoreAudio/PortAudio/ASIO backends), jack_control (D-Bus JACK2 config), jack_lsp (list ports/connections), jack_connect/jack_disconnect (manage links), jack_cpu_load, jack_samplerate, jack_bufsize (runtime period size), jack_transport, jack_rec (multi-channel WAV recording), jack_iodelay (round-trip latency), jack_wait, jack_midi_dump. JACK1 C maintenance vs JACK2 C++ multicore. Modern Linux swaps jackd for PipeWire's libjack shim — same client API. JackTrip for uncompressed multichannel UDP over the Internet. Use when the user asks to run a JACK server, connect audio clients, measure roundtrip latency, record from JACK ports, set JACK period size, or bridge JACK over the network with JackTrip.
npx claudepluginhub damionrashford/media-os --plugin media-osOther plugins' skills for the same job