| crop_video_batch | R Documentation |
Crop many videos to a rectangular region, using one jobs table. This is the
batch form of crop_video(), for when you have more than one file. Each
row is one input. The function is a thin wrapper over
ffm_batch. It builds one reproducible command for each input,
with the same crop steps as crop_video(). This function checks each
row's crop size and position before any command runs. So a bad cell is
refused with an error that names this function. The glossary in
vignette("tidymedia") explains media terms such as codec, container
and stream copy.
crop_video_batch(
jobs,
width = NULL,
height = NULL,
x = "(in_w-out_w)/2",
y = "(in_h-out_h)/2",
video_codec = NULL,
audio_codec = "copy",
hardware = c("none", "nvenc", "videotoolbox"),
fallback = FALSE,
quality = NULL,
audio_stream = NULL,
run = TRUE,
parallel = FALSE,
...
)
jobs |
A data frame with one row per input. It needs at least an
|
width, height |
The output crop size in pixels, for every row unless
|
x, y |
The offset in pixels of the crop's left and top edge, for every
row unless |
video_codec |
A string naming the output video codec, applied to every
row lacking a |
audio_codec |
A string naming the output audio codec, for every row
when |
hardware, fallback |
The encoder backend and its fallback behavior, applied to the whole batch. They are a property of the machine, not of a row, so neither is read as a |
quality |
A number, or |
audio_stream |
The audio track to carry into each output, as a number that counts from |
run |
A logical: run each command through FFmpeg ( |
parallel |
A logical: process the jobs in parallel with furrr
( |
... |
Additional arguments forwarded to |
The jobs tibble with an added command column. When run = TRUE, it also has a success column, plus verified or a provenance manifest, each when requested through .... See ffm_batch.
crop_video(), the single-input form it wraps; ffm_batch(),
the batch runner; has_hardware_encoder() for the hardware toggle;
standardize_video_batch() to re-encode in batch.
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(),
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(),
compare_videos_batch(),
convert_audio(),
convert_audio_batch(),
crop_video(),
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")
jobs <- tibble::tibble(input = c(video, video), output = c("a.mp4", "b.mp4"),
width = c(160, 80), height = c(120, 60))
crop_video_batch(jobs, run = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.