Learn R Programming

imager (version 0.42.10)

load.video: Load a video using ffmpeg

Description

You need to have ffmpeg on your path for this to work. This function uses ffmpeg to split the video into individual frames, which are then loaded as images and recombined. Videos are memory-intensive, and load.video performs a safety check before loading a video that would be larger than maxSize in memory (default 1GB)

Usage

load.video(
  fname,
  maxSize = 1,
  skip.to = 0,
  frames = NULL,
  fps = NULL,
  extra.args = "",
  verbose = FALSE
)

Arguments

fname

file to load

maxSize

max. allowed size in memory, in GB (default max 1GB).

skip.to

skip to a certain point in time (in sec., or "hh:mm::ss" format)

frames

number of frames to load (default NULL, all)

fps

frames per second (default NULL, determined automatically)

extra.args

extra arguments to be passed to ffmpeg (default "", none)

verbose

if TRUE, show ffmpeg output (default FALSE)

Value

an image with the extracted frames along the "z" coordinates

See Also

save.video, make.video

Examples

Run this code
# NOT RUN {
fname <- system.file('extdata/tennis_sif.mpeg',package='imager')
##Not run
## load.video(fname) %>% play
## load.video(fname,fps=10) %>% play
## load.video(fname,skip=2) %>% play
# }

Run the code above in your browser using DataLab