still_clip

Render a Still Image as a Video Clip

Description

Turns one image into a video of duration seconds, optionally animated by a deterministic Ken Burns pan/zoom described by motion. Both the static and the animated case go through ffmpeg’s zoompan, so the outputs are byte-compatible for concat and crossfade_concat regardless of motion.

Usage

still_clip(image, output, duration, fps = 30, size = NULL, motion = NULL,
           overwrite = TRUE, dry_run = FALSE)

Arguments

  • image: Path to the input image (png, jpg, …).
  • output: Path for the output video file.
  • duration: Clip length in seconds.
  • fps: Output frame rate (default 30).
  • size: Output dimensions as c(width, height), or NULL (default) to use the source dimensions rounded to even.
  • motion: NULL (default) for a static clip, or a Ken Burns spec: a list with any of zoom_from, zoom_to (numeric >= 1; values below 1 are clamped), from, to (crop-window anchor as c(x, y) fractions of the source, top-left origin; the window is centered on the anchor and clamped to the frame), and ease ("linear" or "smooth", default smooth).
  • overwrite: If TRUE (default), overwrite the output file.
  • dry_run: If TRUE, return the FFmpeg command without executing.

Details

zoompan stretches its crop to size without preserving the source aspect ratio, so size should match the source’s aspect (or a deliberate crop of it). Renderers letterbox afterwards; see pad.

Value

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

Examples

still_clip("slide01.png", "slide01.mp4", duration = 4.2)
still_clip("slide01.png", "slide01.mp4", duration = 4.2,
           motion = list(zoom_from = 1, zoom_to = 1.15,
                         from = c(0.5, 0.5), to = c(0.5, 0.4)))