1

I need to do exactly the graph that has been made on this page (the second one) http://www.animatedgraphs.co.uk/line.html

Here is my actual code :

timemax<-151737 # number of frames (and observations - so no interpolation needed) setwd("C:/Users/victo/Downloads/ffmpeg/ffmpeg/bin/") vis<-100 # how many time points are on the screen at one time gdata<-data.frame('Temps'= data$time,'RH_Xacc'= data$RH_Xacc) gname<-paste("g",1:timemax,".tif", sep="") # holds the names of the picture files right<-(((1:timemax)<=vis)*100)+(((1:timemax)>vis)*1:timemax) # rightmost time on screen left<- right-vis+2 # leftmost time on screen leftlab<-200*ceiling((left-1)/200) # leftmost x label rightlab<-200*floor(right/200) # rightmost x label # draw graphs for (i in 1:timemax) { tiff(gname[i],width=480) plot(gdata$Temps[right[i]:left[i]],gdata$RH_Xacc[right[i]:left[i]],col="red",type="l",ylim=c(-100,200),xlim=c(right[i],left[i]),xaxt="n",ylab="",xlab="time") axis(1,at=seq(from=rightlab[i],to=leftlab[i],by=12)) lines(gdata$Temps[right[i]:i],gdata$RH_Xacc[right[i]:i]) dev.off(dev.cur()) } # call FFMPEG and make the video shell("C:/Users/victo/Downloads/ffmpeg/ffmpeg/bin/ffmpeg.exe -codecs -i g%d.tif -b:v 2048k gdata.mpg",mustWork=FALSE) 

My code seems to work until the shell function. I don't get an error. The code just never stops running. I am not able to get the video with all the data. Can someone tell me where is the problem ? How can I get the video or if there is an other to get the same result ? I've tried the library gganimate but i didn't succeed either... I am doing this in Rstudio and using sweave.

Thanks a lot

1 Answer 1

1

Actually, the first thing you should do is probably run the command : C:/Users/victo/Downloads/ffmpeg/ffmpeg/bin/ffmpeg.exe -codecs -i g%d.tif -b:v 2048k gdata.mpg directly and not with a calling shell from RStudio. You would have a more verbose output.

Original post

Do you have any CPU performance profiling tool ? I suspect that the shell command might take a lot of time to run on your computer since in your example : timemax<-151737 whereas the example has a shorter timemax timemax<-1000

Try your program with a low value of timemax (=1000) and time the execution of the code. I guess you could extrapolate the total time needed to execute multiplying by 150 (I am not an expert of ffmpeg, it might actually be longer)

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.