Chromakey (Green/Blue Screen) Compositing
Description
Remove a colored background from foreground footage and composite onto a background video or image using FFmpeg’s chromakey filter.
Usage
chromakey(background, foreground, output, color = "0x00ff00", similarity = 0.1,
blend = 0.075, overwrite = TRUE, dry_run = FALSE)
Arguments
background: Path to background video or image.foreground: Path to foreground video with green/blue screen.output: Path for output video file.color: Hex color to key out (default “0x00ff00” for green).similarity: Chromakey similarity threshold (default 0.1). Higher values key out more of the color.blend: Chromakey blend amount (default 0.075). Higher values create softer edges.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
chromakey("bg.mp4", "greenscreen.mp4", "out.mp4")
chromakey("bg.mp4", "bluescreen.mp4", "out.mp4", color = "0x0000ff")