Add a complex video filter that stacks several videos horizontally (side by side). It can also resize the videos to the same height.
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 height. 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.
See also
ffm_vstack() for vertical 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_jobs(),
ffm_loudnorm(),
ffm_map(),
ffm_output_options(),
ffm_overlay(),
ffm_pixel_format(),
ffm_run(),
ffm_scale(),
ffm_seek(),
ffm_trim(),
ffm_vstack(),
print.tidymedia_ffm()
Examples
video <- system.file("extdata", "sample.mp4", package = "tidymedia")
# Stack two inputs side-by-side (pass more than one input to ffm_files())
ffm_files(c(video, video), "output.mp4") |>
ffm_hstack() |>
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]hstack=inputs=2:shortest=0[vout]\" -map \"[vout]\" \"output.mp4\""