From: John Stone (johns_at_ks.uiuc.edu)
Date: Wed Jun 18 2003 - 11:21:53 CDT

Peter, VMD-L,
  I don't have any recent experience with Quicktime, but I used to
write MPEG encoders for a living before I came here to work on VMD,
so I do have a few comments in that regard. Most of these suggestions
apply directly to other video codecs except for MPEG-specific resolution
and bitrate limitations.

Several of the items I mention below are actually already implemented
in the "vmdmovie" plugin that's included with the new version of VMD,
so some of this is "free" if you have use for the simple movies it
generates automatically. My goal is to make the "vmdmovie" plugin
more capable so that people can do much more complex sequences but
still benefit from the work it does to produce decent quality output.

I'm assume that your goal is to produce an MPEG-1 movie, at standard
VCD profile etc. Here are things to be cognizant of when making
movies for low-bitrate playback (i.e. VideoCD or standard MPEG-1
rates):

  - MPEG is a garbage-in/garbage-out medium. If you don't take some
    care when setting up your animation, you'll have lackluster results
    in the final movie. As such, you want to render the original frames
    with the best quality possible. This means that you should enable
    features like antialiasing in you graphics hardware or software.
    (check the "antialiasing" box in VMD)
    If you're using software renderers like POV-Ray or Tachyon, you'll
    want to enable antialiasing features and anything else that eliminates
    spatial or temporal artifacts that will degrade the video compression
    process. Besides being distracting to the human eye, effects such as
    "pixel popping" are also detrimental to video compressors since they
    burn valuable bits on what is essentially "digital noise". Always start
    with the best source material possible.

  - MPEG-1 targets 352x240 resolution. If you exceed this resolution,
    you're asking for all kinds trouble both in encoding and playback.

  - MPEG gets much of its compression by quantization of the high-frequency
    video components. As such, you will want to strongly avoid creating
    graphics that include things like lines or other objects that are
    only 1 or 2 pixels wide. Even before DCT transforms are done on the
    images, half of the resolution is thrown away on the chrominance planes,
    so you should expect for brightly colored, saturated objects that are
    very thin (i.e. 1 or 2 pixels wide) to get colored "halos" around them.
    If you keep all of your geometry scaled such that its mostly 3 pixels
    wide or more, you'll get decent results.

  - In order to help the MPEG encoder do a good job of re-using pixel data
    from frame to frame, you should consider using the new
    "trajectory smoothing" features in VMD 1.8.x. By smoothing the trajectory,
    there is much less entropy in the image sequence, particularly in the
    timescale of one MPEG "GOP" (about 15 frames). By smoothing trajectories
    you'll get a sequence of images that the MPEG encoder can do a MUCH
    better job of encoding.

  - To get peak quality from an MPEG encoder, you'll want to enable
    "full search" with a large search window for the motion estimation
    algorithms they have available. Some encoders implement a logarithmic
    time search algorithm that does almost as well but with much less
    runtime. That would be another good option. The best software-based
    MPEG encoders can also "rewind" when they make mistakes allocating
    bits and hit a very difficult frame or scene transition that requires
    a lot of bits all at once.

  - Regarding video quality: If you follow the suggestions I make above,
    it should be very easy for you to get a nice looking VCD rate MPEG-1
    stream that's less than 9MB per minute. If you really want something
    that's playable on VideoCD players, you'll have to keep the MPEG-1
    bitrate down to 1.15 megabits per second or less, IIRC.

If you have more questions I can certainly give advice on how
to counter specific problems you're having. The "flickering lines"
problem sounds like a combination of at least one or two of the
items I've mentioned above. I'd start by making sure that you have
no geometry that's less than 3 pixels wide. :-)

Thanks,
  John Stone
  vmd_at_ks.uiuc.edu

On Wed, Jun 18, 2003 at 09:51:56AM -0600, Peter Tieleman wrote:
> Hi,
>
> This isn't directly related to VMD, but since there's so much experience
> with this on the list:
> What settings do people use for codecs/compression for quicktime, and
> what settings for mpeg1, for web-based movies of trajectories (e.g. the
> movie gallery on the vmd website) ?
>
> I would have thought it should be possible to get a video-cd sized movie
> in 10 MB/minute file size, but in practice that seems very hard to
> achieve with a reasonable quality, and without flicking lines in black
> background for mpgs.
>
> Peter

-- 
NIH Resource for Macromolecular Modeling and Bioinformatics
Beckman Institute for Advanced Science and Technology
University of Illinois, 405 N. Mathews Ave, Urbana, IL 61801
Email: johns_at_ks.uiuc.edu                 Phone: 217-244-3349              
  WWW: http://www.ks.uiuc.edu/~johns/      Fax: 217-244-6078