vstack: Vertically Stack Two Videos

View source: R/stack.R

vstackR Documentation

Vertically Stack Two Videos

Description

Stack two videos vertically (top over bottom) using FFmpeg's vstack filter. Useful for YouTube Shorts layout (e.g. SadTalker top + slideshow bottom).

Usage

vstack(top, bottom, output, height_top = NULL, height_bottom = NULL,
       width = 1080, overwrite = TRUE, dry_run = FALSE)

Arguments

top

Path to top video.

bottom

Path to bottom video.

output

Path for output video file.

height_top

Height in pixels for top video (default: auto from width).

height_bottom

Height in pixels for bottom video (default: auto from width).

width

Output width in pixels (default 1080).

overwrite

If TRUE (default), overwrite output file.

dry_run

If TRUE, return the FFmpeg command without executing.

Details

Both inputs are scaled to the target width. Heights can be specified individually; by default each gets half the frame.

Value

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

Examples

## Not run: 
vstack("talking_head.mp4", "slideshow.mp4", "shorts.mp4")
vstack("top.mp4", "bottom.mp4", "out.mp4", height_top = 960, height_bottom = 960)

## End(Not run)


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