Quicktime to Mpeg... techniques.

Robert Harper harper at shamrock.csc.fi
Tue Nov 9 04:18:45 EST 1993


The Uniform Resource Locator for this document is:
http://pulua.hcc.hawaii.edu/movies/techinfo.html

MPEG Technical Info

Here's how the MPEGs at HCC were made - you might say it was done the hard
way - but until more versatile programs come out, here's how to do it if you're
really determined!  Our solution used the Macintosh platform to digitize the
original video; your procedure may vary.

Digitize it

A VideoSpigot board and its extension, paired with ScreenPlay 1.1.1 (available
by ftp at sumex-aim.stanford.edu) captured the video that was shot all around the
campus with a little camcorder.  We saved each movie with "Graphics"
compression with the "Color" option (so the frames are 8-bit) from QuickTime
1.6, available at ftp.apple.com.

You will want to make sure the width and height of the movie both have an even
number of pixels - this will eliminate potential problems with convertors and
encoders later.  A common size to use which is fairly fast and yet big enough to
see detail in is 160 pixels wide by 120 pixels high.

Dissect it

Using a movie convertor HyperCard stack written by Lawrence D'Oliveiro at
the University of Waikato in New Zealand (Ido at waikato.ac.nz), the QuickTime
movies were converted to numbered PICT files.  Normally the frames are saved
with the name, a period, and a number (e.g., "movie.1, movie.2, ...", but it was
changed to omit the period for easier conversion later.  To get the modified stack
in BinHex format, select this.

Convert it

Now that you have a folder of PICT frames that look like "movie1, movie2, ..."
you need to convert each frame to GIF format (at least, a batch convertor for
PICT to some other common format).  One program that will do this is 
GraphicConvertor by Thorsten Lemke.  That's also at sumex.

Convert it again

The GIF files were transmitted through NFS-Share to a UNIX box.  If you use a
method to transfer from the Macintosh, remember to delete any percent-sign
files that some programs use to store Macintosh resource information.  Just type

     rm -f %*

Now, assuming you have a few directories with GIF frames, each directory
representing a movie, make a note of the number of frames in each movie.
Typing

     ls | wc -l

in a movie's directory will give you the number.  Now, you need to convert the
files to YUV format - that splits each file into three, each file containing
luminance, chrominance, and hue information respectively.  Using giftoppm
from the pbmplus package at export.lcs.mit.edu, and using ppmtoyuvsplit
available at gogol.cenatls.cena.dgac.fr, you can write a little shell script like:

     #! /bin/csh

     set num = 1
     set limit = $#argv
     @ limit++
     while ($num != $limit)
             set file = $argv[$num]
             giftoppm $file | ppmtoyuvsplit $file
             @ num++
     end

...or whatever, save it as giftoyuv, make it executable, and type

     giftoyuv *

in your GIF directory.  For those who have had trouble compiling ppmtoyuvsplit,
you can obtain a uuencoded SunOS 4.1.3 binary here.

MPEG it

Using the mpeg encoder/decoder, available from havefun.stanford.edu (or for a 
DOS version or other (faster, better) PC-based solutions, contact
mitgml at dct.ac.uk), type:

mpeg -a <start frame #> -b <end frame #>
     -h <frame width in pixels>
     -v <frame height in pixels> -PF movie.mpg movie

In this case, the final MPEG movie is "movie.mpg" and the files are "movie1.Y,
movie1.U, movie1.V, movie2.Y, movie2.U, movie2.V, ..." In our case the frame
sizes were 160 pixels wide by 120 high, which is the original VideoSpigot size.

You can also get Berkeley's MPEG encoder and player packages by FTPing 
toe.cs.berkeley.edu.  The encoder has some pretty nice options, and can take in
YUV frames that aren't split into three parts.

Thanks go to the Manoa Innovation Center's Digital Media Lab for giving up a
little time on their super-stocked Quadra, and to Mike Butsch
(butsch at wave.esm.vt.edu) for pointing out a few quirks.

The QuickTime to MPEG convertor!

Naturally, a really nice QuickTime to MPEG convertor has been made by Rainer
Menes (menes at statistik.tu-muenchen.de) that works only on Macs with 68040
processors or better under MacMiNT, a custom multitasking environment.  The
package, which you can get by FTPing suniams1.statistik.tu-muenchen.de,
includes a QT to YUV convertor, as well as both the Berkeley and Stanford
encoders, which will all do their thing (although a little slowly) on your Mac.

Ranier has done a great job!  All of the HCC movies will eventually be converted
via this method, as the YUV convertor will handle 24-bit QT files, improving
the quality somewhat.  Using the package and Berkeley encoder, I've been able to
get a 24-bit, 20-second 160 by 120 MPEG down to 114k!

There are some things to keep in mind though:

   The qt2yuv programs may freeze on large movies.  This is a problem
   dealing with memory (the Macintosh doesn't free up memory correctly),
   and Ranier is trying to find a solution for it.  
   The Berkeley encoder compresses much smaller than Stanford's and is a
   bit more slick, but you'll get better quality out of the box from
   Stanford's.  
   To avoid crashing while converting frames into YUV format, you will
   need to convert a QuickTime movie with no compression, 256 colors, or
   with video compression and the monitor set to thousands of colors.  As a
   rule, the deeper your color depth, the more memory qt2yuv will take up,
   and the more prone to crashes it will be.  

Good luck!  Contact kevinh at pulua.hcc.hawaii.edu for comments, etc.  For
other solutions and info, keep your eyes on alt.binaries.pictures.utilities, 
alt.graphics.pixutils and other related newsgroups.

       
% Robert Harper                   %   HARPER at FINFUN   %   HARPER at CSC.FI   %
% Finnish State Computer Centre   %      Bitnet       %     Internet      %
% Tietotie 6, 02101 Espoo Finland % Tel 358 0 4572076 % Fax 358 0 4572302 %



More information about the Virology mailing list