Skip to contents

Resample the video to a constant frame rate with FFmpeg's fps filter. The filter duplicates or drops frames as needed. It is added to the end of the video filters, like the other filters that take one input. The glossary in vignette("tidymedia") explains media terms such as frame rate.

Usage

ffm_fps(object, fps)

Arguments

object

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

fps

The target frame rate. Give a positive real number of frames per second, or a string that contains an FFmpeg frame rate expression. For example, "30000/1001" is the NTSC rate.

Value

object with an added instruction to resample the frame rate.

Examples

video <- system.file("extdata", "sample.mp4", package = "tidymedia")
ffm_files(video, "output.mp4") |>
  ffm_fps(fps = 30) |>
  ffm_compile()
#> [1] "-y -i \"/home/runner/work/_temp/Library/tidymedia/extdata/sample.mp4\" -vf \"fps=30\" \"output.mp4\""