High Quality Movie Encoding
Once you have rendered frames, there are two steps to encoding a high quality movie. First, the frames may need some last minute adjustments (anti-aliasing, adjusting frame size, applying logos, etc.). Second, one should use the right encoder with the right parameters.
Often it is desirable to have anti-aliased images. Jaggies can be distracting, and the distraction can be aggravated during animation. The simple approach is to render frames that are between 2x and 3x larger in each direction than the desired final frame, and then average these down to the correct size.
One approach is to use ImageMagick's command line interface:
. The first just reduces the big frame by a fixed percentage. If you rendered at 2x, then 50% is perfect. The second is when you don't use an integer scaling number to produce your oversized frames. In this case, whatever the big frame size is, ImageMagick will scale the whole image (preserving the aspect ratio) so that it fits within a box that's 1920x1080. This means that if you used a different aspect ratio, the final frame could be smaller than the vertical or horizontal dimension requested.
Another approach is to write a short script in python, using the Python Imaging library. In practice, this is cleaner and more convenient for large scale conversion than the ImageMagick approach. Put the following code in a file called
, and make it executable via
When dealing with thousands of frames, it helps to be able to take advantage of multiple cores to do the work. It also helps to be able to interrupt and resume the conversion process without having to start over. A simple Makefile can handle this nicely, regardless of whether one uses ImageMagick or Python Imaging. As an example, if oversized unlabled filenames are of the form
and the labled, antialiased frame name is of the form
, the logo image is in a filed called
, then the following makefile:
should let you run
to build all frames in parallel.
The best (in terms of image quality, small file sizes, and portability of the final movie across differing platforms) movies come from H.264 encoding (which is another name for MPEG-4 Part 10. Although the actual encoding is standardized, the result is "packaged" in ways that are often not standardized. For example, there is an x.264 implementation of the standard that makes great preview movies under Linux, but is not honored by Microsoft's player or Apple's player. By staying with the Apple Quicktime Wrapper around Apple's H.264 implementation, we get portability to any place able to play quicktime movies (and that includes Microsoft and Linux platforms).
Apple provided a nice way to get at the H.264 parameters in the Pro version of Quicktime 7. Quicktime 7 is free, and the Pro upgrade is about $30. More recently, Quicktime no longer allows general adjustment of the encoding parameters, instead providing a few defaults that work for portable devices. Now they want you to buy Final Cut to do more interesting compression. But, for now, Quicktime 7 with the Pro upgrade are still available, and serve our purposes very well.
In QuickTime 7 Pro,
Open "Image Sequence", and select the first frame of the sequence. Quicktime will spot the pattern and load all other frames in that sequence as well. For previewing purposes, select the frame rate of your final movie (shoot for 30fps, but use 15 fps if you know that you have to).
Then Export your movie. Check the options carefully. You want:
- Multi Pass encoding.
- Automatic Frame Rate.
- Quick Start for streaming
- Current Frame size (don't let the encoder change frame size; it's usually much faster to do this via the makefile/script combo mentioned above).
- Quality should be set to High as a first guess.
More than this tends to look no different, but create a larger file. Less creates a smaller file, but can start to look bad. Almost always, "High" or slightly less turns out to be best. For laptop presentations, you probably want to keep movie size under 15 or 20 MB. For nice HD movies, you probably want to stay under about 100MB.
save as .mov