pip: Picture-in-Picture Corner Overlay

View source: R/overlay.R

pipR Documentation

Picture-in-Picture Corner Overlay

Description

Composite a foreground clip (a character, a webcam, a logo) into a corner of the background, scaled and inset by a pixel margin. A convenience wrapper over the overlay filter: it computes corner placement with main_w/ overlay_w expressions, which the fixed numeric offsets of overlay cannot express. Coordinates are top-left, +Y down.

Usage

pip(background, foreground, output, scale = 0.604, margin = 230,
    corner = c("upper-right", "upper-left", "lower-right", "lower-left"),
    overwrite = TRUE, dry_run = FALSE)

Arguments

background

Path to background video or image.

foreground

Path to foreground video or image (the PiP).

output

Path for output file.

scale

Foreground scale factor (default 0.604).

margin

Pixel margin from the corner (default 230).

corner

One of "upper-right", "upper-left", "lower-right", "lower-left".

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: 
pip("scene.mp4", "casey.mov", "out.mp4", corner = "upper-right")

## End(Not run)


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