PiP Chroma Key
video-mark-chromakey
Keys out a solid-color background from a picture-in-picture video overlay, enabling green screen and blue screen compositing.
video-mark-chromakey accepts a hex color value representing the background color to remove from the overlay layer, in the RGB, ARGB, RRGGBB or AARRGGBB form, or as a CSS color name. The value can be provided with or without a # or 0x prefix (e.g. 00FF00, #00FF00, or 0x00FF00). The specified color and nearby hues within the threshold range are made transparent, allowing the base video to show through. An invalid value disables keying with no effect.
Only the RGB channels are used — alpha is ignored in the 4- and 8-digit forms, since the key color is matched against the overlay’s pixels rather than composited. 67DA06, FF67DA06 and 0067DA06 all key the same green.
Chroma key applies to video outputs only (fm=mp4, fm=hls, fm=dash). It is ignored for GIF, spritesheet, preview, thumbnail, and VTT outputs.
https://assets.imgix.net/Croatia.mp4?fm=mp4&video-mark=https%3A%2F%2Fassets.imgix.net%2Fdocs%2Fsubscribe-pixabay-pixvids-video.mp4&video-mark-w=640&video-mark-align=center,middle&video-mark-chromakey=67DA06&video-mark-chromakey-feather=0&video-mark-chromakey-despill=0.01The example above removes the green background (67DA06) from the overlay video, compositing the subject over the base video.
Tuning the Effect
Use video-mark-chromakey together with the following parameters to refine the key:
video-mark-chromakey-threshold— controls how broadly similar colors are included in the key (default:0.15)video-mark-chromakey-feather— softens the edge of the keyed region (default:0.05)video-mark-chromakey-despill— removes color contamination reflected onto the subject from the background (default:0.5)
Indexed Layers
Use video-mark-chromakey[N] to apply chroma keying to a specific indexed overlay layer, matching the index of the corresponding video-mark[N] parameter.