How to create movies from 2D data
1. How to create individual frames from 2D data
Using a perl script and gnuplot, generate the individual frames with the command:
./count.pl | gnuplot
(the gnuplot version recommended is 4.2; it seems that the previous versions do not support png format).
This is the perl script "count.pl" we used:
#! /usr/bin/perl -w
use strict;
my $itlast = 364;
javascript:void(0)
print "set pm3d map\n";
print "set size ratio -1\n";
print "set cbrange [0:1]\n";
print "set terminal png\n";
print "set title 'Shrimp Biomass'\n";
for (my $iter = 1; $iter <= $itlast; ++ $iter) {
printf "set output 'bmnew.%04d.png'\n", $iter;
printf "splot 'bmnew_2D.asc' index $iter\n";
}
The above script is for generating a frame for each day for the total cohort of 4.000.000 shrimps.
2. How to combine individual frames into a movie
- first, convert the png into tiff; there are two ways to do it: either use mogrify ( mogrify -format tiff *.png ), or convert.
- second, combine the frames into a movie called shrimp.mpg:
ffmpeg -f mpeg2video -pass 1/2 -b 20M -i bmnew.0%d.tiff shrimp.mpg
The small movie shrimp.mpg is ready to be visualized!
Enjoy it at www.cct.lsu.edu/~elena/index/shrimp.mpg or as a small gif file at www.cct.lsu.edu/~elena/biomass_new.gif
