Matlab Movies for the WEB

This package was written starting 11/95 while I was a graduate student at
the University of Washington. The last substantial revision was 5/98.
All files are provided as is, with no guarantees whatsoever...


[Purpose] [Examples] [Installation (UNIX)] [Package (PC)] [Usage] [Tests]
[Known Bugs] [Credits] [Miscellaneous] [Author]

movie icon Click here for access to gzipped and tarred UNIX versions of the package,
and here for the individual files needed on PCs.


Purpose of this package

          My research interests are in the numerical solution of partial 
        differential equations and in optimization. In both areas,
        it is sometimes necessary to consider quantities changing 
        with time or corresponding to the steps of a solution process. 
        My favorite visualization tool is MATLAB, and my preferred way
        of communicating is via the internet -- at least compared with
        the usual research articles. 
        
        MATLAB comes with its own movie commands, but they are not 
        directly suited to put movies on the WEB: Matlab's movies can 
        only be played with MATLAB, they are generated slowly and 
        consume enormous amounts of disk space when saved. 

        Since 1994, MPEG seems to be evolving as the (commercial) standard
	for animation. Many PCs are now sold with built-in hardware to 
        display movies in this format. Another popular format is GIF.
        These two formats are supported by my MATLAB movie package.

	The package specifically provides a Matlab interface to 
	the University of California at Berkeley's mpeg_encoder 
	and Rene Mueller's gifmerge software. Both create animations
        from sequences of gif images.

        The package extends MATLAB to provide those collections of
	gif images and to access some of the options of the above 
	mentioned software conveniently from within Matlab. 
	Specifically the commands are

        makeframe    --- to generate a single image in gif format
        makemovie    --- to generate movies in MPEG and Gif89a formats
                         from the images generated with makeframe.

	This package is not a movie viewer; any internet browser will
	display its output.

Examples of movies created with this package

	        Pulsing Meshfunction

          Here you see the movie demo.gif, which is created as an 
        example by the package. If you have set up your browser 
        correctly, clicking on it will start an mpeg_player with 
        the same demo in mpeg format -- 7 times smaller than the 
	gif version. The quality is higher if you create figures with
	less than 256 colors and do not use the quantify option, which
	is otherwise needed due to the gif format limit of 256 colors.

	For more sophisticated examples, please check out the following sites:

	- Joern Sesterhenn has used ideas from this package to create 
	  gif movies from Fortran, animating Lock Exchange flows.

	- Professor Randy LeVeque has used the package to 
	  animate results from his AMRCLAW Package.

        - I use the package to explain the workings of my numerical 
          method for elliptic pdes with non-smooth solutions, EJIIM.
	  If you have a fast network connection, check this out.

Installation of the package

        To install the movie package under UNIX, you should execute

	gunzip movie.tar.gz

	tar -xf movie.tar
	
	That creates a new directory Movie. You can move the Movie 
	directory whereever it is convenient for you. Next,

	cd Movie

        Move the other *.tar.gz files (with platform-specific 
        executables) you received to this Movie directory as well.

        install_movies
        
        install_movies edits the site-specific sections of the  
	files makeframe.m, makeparams and makemovie.m. The variable 
	packagedir has the full path to the matlab movie package, 
	which is the directory in which you run install_movies. (If 
	  you want to change the location of the Movie directory, 
	  simply run install_movies again in the new directory. In 
	  that case, don't worry about error messages that 
	  install_movies could not find certain files, by moving 
	  the Movie directory that portion of the installation 
	  remains intact.)

          When you run install_movies, an e-mail is sent to 
        awiegmann@lbl.gov that you did so. This is due to curiosity 
        of the author and to find out how useful this package may 
        be. If you feel that it violates your privacy, please feel
        free to comment out the corresponding lines in the 
        install_movies file.

	In multi-user environments, one copy of the package may be 
	used system wide, by setting the file read, write and  
	execute permissions in the Movie directory (and  
	subdirectories) appropriately and notifying all users of 
	the location of the package.

Usage

        Include the path to the matlab movie package (under MATLAB) 
	with a statement similar to:

        path(path,'/user7/awiegman/Matlab/Movie') --- Matlab 4
        addpath('/user7/awiegman/Matlab/Movie')   --- Matlab 5


        where the path in single quotes is where you installed the
        movie package.

        Alternatively, include it in your .cshrc file, similar to
        
        setenv MATLABPATH /user7/awiegman/Projects/Matlab/Movie
	
	Try 
		help makeframe
	and
		help makemovie
	
	under Matlab as well.

Tests

        Try  
		type simplemovie  
	or  
		type moviedemo   
	
	under MATLAB to see examples of how to generate movies. 
	Executing   simplemovie should generate the files

        demo.mpg         and         demo.gif
        
        as they come with this package and included above in this 
	document.

Known Bugs

        - Animations of figures with more than 256 colors are not
	  created at all. This is a limit of the Gif image format,
	  not my package. This package uses ppmquant to scale down
 	  down the color space, but ideally this should be done by
	  the user for all frames in the same manner. The ppmquant 
	  executable is not yet available for all platforms, and
	  is buggy on the windows platform.

	- You can not make two movies at the same time in the same
	  working directory (since makeframe has no unique name for
	  the movie to work with). Creating a directory for each movie
          that you work on simultaneously circumvents this problem.

	- makeframe uses Matlab's print command to generate gif images.
	  On DEC Alpha, this may create many unaligned access warnings. 
	  Actually, this is a problem of the ghostscript software used 
	  by Matlab version 4.2c 

	- On SGI machines, the correct directory name may be SGI64, not 
	  SGI as is currently the case. Please let me know if you have  
	  a definitive answer to the question: Is the computer variable
	  on SGI always set to `SGI64`?

Credits

	Creation of this package was made possible by the advent of 
	Matlab, UNIX and the Web. Other than Matlab, most of the needed 
	software is available as source code from various sites listed 
	below. 

        For convenience, I distribute all needed executables for
	Windows, SGI, DEC Alpha, Sun SPARC and HP700 workstations. 


        The UC Berkeley mpeg_encode:

	     ftp://mm-ftp.cs.berkeley.edu/pub/mpeg/encode/

	and mpeg_play: Executables for DEC Alpha, HP7000, Sun SPARC and 
	for many other workstations may be obtained from the Geometry 
	Center at the University of Minnesota:

             http://www.geom.umn.edu/software/download/mpeg_play.html

        The player is not part of the package and called only in the 
	demonstration files moviedemo.m and simplemovie.m


        Executables of the pnmcut and giftopnm programs by Jef 
        Poskanzer are also included. The pbm package is available 
	from netlib and many other sources. 


        Finally, executables of Mark Podlipec's txtmerge, improved to 
        gifmerge by Rene K. Mueller, are included. 

             http://smurfland.cit.buffalo.edu/xanim/xa_gifs.html

        and

	     http://the-labs.com/GIFMerge/

Miscellaneous

	Matlab version compatibility:

	I have extensively tested the movie package version for 
	Matlab 4.2c. A new version of the package for Matlab 5
        is available as of 12/13/1997. For help with other versions 
	of Matlab feel free to contact me at

	     awiegmann@lbl.gov

        Disk Space: 

        If mpg_encode, mpeg_play, gifmerge, pnmcut or giftopnm are 
        available on your system, you may want to replace the 
        executables of the files with links to the appropriate files,
	or change the paths in makeframe, makeparams and makemovie 
	appropriately.


        Supported Architectures:

        Currently, the package is self-contained for PCs under Windows 95,
	and Windows NT, DEC Alpha, SUN SPARC, SGI and Hewlett-Packard 
        HP7000 workstations. 
	

	Porting the package to different architectures:

	It is fairly easy to assemble all the necessary files for 
	other architectures from the internet (see the Credit section 
	for URLs). Slight modifications of makeframe and makemovie 
	are needed, as well as new directories containing the 
	executables for the new architectures. Naming conventions 
	for the directories are those of Matlab, the new directory 
	(e.g. SUN4 for Sun SPARC workstation) needs to contain the 
	same files as e.g. the ALPHA directory, but compiled for 
	the new architecture. For demonstration purposes, a file
	install.sun is included, that searches the system for some of
	the necessary file from the pbmplus package and puts them in 
	the right locations. (Needed back when I did not have all the 
	executables for SPARC stations.)


        Debugging:

        In case either makeframe or makemovie does not work, you may
        want to consider calling it with all options and a dummy 
	variable, e.g.   makeframe(i,[240,192],'debug'); 
                  or     makemovie(0,13,'demo',10,1,'all','debug');
        This generates extra information on what particular portion 
        of the package is being executed.

        Update for Matlab 5:  - The commands do NOT support
                                the debug option anymore.
                              - The arguments in makemovie have changed,
                                necessetating internal gymnastics to 
				ensure compatibility with Matlab 4.

This page was last modified: Monday, October 11 1999
Go to Andreas' homepage