| compare_videos | R Documentation |
Stack two or more videos into a single comparison video. The videos go
side-by-side (direction = "horizontal") or one above the other
(direction = "vertical"). This is a common need when reviewing
annotations or before/after processing. Built on the stacking pipeline
functions (ffm_hstack / ffm_vstack). The glossary
in vignette("tidymedia") explains media terms such as codec, encoder
and stream copy.
compare_videos(
infiles,
outfile,
direction = c("horizontal", "vertical"),
resize = TRUE,
audio_input = NULL,
video_codec = NULL,
audio_codec = "copy",
hardware = c("none", "nvenc", "videotoolbox"),
fallback = FALSE,
quality = NULL,
run = TRUE
)
infiles |
A character vector of two or more video file paths. This function checks every path itself. A path that cannot be found or read aborts naming this function, and the error lists every such path. It is not reported against the internal builder that the path would otherwise reach. |
outfile |
A string giving the path to write the comparison video to. |
direction |
Either |
resize |
A logical indicating whether to resize the inputs to share an
edge. Only supported for exactly two inputs. (default = |
audio_input |
The input file whose audio to keep, as a number that counts from |
video_codec |
A string naming the output video codec, or |
audio_codec |
A string naming the codec for the carried audio track.
|
hardware |
The encoder backend. |
fallback |
A logical. When a |
quality |
A number, or |
run |
A logical: run the command through FFmpeg ( |
By default the two inputs are resized to share an edge (equal heights for a
horizontal stack, equal widths for a vertical one). Resizing currently
supports exactly two inputs, so pass resize = FALSE to compare more.
Audio is dropped unless audio_input names an input to carry; a carried
track is stream-copied unless audio_codec names an encoder.
The compiled FFmpeg command (invisibly when run = TRUE).
ffm_hstack() and ffm_vstack(), the pipeline functions it wraps;
has_hardware_encoder() for the hardware argument;
picture_in_picture() for insetting instead of stacking.
Other task functions:
anonymize_video(),
anonymize_video_batch(),
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(),
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()
Other audio selection functions:
anonymize_video(),
anonymize_video_batch(),
audio_stream,
compare_videos_batch(),
convert_audio(),
convert_audio_batch(),
crop_video(),
crop_video_batch(),
extract_audio(),
extract_audio_batch(),
format_for_web(),
format_for_web_batch(),
normalize_audio(),
normalize_audio_batch(),
picture_in_picture(),
picture_in_picture_batch(),
segment_video(),
segment_video_batch(),
separate_audio_video(),
separate_audio_video_batch(),
standardize_video(),
standardize_video_batch()
video <- system.file("extdata", "sample.mp4", package = "tidymedia")
compare_videos(c(video, video), "compare.mp4", run = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.