Table of Contents
Introduction
This page focuses on creating MPEG-1 movies (video only) using NERSC.
The resultant movies can be played using any MPEG-1
player or on a web page. This page describes what you need to
consider before you make your movie;
some
methods for creating a movie; and some advanced tips
for the more adventuresome user. Note: The example movies shown in this
page do not reflect the normal quality of output from the graphics &
visualization packages used. We picked the worst way to create the images
and movies to illustrate what you should not do.
Creating a movie is at least a two step process. First you need to create
the individual frames that will comprise your movie. You then need to combine
these images to create a movie that you and others can play back on a computer.
Almost all computer-generated movie formats use a compression algorithm.
Compression is necessary because of size constraints (size of image times
the number of the images to make a movie (30 frames per second) equals
hundreds to thousands of megabytes). The MPEG-1 standard is one movie format
that supports a very good compression scheme. Others possible formats are
Apple's
QuickTime, and Microsoft's
AVI.
This page focuses on MPEG because most platforms support MPEG-1 players
and there are lots of plug-ins available for web browsers.
When you decide to make your movie, be prepared to spend more time on
creating the movie than you first thought or you would like to. Movie making
is an art. There is no cookbook that will tell you exactly what you need
to do to create your perfect movie. Factors that contribute to the problem
is that the final movie size may be the most important factor to one user,
another user is more interested in the highest-quality image, and yet another
is interested in portability.
If you are interested in learning more about video and various standards
like MPEG, check out the web and books and magazines on video, it's creation,
and deployment. Click
here
to
go to the official web site of the Movie Picture Experts Group (MPEG).
Before You Make Your Image Files
Things to consider before
you make the images for your movie:
- Image Size.
-
It is best to create the images in the correct size to begin with. Most
movie creation programs do a poor job of changing size, especially the
PC programs we tried. If you need to modify the size, do it before you
create the movie, using tools such as convert.
NOTE:
Many movie making methods expect the image size in x
and y to be in multiples of 16. If the image size is not an even
multiple of 16, then depending on the version of mpeg_encode
and mediaconvert, the images will be arbitrarily resized,
the encoder will dump core, or it will complain and not create the movie.
- Image File Naming Conventions.
-
Most of the encoding programs expect the files to be numbered sequentially
(e.g., mpeg_encode, ffmpeg and many PC programs). Some programs will require
zero padding of the file names as in the sequence:
file0000.jpg, file0001.jpg, ..., file1000.jpg while others will work with any sequence described
by a C format string. You will need to name your files accordingly.
- Final Image Size in the MPEG
-
Even though the various MPEG encoders can generate movies with various
frame sizes, not all viewers can handle them. For example, we had problems
viewing the movie on a PC with a 1037x541 movie. We have been successful
with movies of 1024x768, 640x480 or 320x240.
- Composition and Layout
-
Keep your frames uncluttered, especially if you are creating a movie with
small frames (e.g. 320 x 240 movie).
- Choosing Colors During Composition
-
Avoid thin lines
(example movie),
dark blue lines on a black background
(example movie),
highly saturated colors, small objects, etc.
- The Quest for Quality
-
Start with a "good image." Any compression scheme will degrade the quality
of the original.
- Make Small, Sample Movies First
-
Before creating all your frames, you might want to try making a sample
movie from a few frames. This is important because your time-step between
frames may be too great, and when played back this creates a jittery movie.
Also, while the individual frames may look great, motion can add visual
artifacts that are both confusing and distracting.
- Choose Your Raster Image File Format Wisely: Beware Color Quantization
-
Don't create your frames using the GIF file format. GIF compresses the
color information to 256 colors. MPEG does not have this restriction. Use
JPEG, TIFF, PNM, or another file format that the mpeg encoder supports.
Also, do not use an image file format that does a lossy-compression on
the image.
Tools to Create MPEG Movies
MPEG Encoders
An MPEG encoder is a software tool that takes individual raster image
files, and generates an MPEG movie.
The following MPEG encosders applications are available for your use on
NERSC's DaVinci system.
- ffmpeg is an open source command-line application included in the
Ensight distribution.
- mpeg_encode is an open source command-line application included in the VisIt distribution.
- For historical reasons, we include here mediaconvert, an application
with a GUI to the low-level dmconvert utility (see below).
- Even tough not available in DaVinci, for historical reasons we include here two applications available in SGI machines: makemovie, and dmconvert, which are both
command-line utilities for creating movies from image files. mediaconvert is an application
with a GUI to the low-level dmconvert. For
more information about these applications, refer to the man pages of an SGI system.
Applications that Include MPEG Encoders
In contrast to the MPEG encoders described above - where you
provide a number of image files as input and obtain a finished
MPEG movie on output, the following visualization applications are
capable of directly generating MPEG movies. In other words, you don't
have to perform the intermediate step of generating raster image files
prior to running the encoder
Try out each of the above applications and encoders to determine which
produces acceptable MPEG quality and resolution. Here are two sample
movies that show how MPEGs created from each of the applications. The
movie consists of an animation of small bouncing balls. Default values
were used for the compression parameters in each application's encoder.
In this case, mediaconvert did a better job than mpeg_encode but
created a larger file (490K versus 90K). mpeg_encode did a better
job when the balls were made a little larger and the colors were de-saturated.
Movie 1, notice the
balls are not distorted.
Movie 2, the balls are distorted.
You can play with changing the compression scheme by
modifying the number of I, P, and B frames. The definition of these frame
types are detailed in any article on MPEG.
Basically, the more B and P frames you specify, the more compression.
You can visit the Berkeley MPEG Group's
website for more information.
Additional/Advanced Tips for Creating MPEG Movies
-
Depending on what you want to do with your movie, you might want to play
with the Bit Rate specification using the -b option in ffmpeg
or the "BIT RATE" line in the mpeg_encode parameter file. When using mediaconvert
the Bit Rate option can be found in the "Video Output Parameters" sub-menu. You can
decrease the size of your movie file if you lower the bit rate. This might
be important if you are playing this movie across the network.
-
Sometimes you cannot create your images without jagged edges or small dropouts
in the frames.
ffmpeg has the ability to do some image processing
(smoothing) on the individual tool images before the movie is made, the command-line option
is -qblur.
In mediaconvert you can
access this capability by selecting video parameters from the main menu
and then selecting the "MPEG-1 Settings Panel". "Prefiltering" has three
options. Use the none option for no smoothing
(Sample Movie); use
the medium option for some smoothing, use the maximum
option for the most smoothing
(Sample Movie).
Check out the smoothing flags to see which one works best on
your frames. Note: Smoothing will increase the size of your movie file.
-
ffmpeg and Mediaconvert let you specify the frame rate of the movie. Remember
that film is 24 frames/second, while video is 29.97 frames/second. If you
start with a 30 fps movie and you have the Frame rate is set to 24, you
will get an MPEG-1 movie with fewer frames. The applications preserve
the duration of the movie (important in non-computer generated movies)
and converting from 30 to 24 fps. Thus, a movie with less frames.
-
Sometimes you need to concatenate two or more images into one frame. Useful
tools for doing this are Imtools and pbmplus. These tools are described
below.
Applications and Tools for Raster Image Manipulation
The applications and tools described in this section are useful for
performing operations on raster image files. In addition to these,
which comprise a collection somewhat specific to creating MPEGs on
NERSC platforms, we also provide a variety of raster image manipulation
tools. These are described in the
Image Manipulation
Applications section of the NERSC Visualization Software page.
Displaying Movies
The applications you may be familiar with for
playing movies (e.g., Windows Media Player, Apple's Quicktime Player)
are not installed on NERSC platforms.
We suggest that you download the
MPEGs to your workstation and verify that the quality and resolution
are visually acceptable using the commodity players.
Format Conversion
ffmpeg
can also perform movie format conversion. See the ffmpeg documentation for
more information.
Additional Information - Presentations, etc.