I’m looking for a package to cut, trim and convert video files. Of course, I can do it using ffmpeg, but I just wanted to check if there are any existing solutions in R to do it, maybe a wrapper for ffmpeg that I didn’t find?
Have you tried magick
https://cran.rstudio.com/web/packages/magick/
It can read video as a set of frames. Then you can edit each frame. Checkout the vignette to get started https://cran.rstudio.com/web/packages/magick/vignettes/intro.html
I’ve actually just come up against this problem myself. My solution was to write an R script that would pass the arguments I wanted to and call ffmpeg via system()
with something like
system(paste(
"c:\\ffmpeg\\bin\\ffmpeg.exe -accurate_seek -ss ",
target.time,
" -i ",
target.video,
" -frames:v 1 -q:v 2 c:\\video\\",
target.name,
".bmp -y ", sep=""))
thanks @samclifford - yeah, for any advanced video editing better to use ffmpeg
There’s also https://github.com/swarm-lab/videoplayR, which provides bindings to the OpenCV C++ computer vision library.