yihui / animation

A gallery of animations in statistics and utilities to create animations
https://yihui.org/animation/
205 stars 59 forks source link

Resolution in saveVideo #125

Closed jianhaizhang closed 4 years ago

jianhaizhang commented 4 years ago

How to change the resolution in the video?

When I change the "ani.res" value, it seems the resolution is the same in saved videos. How to correctly use the "ani.res" argument?

library(animation)
saveVideo(
    for (i in 1:3) { barplot(i*1:5)
    ani.options(interval=1, ani.res=1000)
    }, 
   video.name = "test.mp4", other.opts=paste0('-pix_fmt yuv420p -b 300k -s:v ', '640x480'), img.name='test', verbose=FALSE)
yulijia commented 4 years ago

Hi, I checked the source code, we didn't implement the ani.res in saveVideo function. If you want to change the resolution of the video, please consider providing the FFmpeg options as additional options in the argument other.opts.

jianhaizhang commented 4 years ago

Are "ani.width, ani.height" not implemented in your package as well?

yulijia commented 4 years ago

I guess ani.width, ani.height are used to adjust the width and height of the image, but these arguments may not affect the FFmpeg options for creating the video.