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.
Arguments
- object
An FFmpeg pipeline (
ffm) object created byffm_files().- fps
The target frame rate. Give a positive double (an R number such as
30) of frames per second, or a string, such as an FFmpeg frame rate expression. For example,"30000/1001"is the NTSC rate. An integer such as30Lis refused, and so isNA. Any other string is not checked, and it goes into the FFmpeg command as written.
See also
standardize_video(), the task function that uses ffm_fps()
to set the frame rate.
Other pipeline functions:
ffm_batch(),
ffm_codec(),
ffm_compile(),
ffm_concat(),
ffm_copy(),
ffm_crop(),
ffm_drawbox(),
ffm_drop(),
ffm_files(),
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_fps(fps = 30) |>
ffm_compile()
#> [1] "-y -i \"/home/runner/work/_temp/Library/tidymedia/extdata/sample.mp4\" -vf \"fps=30\" \"output.mp4\""