Skip to contents

Requires that ffmpeg is available on your system path.

Usage

ov_video_frames(
  video_file,
  start_time,
  duration,
  end_time,
  outdir,
  fps,
  format = "jpg",
  jpg_quality = 1,
  extra = NULL,
  debug = FALSE,
  exec_fun
)

Arguments

video_file

string: path to the video file

start_time

numeric: start time in seconds

duration

numeric: duration in seconds. If missing, will be calculated from start_time and end_time

end_time

numeric: end time in seconds. If missing, will be calculated from start_time and duration

outdir

string: path to the output directory, which must exist. If missing, a temporary directory will be used

fps

numeric: frames per second, default is to extract all frames

format

string: "jpg" or "png"

jpg_quality

numeric: jpg quality from 1-31, lower is better (this is passed to ffmpeg as the -qscale:v parameter)

extra

: additional parameters passed to ffmpeg, in the form c("param", "value", "param2", "value2")

debug

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

exec_fun

string or function: the function (or function name as a string) to use to execute the ffmpeg command. Defaults to sys::exec_internal(), or sys::exec_wait() if debug is TRUE

Value

If exec_fun has not been specified, the function will wait for the ffmpeg call to complete and then return a character vector of file names, one per frame. If exec_fun has been specified, the result of that function call will be returned immediately (because it might be a call to a background process)

See also