R: segments can not be displayed in a video file -
i attempted create video file in r using "animation" package. each frame formed two-dimensional matrix (graphics::images) , text , segment added frame. prior creating video, text , segment have been tested, following following post; when putting in video file, text , segment can no longer seen.
add text , line `image()` in graphics
savevideo({ par(mar = c(5, 0.2, 1, 2), mgp = c(3, 1, 0), tcl = -0.3, cex.axis = 1, cex.lab = 0.8, cex.main = 1) ani.options(interval = 0.6, nmax = 50, ani.height=0.2, ani.width=0.3) (frameno in c(1:5)){ x <- y[,,frameno] graphics::image(ifelse(drop(x)!=0, x, na), col=rgb(0,1,1,alpha), add=true) segments(0.1, 0.2, 0.3, 0.2, col="white", lwd=3) text(0.05, 0.18, "testing", col="white") } }, video.name = filen, other.opts = "-b 300k")
thank time.
i found solution - not straightforward one, works...
- create individual frames png files
- use ffmpeg generate video file using these individual png files.
Comments
Post a Comment