How to turn a series of numbered images into an mpeg or avi movie
using free software
This is mainly oriented towards Unix
systems (MacOSX / Linux / Unix) but some things also work on Windows
It is assumed that the image files are something like name001.jpg,
name002.jpg, name003.jpg, etc.
Here is a quick summary and links to fuller information: for more
extensive discussion and other options see here,
with specific information about using ffmpeg here and about
ppmtompeg here.
Step 0: Getting the image files in the right format
It may be necessary to convert your image files before encoding them.
For example, mencoder seems to need jpgs. The most convenient command
for this is "convert", part of the ImageMagick
package that comes with most Linux distributions and for the Mac can be
downloaded using fink.
e.g.,
to convert a single
ppm image to jpg: convert -quality 100 image123.ppm image123.jpg
For a series of images, use
something like:
for f in *.ppm; do convert -quality 100 $f `basename
$f .ppm`.jpg; done
(if this doesn't work on
the command line, put into an ascii file e.g., script then run
using 'sh script').
Option 1: Use 'convert'
convert is part of the ImageMagick package, which comes with many Linux distributions. For Mac it can be downloaded using fink.
mpeg: To convert images to an mpeg movie it is necessary to also install mpeg2encode, which is available from the same places (note, this may be in the 'unstable' branch of fink). To convert a series of numbered ppm files to an mpg movie:
convert -delay 6 -quality 95 test*ppm movie.mpg
-delay and -quality flags are optional. If -delay is set >4, it will add extra frames to make the movie run more slowly, thereby increasing the size of the file. The default quality is 75 and maximum is 100.
animated gif: e.g.,
convert -delay 20 test*ppm movie.gif
After this, the animated gif can be converted to mov format using quicktime pro.
Option 2: Use mencoder
To convert a series of jpg files to an avi movie that can be displayed
by, for example, Quicktime Player with no add-ons, use:
mencoder "mf://*.jpg" -o movie.avi -ovc lavc -lavcopts vcodec=mjpeg
Notes:
- It can also make mpeg movies but these don't seem readable by
Quicktime Player
- Other vcodecs may give more efficient or higher quality results
and be playable on some players, but mjpeg is the only one I found to
work with the standard Quicktime Player
- To download mencoder for MacOSX, particularly for Intel CPU,
follow the link at http://ffmpegx.com/download.html
.
Useful discussions are on Wikipedia and here.
Other Possibilities
ffmpeg
or ppmtompeg
(discussed here)
or mjpeg.