Save one frame of a video to an image file, selected either by timestamp or
by frame number. Provide exactly one of timestamp or frame.
Arguments
- infile
A string containing the path to a video file.
- outfile
A string containing the path of the image file to write.
- timestamp
Either a number of seconds, a time-duration-syntax string, or
NULL. Provide exactly one oftimestamporframe.- frame
Either an integerish frame number or
NULL. Provide exactly one oftimestamporframe.- run
A logical: run the command through FFmpeg (
TRUE, default) or return the compiled command without running it (FALSE).
See also
ffm_seek(), the pipeline function it uses to get the frame.
extract_frame_batch() for the many-file (batch) form.
Other task functions:
anonymize_video(),
anonymize_video_batch(),
compare_videos(),
compare_videos_batch(),
concatenate_videos(),
concatenate_videos_batch(),
convert_audio(),
convert_audio_batch(),
crop_video(),
crop_video_batch(),
extract_audio(),
extract_audio_batch(),
extract_frame_batch(),
format_for_web(),
format_for_web_batch(),
normalize_audio(),
normalize_audio_batch(),
picture_in_picture(),
picture_in_picture_batch(),
sample_frames(),
sample_frames_batch(),
segment_video(),
segment_video_batch(),
separate_audio_video(),
separate_audio_video_batch(),
standardize_video(),
standardize_video_batch(),
strip_metadata(),
strip_metadata_batch()
Examples
video <- system.file("extdata", "sample.mp4", package = "tidymedia")
# run = FALSE returns the reproducible command instead of executing it
extract_frame(video, "frame.png", timestamp = 0.5, run = FALSE)
#> [1] "-y -ss 0.5 -i \"/home/runner/work/_temp/Library/tidymedia/extdata/sample.mp4\" -avoid_negative_ts make_zero -qmin 1 -q:v 1 -qscale:v 2 -frames:v 1 -huffman optimal \"frame.png\""