HOWTO Make Movies out of PostScript Files

HOWTO Make Movies out of PostScript Files

Marion Daalmeijer

June 5, 1998

Abstract

This file describes a number of procedures that make a lot of PostScript files look like a movie. The result is either an MPG file or a GIF file which can be played with MPEG_PLAY, XANIM or NETSCAPE.

Contents

1  Preparation of the Files
    1.1  Name and Size of the Files
    1.2  Format of the Files
2  Make the Movie
    2.1  Make a GIF Movie
        2.1.1  TIPS
    2.2  Make an MPEG Movie
        2.2.1  Use MAKEMPEG
        2.2.2  Use MPEG2ENCODE

1.  Preparation of the Files

1.1  Name and Size of the Files

First of all you have to make a lot of PostScript files, which eventually will be the movie. Make sure they have all the same size. You can control the size by using the program XV. This program may also be used to change the format of a file.

The names of the files should be image.0000.ps, image.0001.ps, etc., where image may be any chosen name.

1.2  Format of the Files

Now it depends on which procedure you want to follow. To use makempeg or whirlgif you need gif-files and for the use of mpeg2encode you need ppm-files. To convert a lot of ps-files to gif-files and ppm-files you may use the following script:

#!/usr/bin/sh
for name in `ls *.ps`
do
   ps2gifppm -col $name
done
So now you have ps-, gif- and ppm-files. Remove the ones you don't need!

2.  Make the Movie

Now you are ready to make the movie. But first you have to make a choice about the format of that movie-file. Will it be GIF or MPG?

2.1  Make a GIF Movie

The command you need is whirlgif: a quick program that reads a series of gif files, and produces a single gif file composed of those images.

Usage:
whirlgif [-v] [-trans index] [-time delay] [-o outfile] [-loop]
         [-i incfile] file1 [-time delay] file2

options: -v              verbose mode
         -loop [count]   add the Netscape 'loop' extension.
         -time delay     inter-frame timing.
         -disp [method]  Set disposal method, see below
         -trans index    set the colormap index 'index' to be transparent
         -o outfile      write the results to 'outfile'
         -i incfile      read a list of names from 'incfile'

2.1.1 TIPS

If you don't specify an output file, the GIF will be sent to stdout. This is a good thing if you're using this in a CGI script, a very bad thing if you run this from a terminal and forget to redirect stdout.

The output file (if any) and -loop _MUST_ be specified before any gif images.

You can specify several delay statements on the command line to change the delay between images in the middle of an animation, e.g

whirlgif -time 5 a.gif b.gif c.gif -time 100 d.gif -time 5 e.gif f.gif
Although it's generally considered to be evil, you can also specify several transparency statements on the command line, to change the transparent color in the middle of an animation. This may cause problems for some programs.

To read more information: click on the location:

whirlgif.doc

2.2  Make an MPEG Movie

You decided you want to make an mpeg movie. Still you have two choices on how to do that:

2.2.1 Use MAKEMPEG

The command:

makempeg -fs 1 -fi 1 -fe 20 -base image -ext gif
will make the file image.mpg, which you can play with the command: mpeg_play image.mpg.

Explanation of the command:

Usage: makempeg [-fs start] [-fe end] [-fi increment] [-base basename]
                [-ext extension]

          fs = fe = fi = 1 
          base = image
Tip: If the speed of the video is too high, you can duplicate the gif-files one or more times and run the makempeg command again, with the adjusted numbers.

2.2.2 Use MPEG2ENCODE

To use the mpeg2encode program you need the ppm-files and a parameter file, for example mpeg-1.par. You will find examples of parameter files in directory

/usr/local/talib/mpeg
Copy the file to the directory of your ppm-files and edit the file. Do NOT delete any lines in this file! The lines that need editing are:

The horizontal and vertical sizes you can obtain by viewing the ppm-file with xv:

xv image.ppm
Put the mouse in the picture and click your right-mouse button. Point to image size and drag your mouse to set size. Here you see the dimensions of your picture. It should be obvious that the horizontal and vertical size of every file to use should be the same.

Now you are ready to give the following command:

mpeg2encode MPEG-1.par image.mpg
To read more information: click on the location:

mpeg2enc.doc


File translated from TEX by TTH, version 1.23.