Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
508 views
in Technique[技术] by (71.8m points)

r - Poor video quality in first few frames using video output options in gganimate

I'm trying to export some animations I've made using gganimate through video format as the gifs I'm creating are quite large.

Sample code:

library(gganimate)

p <- ggplot(mtcars, aes(factor(cyl), mpg)) +
  theme_dark() +
  theme(panel.grid = element_line(colour = "white")) +
  geom_boxplot() +
  transition_states(
    gear,
    transition_length = 2,
    state_length = 1
  ) +
  enter_fade() +
  exit_shrink() +
  ease_aes('sine-in-out')

anim_save("example.mp4",
          animate(
            p,
            nframes = 450,
            fps = 25,
            width = 1280,
            height = 720,
            type = "cairo",
            start_pause = 50,
            end_pause = 50,
            renderer = av_renderer()
          ))

Produces the video seen here: https://vimeo.com/505019987

With the standard ggplot2 theme: https://vimeo.com/505020822

This is another example of something I made using gganimate: https://www.youtube.com/watch?v=fHzjl_z_sSo

You can see that the video quality in the first few frames are very bad. In the video with the standard ggplot2 theme and the YouTube video, the gridlines and watermark text are not visible at the start but fade in much later. I don't know much about video codecs but I assume it has something to do with the ffmpeg library the av package/av_renderer() is using. Has anyone experienced something like this?

question from:https://stackoverflow.com/questions/65911358/poor-video-quality-in-first-few-frames-using-video-output-options-in-gganimate

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
Waitting for answers

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...