Making movies with xnbody

Making movies with xnbody
written by A. Ernst (aernst@ari.uni-heidelberg.de, August 10, 2005)



Download the tool "mpeg_encode" (the download area is here) from the UC Berkeley and install it on your machine. Some minor patches in the source code may be necessary! Run nbody6 and xnbody. Wait until the online visualisation starts. Select Tools->Animation from the menu. In the Output window, choose a directory, the prefix "try" and the file format "jpeg". In the Record window, choose a frequency (for instance, "30000") and push the start button. Now the program will start producing jpeg files (one every 30 seconds) starting with "try0000.JPEG". Wait until there are enough jpeg files for a movie. Copy the binary file "mpeg_encode" into the directory with your jpeg files. This tool requires the pictures to be in .ppm format. Write the following shell script named "mkppm" consisting of one line: for i in try*.JPEG; do new=`basename $i .JPEG`.ppm; echo $new; convert $i $new; done This will convert all your JPEG files to .ppm files. You can also use djpeg instead of convert, which is included with mpeg_encode: for i in try*.JPEG; do new=`basename $i .JPEG`.ppm; echo $new; djpeg $i > $new; done  Create a parameter file for mpeg_encode (named "parfile", for instance), which looks like this:
 * 1) mpeg_encode parameter file

PATTERN		I OUTPUT		test.mpg GOP_SIZE	30 SLICES_PER_FRAME	1 REFERENCE_FRAME ORIGINAL BASE_FILE_FORMAT	PPM YUV_SIZE	352x240 INPUT_CONVERT	* INPUT_DIR	. INPUT try*.ppm	[0000-0100] END_INPUT ERROR		MAD PIXEL		FULL RANGE		8 PSEARCH_ALG	EXHAUSTIVE BSEARCH_ALG	SIMPLE IQSCALE		31 PQSCALE		10 BQSCALE		25 Modify this file accordingly: In the line starting with "try*.ppm" insert the start and end number of your image files.   Type mpeg_encode parfile in the command line and press Enter. 