AviRip v3.0 - By Mike Negus

This is my third installment in the quest to create an AVI to MPG converter.
The first was the rawrip program that converts the raw file made by DMPEG to a
series of DIB (BMP) files which can be read by Microsoft's Video for Windows,
the full version.  In the complete VFW you can edit, compress and save AVI
files.

The AVIRIP program now works on 8-bit, 16-bit AND 24-bit, UNCOMPRESSED, 
NON-STREAMING AUDIO, AVI files.  What you probably will need to do is 
to uncompress, the AVI files you already have.  To do this you MUST HAVE 
MICROSOFT'S VIDEO FOR WINDOWS full blown editing version.

Note! A 1000+ Frame 24-bit AVI and resulting sequence files will take up 
      about 100+MB.  Yes, that's 100+MB.  If you have a problem with space 
      then buy a bigger hard drive or use VFW to create a 16-bit or 8-bit
      AVI file. 

STEPS to decompressing AVI file:

1.  Load the AVI with the VidEdit program that comes with VFW.
3.  Click on the FILE pull down menu and click on the Save-As option.
	a.  Click on Compression Options.
	b.  Select HARD DISK as the target device.  (no interleaving)
	c.  Select FULL FRAMES as the Video Compression Method.
	d.  Use a different name for your new file.  Do not write over your
	    old one.
	e.  Click on OK to save the file.
4.  You can copy the sound from the AVI and then paste it into the WaveEdit
    program which comes with VFW.  You can save the audio as a wave file
    to be played along with the MPEG you are about to make.
5.  Use the AVIRIP program to rip the AVI file into sequence files.  These
    files are read by CMPEG which will create the MPEG.
6.  Do not run AVIRIP on the root directory since DOS only allows 511 file 
    entries into the FAT there.  Put it into a subdirectory and you can get 
    1000+ sequence files.
7.  Use the batchfile that my program makes.  It is named <yourfile>.bat.  
    CMPEG and the i.ctl file must be in the current directory that the AVI 
    and sequence files are in. The batchfile tells CMPEG to create a XING 
    compatible MPEG.
9.  When CMPEG is finished.  You can play the <yourfile>.mpg with any MPEG 
    player.  I suggest using the VMPEG player.  My batch file will have CMPEG 
    create a XING compatible file but the XING player seems to decode the 
    MPEG into fuzzy images.  VMPEG will play them very fast with little loss 
    of clarity.  If you have saved the audio as a WAV file under the name of 
    <yourfile>.wav in the same directory as the MPG then the XING player will 
    play it along with the MPG.  VMPEG will not.  DMPEG enclosed in this kit
    will also play MPEGs, please refer to its document.
10. Delete the 24-bit AVI and all the TGA files.
    
Please read the CMPEG DOC so that you can understand how to edit the 
batchfile that my program makes to create better MPG files.  You can use 
IPB frame encoding with the IPB.CTL file instead of the I.CTL file.  To make 
a sharper MPEG, change the number in the first line of the i.ctl file from 8 
to some number less (4-5 works well).

My program also creates a sequence listing file for CMPEG to use.  You can 
edit that file, named <yourfile>.txt, to create an MPEG from only those 
files you want.


AVIRIP:

This version of my program has numerous options.  I went a little overboard.
AVIRIP will automatically detect what color depth the uncompressed AVI is
saved as and will create sequence files of the same color depth.  The
available sequence files can be DIBs, TGAs, or RAWs.  DIB files are just
bitmaps and can be used by any MS bitmap editor.  RAW files are like bitmaps
except the image is flipped upside down.  Both DIB and RAW files are only
available in 8-bit and 24-bit color depth.  TGA files are TARGA files
which are trademarked by Truevision (I think).  These are very much like
DIB files with a slight change in the header of the file.  TGA files are
available in 8-bit, 16-bit, and 24-bit flavors. 

CMPEG supports 16, 24 bit TGA and 24 bit RAW.  I tried to get it to use
8-bit RAW and 8-bit PPM but I got a garbled MPG.  My program will allow
you to promote 8-bit uncompressed AVI files to a 24-bit sequence on the
fly.

NOTE:  AVIRIP will only create 16-bit TGA files if it is given a 16-bit AVI 
file.  Also, the promote to 24-bit and lightness options do not work for 
16-bit AVIs. (Maybe it will for version 4.0)

AVIRIP will automatically create a text file that has a list of the sequence
file names to pipe to CMPEG.  If a CMPEG supported sequence was created
then a <yourfile>.bat batch file will be created that can simply be run to
make an MPEG from the sequence.


USING AVIRIP:

To use AVIRIP you need to use the command:
	avirip <filename.avi> [t<type>] [p] [s#] [l#]

filename.avi = The AVI that you want to rip.
t<type> = You have three choices "td" for DIB sequence, "tt" for TGA
	  sequence, "tr" for RAW sequence.  Default is "td".
p = promotes an 8-bit AVI to a 24-bit sequence so that an 8-bit AVI
    can be converted to an MPG.  Default is no promotion.
s# = starting frame #.  "s29" will start at frame 29 counting from 0.  So
     actually it is frame 30 that it starts at.  Frames start at 0 by default.
l# = lightness factor. Range is from 0-255 and lightens the AVI.  I found
     this useful at times so I left it in.  Try a number > 255 and cool
     things happen to the colors of the images.

for example: 

avirip test.avi

Creates DIB files starting at frame 0 w/no lightness factor and no promotion
to 24-bit.  If the AVI is 16-bit then TGA files are created.

avirip test.avi TT P S50 L30

Creates TGA files starting at frame 50 and using a lightness factor of 30.
If test.avi is 8-bit then 24-bit sequence TGA files are created.

Both commands create a test.txt file with a listing of sequence names.  But
the last one creates a batch file to make an MPEG since CMPEG compatible 
TGA files were created.

I had a lot of fun making this program and figuring out the DIB/BMP and TGA 
formats so this is FREE to whoever wants it.  If you have a program that 
creates MPEG's or does what my program does but better AND IS SHAREWARE
then please post it on the INTERNET for others like myself to get and use.

-Mike Negus
E-MAIL: men0348@isc.rit.edu
