Add a complex video filter that stacks several videos vertically (one above the other). It can also resize the videos to the same width.
Arguments
- object
An FFmpeg pipeline (
ffm) object created byffm_files().- shortest
A logical that says whether to trim the duration of all videos to that of the shortest video. The default is
FALSE.- resize
A logical that says whether to resize the input videos to the same width. Resizing takes longer, and for now it works only with two inputs. It fits both inputs to the same aspect ratio, so it assumes the inputs share one.
Details
This is the vertical form of ffm_hstack. Both are pipeline
functions for several inputs. They force the -filter_complex path and
manage their own stream labels internally. The glossary in
vignette("tidymedia") explains media terms such as stream.
See also
ffm_hstack() for horizontal stacking, and compare_videos(), the
task function built on both.
Other pipeline functions:
ffm_batch(),
ffm_codec(),
ffm_compile(),
ffm_concat(),
ffm_copy(),
ffm_crop(),
ffm_drawbox(),
ffm_drop(),
ffm_files(),
ffm_fps(),
ffm_hstack(),
ffm_jobs(),
ffm_loudnorm(),
ffm_map(),
ffm_output_options(),
ffm_overlay(),
ffm_pixel_format(),
ffm_run(),
ffm_scale(),
ffm_seek(),
ffm_trim(),
print.tidymedia_ffm()
Examples
video <- system.file("extdata", "sample.mp4", package = "tidymedia")
# Stack two inputs one above the other (pass more than one input to ffm_files())
ffm_files(c(video, video), "output.mp4") |>
ffm_vstack() |>
ffm_compile()
#> [1] "-y -i \"/home/runner/work/_temp/Library/tidymedia/extdata/sample.mp4\" -i \"/home/runner/work/_temp/Library/tidymedia/extdata/sample.mp4\" -filter_complex \"[0:v][1:v]vstack=inputs=2:shortest=0[vout]\" -map \"[vout]\" \"output.mp4\""