concatenate_videos: Combine video files using the concat demuxer

View source: R/ffmpeg.R

concatenate_videosR Documentation

Combine video files using the concat demuxer

Description

Combine multiple video files one after another without needing to re-encode them by using the concat demuxer. This will be much faster than re-encoding but requires that the files have the same parameters (width, height, etc.) and formats/codecs. To concatenate videos using re-encoding, see the concat video filter. The glossary in vignette("tidymedia") explains media terms such as codec and re-encode.

Usage

concatenate_videos(infiles, outfile, run = TRUE)

Arguments

infiles

A character vector containing the file paths to video files. 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 containing the desired file path to write the new, concatenated video file to.

run

A logical: run the command through FFmpeg (TRUE, default) or return the compiled command without running it (FALSE).

Value

The compiled FFmpeg command (invisibly when run = TRUE).

See Also

ffm_concat(), the pipeline function it wraps.

Other task functions: anonymize_video(), anonymize_video_batch(), compare_videos(), compare_videos_batch(), 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()

Examples

video <- system.file("extdata", "sample.mp4", package = "tidymedia")
concatenate_videos(c(video, video), "joined.mp4", run = FALSE)

tidymedia documentation built on Oct. 11, 2026, 5:08 p.m.