zoom: Zoom Video with Stepped Levels

View source: R/zoom.R

zoomR Documentation

Zoom Video with Stepped Levels

Description

Apply a stepped zoom effect to a video, changing zoom level at STT line boundaries. Uses 3 levels (no zoom, single, double) with smooth transitions between them. The pattern randomly alternates between zoom-in, hold, and zoom-out phases.

Usage

zoom(input, output, stt, amount = 0.05, levels = 3, transition = 0.3,
     seed = NULL, width = NULL, height = NULL, overwrite = TRUE, dry_run = FALSE)

Arguments

input

Path to input video.

output

Path for output video file.

stt

A whisper_transcription object or data frame with from and to timestamp columns (HH:MM:SS.mmm format).

amount

Zoom per level (default 0.05). Level 1 = 1+amount, level 2 = 1+2*amount.

levels

Number of zoom levels (default 3: none, single, double).

transition

Transition duration in seconds between zoom levels (default 0.3).

seed

Random seed for reproducible zoom patterns.

width

Output width in pixels. If NULL, detected from input.

height

Output height in pixels. If NULL, detected from input.

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: 
stt <- readRDS("srt_text.RDS")
zoom("talking_head.mp4", "zoomed.mp4", stt = stt)
zoom("head.mp4", "zoomed.mp4", stt = stt, amount = 0.05, seed = 42)

## End(Not run)


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