home *** CD-ROM | disk | FTP | other *** search
-
-
- =======================================================================
- =======================================================================
-
- Easy_MPEG Version 1.03 - MPEG for the masses...
-
- =======================================================================
- =======================================================================
-
-
-
- by ME: *******************************************************************
-
- Scott Tribbey
- 885 N.W. 45th Street
- Pompano Beach FL, 33064
-
- or
-
- 4600 Glenwood Drive
- Coconut Creek Fl, 33066
-
-
- Internet Address: secrd2@gate.net OR TRIBB@DELPHI.COM
-
-
- If you have any problems, suggestions, or would just like to say thanks,
- feel free to contact me. It would be nice to hear that this is useful
- to someone aside from myself.
-
-
-
- CREDIT: ***************************************************************
-
- This package is the result of the combined effort of a number of
- talented programmers (including me). I wrote this Arexx program in
- order to make MPEG easier to use for myself, and accessible to those
- who might wish to use it like any other WorkBench program. The
- arprexxlib.library was of great help in accomplishing this goal.
-
- This is my first Arexx program. Although I have programmed in "C" for
- years now, if I wrote this in "C", it would have taken much longer,
- and been a much bigger program. Also, the Arexx program is easier
- to modify for me and anyone else who has special needs.
-
- This is a great example of the power that can be had using Arexx.
- Do yourself a favor... LEARN IT!!!
-
-
-
- WHATISIT: *************************************************************
-
- Easy_MPEG.rexx is an Arexx program that will automatically generate
- MPEG format video files from a sequence of IFF frames that have been
- generated or are being generated by a rendering program or other graphics
- application. Easy_MPEG sports an Intuition interface for ease of use
- and easily recovers after being interrupted.
-
- If 100 to 1 compression whets your appetite, read on...
-
- Also note that programs like this are only beginning to come out on other
- platforms like the PC. In fact XING Technology Corp. has one for the PC
- that is selling for around $1000, gimme a break!
-
- I haven't even seen one for the MAC yet. Just another reason that Apple
- was stupid for not including a command line interface in their operating
- system. Us Amiga people can use the Unix stuff almost without
- modification while the MAC mavens have to wait for someone to write a
- nice little interface for it and then pay through the nose to get it.
-
-
- DISCLAIMER: ***********************************************************
-
- +----------------------------------------------------------------------+
- | |
- | D I S C L A I M E R N O T I C E |
- | |
- | I make no warranty, |
- | express or implied, or assume any liability or responsibility for |
- | accuracy, completeness or usefulness of any information, appara- |
- | tus, product or process disclosed, or represent that its use will |
- | not infringe privately-owned rights. Mention of any product, its |
- | manufacturer, or suppliers shall not, nor is it intended to, imply |
- | approval, disapproval, or fitness for any particular use. I retain |
- | the right to use and disseminate same for any purpose whatsoever. |
- | |
- +----------------------------------------------------------------------+
-
- In other words...
-
- If you should happen to run this program on a computer used by
- the defense department to target nuclear warheads and the system
- goes berzerk sending 1500 megatons of kaboom down on Sadaam Husein's
- head... It's not my fault. ( not that he would be a loss )
-
- Or...
-
- If anything bad happens when using this program, it's not my fault
- I will not be held responsible. Use this software at your own risk.
-
- However, I can say that no one or thing has been injured due to the
- use of this software up to this point.
-
-
-
-
- COPYRIGHT: ************************************************************
-
-
- Easy_MPEG.rexx Version 1.00
- ==============================
-
- Copyright (C) 1994
-
- by
-
- Scott A. Tribbey
-
- ( all rights reserved )
-
-
- This program is not Public Domain, it is Freeware. I charge no fees
- for its use by private individuals. However, it is not to be sold
- in any form without prior written authorization from Scott A. Tribbey.
-
- This software may not be used for any commercial venture without
- prior written consent from Scott A. Tribbey
-
-
-
- REQUIREMENTS: *********************************************************
-
- Amiga - 68020 or better with 68881 or better FPU
- Actually I'm not sure about this, but I've never tried
- running this on anything less. Even if you can run it
- on a 68000, it will crawl, and so will your graphics
- program.
-
- AREXX - If you don't have Arexx then don't bother reading on. Just
- go out and get the AmigaDOS 3.1 upgrade, and then continue
- reading
-
- Memory - Gobs... I would suggest at least 6 MEGS of ram. More is
- always better. I have 14 MEGS and I'd like more.
- For even better results use a virtual memory program like
- VMM or Gigamem if you have a 68030 or '040.
-
- Priority - The Easy_MPEG program must be run at a priority equal to or
- higher than the rendering program that is producing the
-
- IFF files. For instance, set the rendering program for a
- priority of -5 and leave the shell where Easy_MPEG will
- be run from, at the standard priority of 0.
-
- Stack - I'm not really sure what the stack requirements are for
- mpeg_encode program, but just to be safe, I run it with a
- stack of 20000 bytes. I suggest you do the same.
-
- Run & Wait - Easy_MPEG makes use of these AmigaDOS commands, so
- make sure they are in your C: directory...
- They certainly should be!
-
- rexxsupport.library - This library is also required. It is a standard
- part of the Arexx installation so you should
- already have it in you LIBS: directory
-
- rexxarplib.library - This is used to create the GUI for Easy_MPEG thus
- making it easy. It should be in your LIBS: directory
- See below for more.
-
- ixemul.library - The runtime library needed for executables compiled by the
- GCC C compiler. This library is required by mpeg_encode
-
-
-
-
- INCLUDED PROGRAMS: *******************************************************
-
- Included in this archive are several files from other archives that are
- necessary for this package to be useful.
-
- mpeg_encode - The freely redistributable MPEG encoder from Berkley
- University compiled for the Amiga with the GNU
- GCC 2.5.8 'C++' compiler
-
- There are other MPEG encoder engines out there such as
- the one from Stanford University, but I chose the
- Berkley version for its ability to encode the MPEG
- file in chunks (GOPS), making it perfect for compressing
- an animation while it's being generated.
-
- (I modified this version slightly to get rid of an
- annoying problem the program was having while
- searching for a Unix shell file)
-
- 24toPPM - Actually, I don't know where this came from, but it is
- about the fastest 24 bit IFF to PPM converter I've seen
- This program is used to convert the IFF files to PPM
- format since this is the image format that the
- mpeg_encode program expects.
-
- ILBMtoPPM - This was taken from the NetPBM package, another excellent
- piece of software. It will convert IFF files of any format,
- but it is much slower than 24toPPM It is here because the
- program uses it if 24toPPM fails due to the input frames
- being something other than IFF-24 format, like HAM8.
-
- rexxarplib.library - An absolutely excellent library of functions for
- arexx programs. My applause to W.G.J. Langeveld
- at the Stanford Linear Accelerator Center for
- really adding to the usefulness of Arexx.
-
-
- SETUP: ****************************************************************
-
- 1 - COPY rexxarplib.library TO LIBS:
- 2 - COPY ixemul.library TO LIBS:
- 3 - COPY all the other files to a directory of your choice.
-
- Gee... that was easy
-
-
-
- DESCRIPTION: **********************************************************
-
-
- So, maybe you've seen those MPEG encoders floating around the networks
- and you're wondering to yourself... "Hmmm, what the heck is MPEG?"
-
-
- What is MPEG and why should you use it?
-
- Well, MPEG is quickly becoming a standard in motion video compression.
- MPEG is a lossy compression scheme based on a technology similar to
- that used for JPEG still image compression. However, MPEG is also
- much more sophisticated than JPEG for motion compression and allows
- for compression ratios of 50,100,150 to 1, or more. The disadvantage
- to MPEG is that it is extremely computationally intensive and for that
- reason does not play back at fast frame rates without dedicated
- decompression hardware. It will play back on the Amiga 4000/040 at up
- to 20 frames per second with small frames. However, the play back
- hardware necessary to view the MPEG files is becoming more available.
- Commodore's own CD32 MPEG module is one, and the Reel Magic card for the
- P.C. (yech!) costs only around $300 for the Lite version. So, MPEG might
- be worth looking into if you would like to create some long animations
- and don't have a 1.5 Gigabyte hard drive.
-
-
-
- USAGE: ****************************************************************
-
-
- Easy_MPEG is intended to be just that... Easy. I will explain some of
- the more esoteric features below, but this is not intended to be an
- exhaustive explanation of the fine points of MPEG compression. The
- intuition interface of Easy_MPEG allows the user to adjust most of the
- basic parameters for making an MPEG file and a few of the high level
- compression options for those a bit more bold.
-
-
- First... how to get started.
-
- Easy MPEG is launchable from the shell with command line parameters.
- If no parameters are given, it will present a nice window full of
- gadgets for the user to enter data in.
-
- Not all of the available parameters can be entered from the command line
- at this time, because I intended for this to be an easy to use program
- with an Intuition interface. However, if you wish to change some of the
- options like PATTERN and Quantization, then you can change them from the
- Intuition interface, interrupt the program and then call it back up
- with command line parameters for the basic framename and such. I suppose
- this would be useful if you want to call Easy_MPEG from some other script.
-
- REMEMBER TO SET THE SHELL STACK TO AT LEAST 20000 USING THE STACK COMMAND.
-
- Command line parameter launch:
- ==============================
-
- Usage: rx Easy_MPEG Base_Frame_Name Start End Xdim Ydim
- OutFileName Delay DelOldFrames
-
- Example: rx Make_MPEG dh0:IFF/Frame. 0000 0030 352 240 Movie 30 YES
- creates Movie.mpg from the files
- dh0:IFF/Frame.0000 through dh0:IFF/Frame.0030
- resolution is 352 by 240, directory scanning every 30 sec.
- old frames will be deleted
-
- NOTE:
- Typing rx Easy_MPEG ? will print a usage example like that above
- and exit.
-
-
- Stay tuned for the meaning of these options...
-
-
-
- Intuition interface launch:
- ===========================
-
- To start the program, just open a shell, CD to the Easy_MPEG directory
- and type 'rx Easy_MPEG' at the prompt
-
- After a short delay, you will see a display of information in the shell
- window, and and intuition interface window will pop up with numerous gadgets.
-
- After clicking a gadget or entering data into a string gadget, the status
- display in the shell window will update, displaying the current settings
- the program will use to operate.
-
-
- The Gadgets...
-
- Frame Name: This gadget is used to enter the BASE frame name for the IFF
- files that are to be encoded. Easy_MPEG expects that the
- output files will be something of the form BlahBlah.000
- where BlahBlah can be any combination of letters, numbers,
- and punctuation and 000 can be any number as long as the
- program that produces the frames numbers them sequentially.
-
- In other words, the program expects to see a series of frames
- like Pic.00000 Pic.00001 Pic.00002 .... Pic.00356
-
- If your graphics program doesn't do that (most of them do) then
- you could write an Arexx program to handle it for you.
-
- The numbers don't have to start with 0, it could be anything...
- 0012, 05, 000000567, etc.
-
- Also, the period separating the name and the number is not
- necessary, it's just how some programs number their output
- frames.
-
- Now the important thing to remember here is that this gadget
- only wants the BASE frame name not the number portion. So an
- example might be Pic. or DinosaurFrame or Stupid_Pic_No.
-
- Notice how the 0000 is not included at the end of the
- frame name.
-
- Input Dir: This gadget is where you enter the directory where the frames
- exist or are going to be saved when they are generated.
-
- This should be self explanatory. An example might be
-
- Imagine:Projects/BigGiant.imp/RayTrace.pix/
-
- Remember to include the "/" at the end of the string when
- typing directly into this gadget.
-
- NOTE: BECAUSE OF AN IDIOSYNCRACY IN THE MPEG_ENCODE PROGRAM,
- THE INPUT FILES MUST RESIDE AT LEAST ONE DIRECTORY LEVEL DOWN
- FROM THE ROOT DIRECTORY. IN OTHER WORDS, HAVING YOUR IFF
- FILES IN "WORK:INPUT/" IS OKAY, BUT HAVING THEM IN "WORK:" IS
- NOT. THIS ALSO GOES FOR ASSIGNMENTS. IF YOUR FILES ARE IN
- "DH0:FILES/" WHICH IS ASSIGNED TO "ANIMATION-FRAMES:", USE
- THE ACTUAL PATH NOT THE ASSIGNMENT!
-
- THE PROBLEM IS THAT THE MPEG_ENCODE PROGRAM PLACES A "/" AT
- THE END OF ITS INPUT DIRECTORY PARAMETER WHEN SEARCHING FOR
- FILES. SINCE DH0:/ MEANS NOTHING TO AMIGADOS, THIS CAUSES
- THE PROGRAM TO FAIL.
-
-
- File
- Requester: Aren't you glad I included this. You can use the File requester
- to find the frame name and input directory your looking for.
- Just remember to backspace over the numeric portion of the
- name before pressing OK. Do not just double click on the file
- name.
-
-
- Start Frame: This is where you enter the string representing the numeric
- portion of the first frame to be compressed. In this gadget,
- 0000 is not equivalent to 00. The program uses the number and
- the length of the string to properly format the file names it
- is looking for. If your program puts out file names that have
- four digits at the end, then enter four digits in this gadget.
-
-
- End Frame: This is where you enter the string representing the numeric
- portion of the last frame to be compressed. The number of
- digits entered must be equal to the number of digits entered
- in the Start Frame gadget.
-
-
- Resolution X: This is where the Horizontal resolution of the output frame
- must be entered. For instance, 128... 160... 352..., etc.
-
- Y: Vertical resolution is entered here. 96, 120, 240, etc.
-
- Common MPEG resolutions are 128x96, 160x120, and 352x240(SIF)
- 352x240 is the standard NTSC video resolution for MPEG
-
- NOTE: HORIZONTAL AND VERTICAL RESOLUTIONS MUST ALWAYS BE
- MULTIPLES OF 16 BECAUSE OF THE WAY THAT THE MPEG PROCESS
- ENCODES INFORMATION. IF THE RESOLUTION IS NOT A MULT.
- OF 16, IT'S NOT FATAL, THE ENCODER WILL JUST TRUNCATE
- PORTIONS OF THE FRAME.
-
-
- MAKE SURE THAT THE CORRECT DATA IS ENTERED HERE, OR THE MPEG
- FILE WILL BE A MESS.
-
- These numbers are only used during the last stage of the program
- when all the smaller portions of the MPEG file are being combined.
- So if you notice that these numbers are wrong, then interrupt the
- program while it is waiting for frames, start it again and enter
- the correct numbers.
-
-
-
- The next two variables are the only ones that really affect the compression
- level of the program.
-
- Quant. Scale: Quantization Scale is one of those variables controlling a
- more esoteric feature of the compression process. The numbers
- entered in the I, P, and B gadgets must be between 1 and 31.
- Compression is higher for higher numbers, but quality goes down
- as the numbers get higher. There are three separate numbers
- for I, P, and B type frames. Each number affects the
- compression level of the appropriate frame type I, P or B.
- This will be further explained below in the Frame Pattern
- section.
-
- If you have no idea what I'm talking about, use standard
- numbers like 2,4,6 and you'll be just fine.
-
-
- Frm Pattern: Frame Pattern is the repeating pattern that will be used to
- encode the IFF files. This controls the number of frames that
- Easy_MPEG will wait for before encoding a portion of an MPEG
- file called a GOP (Group of Pictures). Be aware that larger
- patterns will cause the mpeg_encode program to use more memory.
- So, if you don't have a lot of memory, I would suggest a pattern
- of no more that four characters. Although you can use only 1
- if you wish. Enter the pattern in capital letters.
-
- There are three different types of frames in an MPEG file.
-
- I frames are the reference frames that MPEG uses to predict
- the motion of objects from frame to frame. This is similar to
- the concept of a key frame in animation. The compression of I
- frames is similar to JPEG compression for still images.
-
- **** THE PATTERN MUST ALWAYS START WITH LEAST ONE I.
-
- P frames are frames that MPEG predicts from previous I frames.
- These frames get significantly higher compression than I frames
- because most of the information for the frame is predicted from
- the previous frame. This can be a disadvantage when a frame is
- filled with fast moving objects. If the P frame can not
- properly locate where a portion of the image should be, then
- small blocks of the object may seem out of place in a particular
- frame. Also, if a very short duration event like the flash out
- of the end of a gun takes place during what is being encoded as
- a series of P or B frames, it will not show up at all, since
- it was not in the previous or succeeding I frames.
-
- B frames are predicted from the previous and following frames.
- B frames achieve even higher compression than I or P. However,
- the same disadvantage exists as for P frames.
-
- **** DO NOT END YOUR PATTERN WITH A B SINCE THE FOLLOWING
- FRAME WILL NOT BE AVAILABLE WHEN THE GOP IS ENCODED.
-
- This option really takes time and understanding to use properly,
- so I've included some example patterns that you can use.
-
-
- IIII - Encodes the MPEG file with only I frames, this will
- provide the highest quality, but lower compression.
- Compression of 20 to 1 is easily attained with this
- pattern.
-
- II - Same as above, but uses less memory during compression.
-
- IP - Achieves greater compression but be careful with
- fast motion.
-
- IPBP - (Default) Still better compression, but once again
- be careful with fast moving objects. I use this
- pattern quite often with excellent results. Using
- Quantization scale numbers of 2,4,6, and this pattern,
- I recently compressed an animation from 11.2 megs to
- 114k with virtually no loss of quality. That's
- 100 to 1 compression for those of you without
- calculators.
-
- IPBBPBBP - This is a standard pattern that I have seen used
- in several different MPEG applications. It will
- require a fair amount of memory though.
-
-
- Enough about this, if you don't understand, than use IPBP as
- your pattern and you should be just fine.
-
-
- HINT HINT ....
-
- Easy_MPEG is excellent for use with Virtual memory systems like
- VMM. Using a VM system with an mpeg encoder allows you to use
- a significant amount of memory for the encoder without having
- to limit the memory requirments of a running rendering program
- like Imagine or Lightwave.
-
-
- Out File: Well, this one's easy. All you need to enter here is the name
- of the MPEG file to be created. The MPEG file will be placed
- in the directory of the original IFF frames with the extension
- .mpg which is the standard extension for Amiga, PC, and Unix
- MPEG files. So if you enter BigGiantMovie in this gadget, the
- MPEG file BigGiantMovie.mpg will be placed in the Input Dir. Of
- course, if you want this file to be used on other platforms,
- it would be best to keep the filename to 8 characters or less.
-
-
- Dir. Scan: This option specifies the amount of time the program will sit
- around waiting before checking to see if enough new frames have
- been generated to produce a GOP. Remember, if your pattern is
- IPBP then four new frames must be complete for the mpeg_encode
- program to produce a GOP. So, if you type 60 into this gadget,
- then the program will check the Input Dir. every 60 seconds for
- the existence of the necessary IFF files.
-
- If your animation program spits out a frame every 30 minutes,
- then don't set your delay for 5 seconds, your just wasting
- processing time. A more reasonable value would be maybe 60 or
- 120 seconds. Also, don't set this parameter for 350000 seconds,
- as you don't want Easy_MPEG sitting around doing nothing for
- 350000 seconds if the last frame just completed rendering.
-
- In the case where the full animation has already been produced,
- the just set this value to 1 and the compression will
- proceed uninterrupted. I would not advise setting this to
- 0 at any time, as it may become difficult to break out of
- the loop.
-
- Actually what Easy_MPEG does is to check for the existence of
- the frame just following the last one in the GOP to be encoded.
- In other words, if Easy_MPEG is waiting for Pic.0000 through
- Pic.0003 then it actually checks to see if Pic.0004 exists
- (although it doesn't have to been complete yet). Easy_MPEG
- then assumes that the previous frames are done and compresses
- them into a GOP. If the last GOP is being produced, then
- Easy_MPEG will check to see if the last frame is actually
- completed before proceeding with the encoding. The GOP files
- will have the extension .gop and are only stored until the
- final MPEG file is produced at which time they are deleted.
-
-
- Del.Old Frames - This gadget will toggle the state of the DelOldFrms line in
- the shell window when pressed. If this option has a YES
- next to it then the original IFF frames will be deleted
- after producing a GOP. This option is great when you want
- to produce a large animation but don't have a huge hard
- drive. However, make sure that you have the MPEG parameters
- just the way you want them, because you'll have to regenerate
- all the frames if you don't get what you want the first
- time. If you're really not sure and have all the hard drive
- space you need, then just set this option to NO and the
- original IFF frames will be left in the Input Directory.
- That way you can try different encoding parameters until
- you get just what you want.
-
- Quit Program - What do you think! Hmmm... I'll just bet the program quits
- if you click this button. The window CLOSE gadget will also
- have the same effect.
-
- Start Scanning - This is it! You've set all the parameters correctly and
- you're ready to go. Press this button and it's all
- automatic. Come back in a few minutes, hours or days and
- Presto!, your MPEG file is complete! You'll notice that
- the Intuition window disappears when you press this button.
-
- From here until the MPEG file is complete, the shell window
- tells you everything. The status display is mainly a
- summary of the parameters you fed to the program, but is
- also tells you how many GOPS have been produced out of the
- total number and the percentage complete.
-
- While Easy_MPEG is waiting for frames, it will occasionally
- print messages telling you what frame it is waiting for.
- During this time it is safe to press the CONTROL-C key
- combination to halt the program. Easy_MPEG will recover
- from this when you run it again. In fact, I envisioned
- that this feature might be used fairly often, so the program
- writes a file called MPEG.settings every time it is run, and
- reads it every time it is started up. This allows you to
- start the program from where you left off without having
- to enter any data. The program will start up with the same
- parameters you entered last time. All you need to do is
- press the Start Scanning button and the program will tell
- you how many GOPS are complete and continue waiting for the
- rest.
-
- When Easy_MPEG has found the frames it is waiting for, it
- will start the encoding process. During this period of time,
- you will see the actual encoding process taking place.
- First of all, the frames all have to be converted to a
- graphics file format called PPM. Then the PPM files are
- fed to the mpeg_encode program. During the encoding
- process, do not interrupt the program. You may have trouble
- starting over where you left off if you interrupt the
- program during any time other then when it is waiting for
- IFF frames.
-
-
-
- Completion - Upon completion, Easy_MPEG will display a little
- "Processing Complete" box with an OK button for you to click.
-
-
-
- NOTE: You will notice that during each session, Easy_MPEG writes a
- file called BlahBlah.param to its home directory. This file
- is a special file that contains all necessary parameters for
- the mpeg_encode program to work. The mpeg_encode program
- uses this file to figure out what to do with the incoming
- PPM files. The name of the .param file is actually the name
- of the Output MPEG file with .param on the end. For instance
- if you specified BigMovie as your Output file name, then the
- parameter file would be called BigMovie.param.
-
- These .param files only take up about 500 bytes or so, but
- as you work with the program more and more, you may want to
- occasionally delete the .param files from the Easy_MPEG
- directory.
-
- The program does not automatically delete them, because they
- serve as a record of the parameters used to create a certain
- MPEG file. This can be useful when experimenting with
- numerous different compression parameters.
-
-
-
-
-
- Conclusion: ***************************************************************
-
- Well, that's about it, I didn't cover everything in detail, but I think it
- should be enough to get most of you going. If you have problems, contact me
- at one of the addresses above.
-
- If you would like further technical details on the MPEG compression scheme,
- or the particulars of the mpeg_encode program from Berkley, the archives
- containing these have been floating around the BBS world for a while.
-
- files worth looking for are;
-
- Amipeg04.lha - MPEG player for AGA/ECS
- mp103.lha - MPEG player for AGA/ECS
- MPEGPLAY_201.lha - MPEG player for AGA/ECS
- MPEG12.lha - Stanford University MPEG encoder
- mpeg_enc.lha - Berkley University MPEG encoder
- BMPEG.lha - Stanford Encoder modified for use with Image F/X
-
- These are all on the Aminet ( Internet )
-
-
-
- Happy MPEGing!... Scott A. Tribbey 1994
-