ffm_copy: Copy the codecs and map all streams

View source: R/ffm.R

ffm_copyR Documentation

Copy the codecs and map all streams

Description

Copy the audio, the video, or both, with stream copy and no re-encoding. It can also map all streams from the input. This is the fast, lossless path when you only need to put the streams in a new container or cut on keyframes. The glossary in vignette("tidymedia") explains media terms such as codec, container, keyframe and stream copy.

Usage

ffm_copy(object, audio = TRUE, video = TRUE, streams = TRUE)

Arguments

object

An FFmpeg pipeline (ffm) object created by ffm_files().

audio

A logical. TRUE (the default) copies the audio codec. See audio_stream for the two things that the name audio means in the pipeline functions, and for the input index audio_input.

video

A logical. TRUE (the default) copies the video codec.

streams

A logical. TRUE (the default) maps all streams from the input. It sets the mapping to the all-streams specifier "0", and does not add to it. So two ffm_copy() calls compile one -map "0", not two. If the pipeline already has a different mapping, ffm_copy() gives an error and does not discard that mapping silently. To keep the mapping you set, pass streams = FALSE. Or call ffm_copy() first, and then narrow the mapping with ffm_map(replace = TRUE).

Value

object with an added instruction to copy codecs, map all streams, or both.

See Also

ffm_codec() and ffm_map(), which ffm_copy() calls, and segment_video(), which uses it for fast copy cuts.

Other pipeline functions: ffm_batch(), ffm_codec(), ffm_compile(), ffm_concat(), 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(), ffm_vstack(), print.tidymedia_ffm()

Examples

video <- system.file("extdata", "sample.mp4", package = "tidymedia")
ffm_files(video, "output.mp4") |>
  ffm_copy() |>
  ffm_compile()

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