Skip to contents

Extract one or more specific frames from a video file

Usage

ov_video_frame(
  video_file,
  t,
  n,
  format = "jpg",
  debug = FALSE,
  framerate,
  method = "auto"
)

Arguments

video_file

string: path to the video file

t

numeric: the times of the frames to extract (in seconds)

n

integer: the frame numbers of the frames to extract. Ignored if t is provided. Frame numbering is 1-based (first frame at t = 0 is frame n = 1)

format

string: "jpg" or "png"

debug

logical: if TRUE, echo the ffmpeg output to the console

framerate

numeric: the framerate of the video. If not supplied, it will be found using [av::av_video_info]

method

string: the method to use, either "ffmpeg", "av", or "auto". "ffmpeg" is faster than "av" but requires that ffmpeg is available on your system path. If method is "auto", "ffmpeg" will be used if available and "av" if not

Value

The paths to the frame image files

Examples

video_file <- ov_example_video(1)
img <- ov_video_frame(video_file, t = 5)
img <- ov_video_frame(video_file, n = 150)