gnuplot-movie

Home 4D Gnuplot Gnuplot-Latex Gnuplot movie Gnuplot symbols


Gnuplot has the capability to convert a set of images into a .avi movie file. For that , all you need is a set of images.
If you have a set of data files with orderly named, you can run a for loop over the data files to produce a set of high quality images. Here is an exapmle -

Suppose, you want to evolve a sin curve with different phases, you do

set term png size 1600,1200
do for [t=0:9]{
set output "image.0".t.".png"
p [0:6.28] sin(x+t*3.14/50.0) w l ti 't='.t.' second (say)'
}

This will create a set of .png files of form image.nn.png .
Now from the terminal, type

ffmpeg -f image2 -r 10.0 -i sin.%02d.png -pix_fmt yuv420p -qscale 1 out.mp4

where, the number after -r represents the frame rate per seconds, "sin.%02d.png" is the image filename and out.mp4 is the ouput video file. The syntax image.%02d.png specifies to use a decimal number composed of three digits padded with zeroes to express the sequence number. It is the same syntax supported by the C printf function, but only formats accepting a normal integer are suitable. The options "-qscale" sets the quality of the video, this can take any value from 1(best) to 31(worst). (For more information on using ffmpeg, go to http://www.ffmpeg.org/ffmpeg.html). A more complicated but useful file with selecting filenames in a broad range can be found here .