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.
Arguments
- object
An FFmpeg pipeline (
ffm) object created byffm_files().- audio
A logical.
TRUE(the default) copies the audio codec. Seeaudio_streamfor the two things that the nameaudiomeans in the pipeline functions, and for the input indexaudio_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 twoffm_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, passstreams = FALSE. Or callffm_copy()first, and then narrow the mapping withffm_map(replace = TRUE).
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()
#> [1] "-y -i \"/home/runner/work/_temp/Library/tidymedia/extdata/sample.mp4\" -codec:v copy -codec:a copy -map \"0\" \"output.mp4\""