| crop_video | R Documentation |
Crop a video to a rectangular region. The glossary in
vignette("tidymedia") explains media terms such as codec, container
and stream copy.
crop_video(
infile,
outfile,
width,
height,
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
)
infile |
A string containing the path to a video file. |
outfile |
A string containing the path of the video file to write. |
width |
The width of the output video, in pixels. |
height |
The height of the output video, in pixels. |
x |
The horizontal offset, in pixels, of the left edge of the crop. (default = centered) |
y |
The vertical offset, in pixels, of the top edge of the crop. (default = centered) |
video_codec |
A string naming the output video codec, or |
audio_codec |
A string naming the output audio codec.
|
hardware |
The encoder backend. |
fallback |
A logical. When a |
quality |
A number, or |
audio_stream |
The audio track to carry into the output, as a number that counts from |
run |
A logical: run the command through FFmpeg ( |
The compiled FFmpeg command (invisibly when run = TRUE).
ffm_crop(), the pipeline function it wraps;
has_hardware_encoder() for the hardware toggle;
crop_video_batch() for the many-file 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_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(),
compare_videos_batch(),
convert_audio(),
convert_audio_batch(),
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")
crop_video(video, "cropped.mp4", width = 160, height = 120, run = FALSE)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.