Skip to content

Creating animations of Fluidity output via Paraview

James Percival edited this page Jun 18, 2014 · 1 revision

This page describes a method for creating a movie file containing an animated series of plots from a timeseries of Fluidity output files. The same method will also work for other ordered sets of still images.

Producing stills of Fluidity output in Paraview

The first step to making a movie is creating still image files of the frames that you wish to include in the movie. The easiest way to do this is to first set up the scene in Paraview (load your data, orientate the display as you require, display fields to your requirements) then go to File->Save Animation, set up parameters as required, and click on 'Save Animation'. You can now create a directory for the animation files to be put into, type in a base filename, and select a format to save the files as. Paraview does allow native movie generation, but for this example select JPG files to save a series of still frames which will be processed by the next step.

Animating a series of still images

The Linux application mencoder can produce compressed .avi files from a series of still images. For example, say you have created a set of jpg files

Frame0001.jpg
Frame0002.jpg
Frame0003.jpg
…
...
Frame0015.jpg
Frame0016.jpg
Frame0017.jpg
...
...
Frame105.jpg

etc.

then the following command mencoder mf://*.jpg -mf w=800:h=600:fps=25:type=jpg -ovc lavc -lavcopts vcodec=mpeg4 -oac copy -o output.avi will produce the compressed movie file output.avi. This will play using the executable mplayer on Linux, or on Windows Media Player for Windows (Quicktime plays AVIs on both Mac and Windows, and mplayer is also available for MacOSX/Darwin if an X11-based player is needed). If you don't have the right codec for Windows Mediaplayer, usually vcodec=msmpeg4v2 will work.

For a more generally accessible file use

export opt= "vbitrate=4705000:mbd=2:keyint=132:vqblur=1.0:cmp=2:subcmp=2:dia=2 mencoder -ovc lavc -lavcopts vcodec=msmpeg4v2:vpass=1:$opt
-mf type=png:fps=10 -nosound -o /dev/null mf://*.png mencoder -ovc lavc -lavcopts vcodec=msmpeg4v2:vpass=2:$opt
-mf type=png:fps=10 -nosound -o output.avi mf://*.png

or use the script /bin/encode in the style

encode jpg <path/to/images> <name of output>

If your output is in another form (eg .ps files) then you can convert to .jpg using convert (type man convert for details). If you want to convert an animated gif to avi it is best to convert it to a series of still images using convert and then use mencoder to build the avi file.

Be careful to put enough zeros in your filenames, otherwise it will process in the order

Frame1.jpg -- Frame10.jpg -- Frame11.jpg -- Frame12.jpg -- Frame13.jpg --  Frame14.jpg 

-- Frame15.jpg -- Frame16.jpg -- Frame17.jpg -- Frame18.jpg --Frame19.jpg -- Frame2.jpg -- Frame20.jpg -- Frame21.jpg -- etc...

which will give very strange results!

Clone this wiki locally