
52

GitHub - jeroen/av: Working with Video in R
source link: https://github.com/jeroen/av
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

README.md
av
R Bindings to FFmpeg
Installation
You can install the development version from GitHub with:
# Install from GH devtools::install_github("jeroen/av") # For the demo devtools::install_github("thomasp85/gganimate")
Hello World
Example using gganimate:
# Get latest gganimate # devtools::install_github("thomasp85/gganimate") library(gganimate) # Define the "renderer" for gganimate av_renderer <- function(filter = "null", filename = 'output.mp4'){ function(frames, fps){ unlink(filename) av::av_encode_video(frames, filename, framerate = fps, filter = filter) } } # Create the gganimate plot p <- ggplot(airquality, aes(Day, Temp)) + geom_line(size = 2, colour = 'steelblue') + transition_states(Month, 4, 1) + shadow_mark(size = 1, colour = 'grey') # Render and show the video q <- 2 df <- animate(p, renderer = av_renderer(), width = 720*q, height = 480*q, res = 72*q, fps = 25) utils::browseURL('output.mp4')
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK