Making Movies in Cellzilla Cellzilla2D Home

Movies are generally made in the following ways in Cellzilla:

  • For static simulations, via either SimAnimate or a map of ShowTissue to the output of run or StaticSimulation, and then running the list of images produced through Mathematica's built-in ListAnimate function. These images can be saved to disk and converted to a movie (e.g., .mov, .avi, etc.) using SaveFrames.
  • For dynamic growing simulations, by applyting SimAnimate to the output of grow. These movies are automatically saved to disk in a standard form (e.g., .mov, .avi, etc.).

In either case, the conversion to an external movie file such as .mov format is accomplished by generating a sequence of files (e.g., .png, .jpg, .tiff), one for each frame, and then using a separate, external, command-line program to convert the sequence of files to a movie. This program is ffmpeg, which is free software available on all operating systems (including all versions of linux, Windows, and Mac OS). You must install this software separately. (Ubuntu users should ensure that ffmpeg is still installed, as the default wrapper has been replaced by the virtually identical program avconv. Cellzilla will not look for avconv.)

Mathematica will automatically run ffmpeg for you, however, the default configuration built into Cellzilla may not work on your installation; it depends on the installation of the proper codecs on your system and the options you choose. See the ffmpeg documentation for further details. If you want to crop or convert the resulting movie, after you create it, to another format, you can do this with ffmpeg.

Impementation note: This uses the Mathematica Run function to spawn a subprocess. Some versions/subversions of Mathematica are not able to locate the ffmpeg executable. This will depend on where your operating system installed it and how it modified the system path variable. You may have to run ffpmeg manually, as described in the following program. (Alternatively, any application that will convert a collection of image files to a movie can also be used. )

If the frames were generated, e.g., in PNG format, but the movie was not produced for some reason, use the command shell (cmd in windows; in mac and linux) and cd to the folder condtaining the PNG files; the try the following:

ffmpeq -r 8 -i "FRAME%4d.PNG"

Depending on what codecs were installed along with ffmpeg, you can replace mov with avi, mpg, swf, etc. for different movie formats.

The number after the r is the number of frames per second.

For Cropping:

avconv -i oldfile -vf crop:width:height:x:y newfile

will crop oldfile to newfile with the specified width and height. x and y are the coordinates of the new top left hand corner measured with respect to the old top left hand corner. For example,

avconf -i -vf crop:768:768:318:100

creates a movie that is 768x768 pixels 6by cropping with the top left had corner at a point that is at coordinates (300,100), i.e., 300 over and 100 down from the original top left corner.


[11.June.2017 ]