S7 Class for Single Video Frame Extraction
Usage
VideoFrameExtractor(
video_path,
output_dir = file.path(dirname(normalizePath(video_path)), "frames"),
fps = 1,
format = "jpg",
camera_tz_offset = -5
)Value
An object of class VideoFrameExtractor. This object stores information
about a single video file, its output directory, frame rate, and calculated
start time based on metadata. It is used to perform frame extraction and
metadata stamping.
Details
This function scan a video for its metadata specifically date and time of creation and then extract a number of frames per second, saving the frames as pictures in format JPG or PNG on a specified path. The extracted frames are saved with date and time on Metadata. The function would be useful in situations when you program camera traps to shoot videos, but you need pictures to upload to Wildlife Insights.
Slots
video_pathcharacter. Full path to source video.
output_dircharacter. Directory for extracted frames.
fpsnumeric. Frames per second (default 1).
formatcharacter. "jpg" or "png".
camera_tz_offsetnumeric. Camera UTC offset in hours (e.g. -5).
start_timePOSIXct. Recording start (UTC).
frame_pathscharacter. Paths of saved frames (after extract).
Examples
video_file <- system.file("extdata", "sample.mp4", package = "photoextractor")
if (video_file != "") {
extractor <- VideoFrameExtractor(
video_path = video_file,
output_dir = tempdir(),
fps = 1,
camera_tz_offset = -5
)
print(extractor)
}
#> <photoextractor::VideoFrameExtractor>
#> @ video_path : chr "C:\\Users\\usuario\\AppData\\Local\\Temp\\Rtmpi6YQIA\\temp_libpath7eecd5b3817\\photoextractor\\extdata\\sample.mp4"
#> @ output_dir : chr "C:\\Users\\usuario\\AppData\\Local\\Temp\\RtmpMpib5k"
#> @ fps : num 1
#> @ format : chr "jpg"
#> @ camera_tz_offset: num -5
#> @ start_time : POSIXct[1:1], format: "2026-04-17 16:23:02"
#> @ frame_paths : chr(0)