vid.to.images: Extracts images from a video file

Description Usage Arguments Value See Also Examples

View source: R/ffmpeg.R

Description

Uses ffmpeg through the av package to extract images from a video.

Usage

1
2
3
4
5
6
7
8
vid.to.images(
  vid.path = NULL,
  out.dir = NULL,
  format = "jpg",
  vfilter = NULL,
  overwrite = FALSE,
  ...
)

Arguments

vid.path

character; path of video file to be processed.

out.dir

character; directory path in which to store images.

format

character; image format such as "png" or "jpg"; must be available from av_encoders.

vfilter

character; a string defining an ffmpeg filter, the -vf argument in the ffmpeg command line utility. Passed to av_encode_video

overwrite

logical; should images in path described by 'out.dir' be overwritten if they exists.

...

other arguments to be passed to av_encode_video.

Value

Extracts all the images of the video and saves them to an "images" directory with appended number sequence.

See Also

images.to.video, av_encode_video av_video_images.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
#access video that loads with package
v <-system.file("extdata/vid", "sunfish_BCF.avi", package = "trackter")

#create directory in which to store images
dir.create(paste0(tempdir(),"/images"))

vid.to.images(vid.path=v,out.dir= paste0(tempdir(),"/images"))

#see the images in the "images" subdirectory
list.files( paste0(tempdir(),"/images"))

#clean up
unlink(paste0(tempdir(),"/images"),recursive=TRUE)

ckenaley/trackter documentation built on Feb. 11, 2022, 6:43 a.m.