colorkey: Colour-Key to a ProRes 4444 File with Alpha

View source: R/overlay.R

colorkeyR Documentation

Colour-Key to a ProRes 4444 File with Alpha

Description

Key out a flat background colour and write ProRes 4444 (yuva444p10le) so the alpha channel survives. Where chromakey composites the keyed foreground straight onto a background, this writes a standalone alpha clip you overlay later. By default the key colour is auto-sampled from a corner pixel (generated backgrounds are sometimes black, sometimes grey); pass color to override.

Usage

colorkey(input, output, color = "auto", similarity = 0.15, blend = 0.05,
         sample_xy = c(0, 0), overwrite = TRUE, dry_run = FALSE)

Arguments

input

Path to input video.

output

Path for output .mov file.

color

Hex colour (e.g. "0x000000"), a name ("green"), or "auto" to sample it from a corner pixel (default).

similarity

Key similarity threshold (default 0.15).

blend

Key edge blend (default 0.05).

sample_xy

Pixel c(x, y) to sample when color = "auto" (default c(0, 0)).

overwrite

If TRUE (default), overwrite output file.

dry_run

If TRUE, return the FFmpeg command without executing.

Value

Invisibly returns the output path. If dry_run, returns command string.

Examples

## Not run: 
colorkey("ltx.mp4", "ltx_alpha.mov")
colorkey("scene.mp4", "scene_alpha.mov", color = "0x000000")

## End(Not run)


compost documentation built on Aug. 4, 2026, 5:11 p.m.