Local note: If you are on UNH's spice machines we already have all of the conversion programs installed.
If you already have the gif files you want to convert skip to the section on file names.
In order to create numbered files Matlabs string replace function, strrep, is used to update the filename. Once a plot is produced it can be written to a gif file using the print command with the -dgif8 option. Because the string is updated the command is executed using the eval function.
As a simple example, a sequence of gif files can be written out with the file names numbered in order. The example will create 81 gif files named curve1.gif, curve2.gif, curve3.gif, curve4.gif,... curve81.gif. Because of memory limitations we were only able to use the first 60 frames for the example mpeg given below.
There is one problem with this arrangement if you are working on an SGI workstation. The movieconvert program that is now part of OS 5.3 requires file names where the numbers are in fixed field. For example, the pressure field at the 5th step should be in a file called curve5.gif, but in your program you may have generated the file and called it curve05.gif so that you could use the movieconvert program. Since the program converts to quicktime and not mpeg you may want to create two movie versions (or use mpeg since it compresses MUCH better). To convert file names from the SGI format to the format that mpeg_encode prefers try this perl script that we use. You can then use mpeg_encode on the new sequence of files.
The parameters that are used in the conversion process are specified in a separate file. The file must follow a very specific format. For an example of the format file see matlab.param. We have found this to give decent results. Because we used small numbers for IQSCALE, PQSCALE, and BQSCALE the compression is not as tight as some would like. However, it does offer relatively sharp output. Of course, your mileage will vary!
The parameter file matlab.param, does the following things:
Once all these things are in place and you have a parameter file (pressure.param) you can encode your files with the following command:
mpeg_encode matlab.param
After you have gone out for a cup of coffee you will find a new mpeg file.
Warning! The parameter file given in this example seems to do a better job of using less memory than the parameter file that is given in the rgb to mpeg tutorial. If you run out of swap space using these parameter files you may have to play around with the parameters to reduce the required memory. Look at both and compare for the best results.