ffm_codec: Set Codecs in an FFmpeg Pipeline

View source: R/ffm.R

ffm_codecR Documentation

Set Codecs in an FFmpeg Pipeline

Description

Set the audio codec, the video codec, or both, for the output file. Use ffmpeg_codecs() to see a list of the codecs in your FFmpeg version. The glossary in vignette("tidymedia") explains media terms such as codec and stream copy.

Usage

ffm_codec(object, audio = NULL, video = NULL)

Arguments

object

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

audio

A string that names the audio codec, or NULL to set only the video codec. The default is NULL. 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 string that names the video codec, or NULL to set only the audio codec. The default is NULL.

Value

object with an added instruction to change the codecs.

References

https://ffmpeg.org/ffmpeg-codecs.html

See Also

ffm_copy(), the shortcut for stream copy, ffmpeg_codecs() to list the codecs you can use, and standardize_video(), a task function built on it.

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

Examples

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

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