mpeg1\avi2mpg1_src\ABSTHR_1.H (7278, 2002-09-14)
mpeg1\avi2mpg1_src\ALLOC_0.H (7276, 2002-09-14)
mpeg1\avi2mpg1_src\ALLOC_1.H (7573, 2002-09-14)
mpeg1\avi2mpg1_src\ALLOC_2.H (2054, 2002-09-14)
mpeg1\avi2mpg1_src\Avi2m1v.c (22273, 2002-09-14)
mpeg1\avi2mpg1_src\AVI2M1V.H (1875, 2002-09-14)
mpeg1\avi2mpg1_src\AVI2MP2.C (9857, 2002-09-14)
mpeg1\avi2mpg1_src\Avi2mpg1.c (22031, 2002-09-14)
mpeg1\avi2mpg1_src\AVI2MPG1.H (67, 2002-09-14)
mpeg1\avi2mpg1_src\BITSTRM.H (3145, 2002-09-14)
mpeg1\avi2mpg1_src\BUFFER.C (1900, 2002-09-14)
mpeg1\avi2mpg1_src\COMMON.C (24358, 2002-09-14)
mpeg1\avi2mpg1_src\COMMON.H (12117, 1997-07-19)
mpeg1\avi2mpg1_src\CONFORM.C (6610, 1997-07-19)
mpeg1\avi2mpg1_src\COPYING (18316, 1997-07-21)
mpeg1\avi2mpg1_src\Encode.c (43731, 2002-09-14)
mpeg1\avi2mpg1_src\ENCODER.H (6994, 2002-09-14)
mpeg1\avi2mpg1_src\ENWINDOW.H (7286, 2002-09-14)
mpeg1\avi2mpg1_src\FDCTREF.C (3410, 2002-09-13)
mpeg1\avi2mpg1_src\Global.h (9915, 2002-09-14)
mpeg1\avi2mpg1_src\IDCT.C (3465, 2002-09-14)
mpeg1\avi2mpg1_src\INITS.C (2030, 2002-09-14)
mpeg1\avi2mpg1_src\INPTSTRM.C (14479, 2002-09-14)
mpeg1\avi2mpg1_src\INTERACT.C (2811, 2002-09-14)
mpeg1\avi2mpg1_src\MOTION.C (98707, 2002-09-15)
mpeg1\avi2mpg1_src\MPLEX.C (2056, 2002-09-14)
mpeg1\avi2mpg1_src\MPLEX.H (6141, 2002-09-14)
mpeg1\avi2mpg1_src\MULTPLEX.C (26304, 2002-09-14)
mpeg1\avi2mpg1_src\PREDICT.C (46451, 2002-09-15)
mpeg1\avi2mpg1_src\PSY.C (11273, 2002-09-14)
mpeg1\avi2mpg1_src\PUTBITS.C (1139, 2002-09-14)
mpeg1\avi2mpg1_src\PUTHDR.C (3373, 2002-09-14)
mpeg1\avi2mpg1_src\PUTMPG.C (2226, 2002-09-14)
mpeg1\avi2mpg1_src\PUTPIC.C (8579, 2002-09-14)
mpeg1\avi2mpg1_src\Putseq.c (8334, 2002-09-14)
mpeg1\avi2mpg1_src\PUTVLC.C (3515, 2002-09-14)
mpeg1\avi2mpg1_src\QUANTIZE.C (13972, 2002-09-14)
mpeg1\avi2mpg1_src\RATECTL.C (11522, 2002-09-14)
mpeg1\avi2mpg1_src\Readpic.c (39301, 2002-09-14)
mpeg1\avi2mpg1_src\STATS.C (9913, 2002-09-14)
... ...
Readme for avi2mpg1 ver 1.11
This program is distributed under the GNU copyright, please see the accompanying
file COPYING for details. Please note that only the changes to the original source
code are copyrighted under GNU, except for the the multiplexer portions, which
are also under the GNU copyright. The copyrights for the other two source programs,
the video and audio encoders are detailed in their respective source, as well as the
original distributions.
avi2mpg1 is a simple command line mpeg-1 encoder that runs at the command prompt
under Windows '95 or NT. Copy the file avi2mpg1.exe to any directory in your
path. C:\WINDOWS\COMMAND or C:\WINNT should work for most people.
Invoke the program with the following syntax:
usage: avi2mpg1 [-options] inputfile.avi [inputfile2.avi ...] [outputfile.mpg]
where:
options can be:
-b byterate Where byterate is total system stream
rate in KB/s (default 150)
Valid range = 10 to 5000.
-s bitrate Where bitrate is total system stream
rate in K bits/s (default 1200)
Valid range = 80 to 40000.
YOU CAN ONLY SPECIFY -b OR -s, NOT BOTH!
-a bitrate Where bitrate is audio bitrate in
K bits/s (default 128 K)
Valid values for layer I:
32,***,96,128,160,192,224,256,288,320,352,384,416,448
Valid values for layer II:
32,48,56,***,80,96,112,128,160,192,224,256,320,384
-l layer Where layer specifies which layer
to use, valid values 1 or 2.
(default 2)
-j specifies use joint stereo mode IF
input file contains stereo audio.
Has no effect if audio portion of .avi
is mono. (default non-joint stereo)
-p filename.par specifies the name of a file that contains
additional parameters for the video portion
of the encoder.
** please note that the format of the .par files has changed starting
with version 1.10, see templat.par for details **
-e if avi is corrupt (ie: some frames unreadable)
fake using last frame, bad audio replaced with
zero data.
-n no audio, generates video only (.m1v) file, also
needed if avi does not contain an audio stream.
-y vbv_buffer size in 16K bit multiples, default = 20
-m motion search magnitude, range 0 - 4, default 0,
higher values MAY result in better encoding (depending
on video), but will take SIGNIFICANTLY longer to code.
Try it on a short sample first!
-c hor_size ver_size crop (or expand) to specified horizontal and
vertical size.
-f frame_rate_code force specific mpeg frame rate, regardless of
input video frame rate, implies -n (video only)
-x suppress usage of MMX extensions
-d use double precision math (slower)
-q fast quantization (less accurate)
-t fast motion compensation level, range 0 - 3, default 0 (normal)
-h n put sequence header to every n-th GOP (needed
for some hardware decoders like VELA-research's)
inputfile.avi A windows avi file (you can now specify multiple input
avi files for encoding to a single output file)
constrained to the following parameters:
Horizontal size: < 4096 pixels
Vertical size: < 4096 pixels
Frame rate : 23.976, 24, 25, 29.97, or 30 FPS
10, 12, 12.5, and 15 are also supported,
but upsampled to standard rate.
Colour depth: 16, 24, or 32 bit.
(thousands, millions, millions+)
codec used in file must be installed in windows.
Audio sample rate: 11.025, 22.05, and 44.1KHz
Audio sample size: 8 or 16 bit
Audio channels: 1 or 2
Uncompressed PCM audio only..
outputfile.mpg Optional if only one input file specified, if not specified,
inputfilename with .mpg extension will be created.
inputfile.avi A windows avi file (you can now specify multiple input
avi files for encoding to a single output file)
constrained to the following parameters:
Horizontal size: < 4096 pixels
Vertical size: < 4096 pixels
Note: if dimensions are not a multiple of 16,
then frame data will be padded out to a multiple
of 16 with resulting black bands around picture.
Frame rate : 23.976, 24, 25, 29.97, or 30 FPS
10, 12, and 15 FPS are upsampled.
Colour depth: 8, 16, 24, or 32 bit.
(palletized, thousands,
millions, millions+)
codec used in file must be installed in windows.
Audio sample rate: 11.025, 22.05, and 44.1KHz
Audio sample size: 8 or 16 bit
Audio channels: 1 or 2
Uncompressed PCM audio only.
outputfile.mpg Optional if only one input file specified, if not specified,
inputfilename with .mpg extension will be created.
The optional template.par file contains the same values that the
encoder has hard coded as default values for all other video
encoding parameters. Use this file as your starting point for
experimenting with other values, such as motion search vectors.
See param.txt.
*** WARNING: VIDEO EXCEEDS CPB STANDARD!, if you get this warning during video
encoding, your video exceeds the Constrained Parameter Bitstream standard, and
may not be playable on many mpeg-1 players, either software or hardware.
Although many players can play mpeg-1 with higher than CPB bitrates,
few are capable of higher resolutions than SIF (352x288).
Example 1: avi2mpg1 test
This example will encode an .avi file "test.avi" located in the
current directory to test.mpg, at 150KB/sec total data rate
with audio at 128Kb/sec.
Example 2: avi2mpg1 -v file1.avi file2.avi file3.avi result.mpg
This example will encode 3 input avi's (file1, file2, and file3)
to a single mpeg "result.mpg" with VideoCD parameters.
You will need to make sure that the current directory has enough room for the
temporary files the encoder will produce, in other words, approximately twice
the space needed for the resulting .mpg file.
Credits:
This program is basically the combination of the video encoder by the
MPEG Software Simulation Group, available from:
"http://www.creative.net/~tristan/MPEG/mssg/mpeg2vidcodec_v12.tar.gz"
the ISO audio encoder, available from:
"ftp://ftp.iuma.com/audio_utils/converters/source/mpegaudio.tar.Z",
and Christoph Moar's systems stream multiplexer, available from:
"ftp://ftp.informatik.tu-muenchen.de/pub/comp/graphics/mpeg/mplex/mplex-1.1.tar.gz".
Note: this file has apparently been removed from this web site. I suggest doing
a search for "mplex".
into a single program to process windows .avi files. My goal was to create a
simple, one step program consisting of a single executable file with no required
.dll's, bit tables, or configuration files, making it extremely easy to use (provided
you are familiar with using command line programs).
My own use of MPEG-1 consists primarily of compressing 320x240x29.97FPS files captured
with a 'miro DC20 MJPEG capture board, to 150KB/sec with 128Kb audio .mpg streams for
burning to CD. As such, the default values for the program are obvious. I have
used the encoder extensively to encode avi files of the above nature with no
problems. You may encounter some problems using avi files that differ from the above.
QUALITY:
General Recommendations:
The quality of your original source is extremely important! VHS video
tape is generally not sufficient (very noisy and 220 lines horizontal
resolution or less!!!). If you use live capture from a video
camera, make sure you have LOTS of light. Any noise in the video will
seriously degrade the encoded mpeg quality. This is true for all
mpeg encoders!
PLEASE NOTE: although this encoder accepts avi files with less than 24 FPS,
24 bit video and less than 44.1KHz 16 bit audio, you aren't getting the full
value of MPEG compression in these cases. Particularily if the video was
highly compressed by another windows codec. Internally, the encoder simply
upsamples the avi file to 24 bit video at 24 or higher FPS, and the audio
is upsampled to 44.1Khz 16 bit. If your capturing the video yourself, try
doing it at the maximum rate/resolution your equipment is capable of. The
general rule for maximum quality is keep your source file as uncompressed
as possible throughout all capturing and editing phases. Let the final
compressor (MPEG in this case) do all the compression.
BUGS:
Some combinations of parameters and certain video streams will result
in vbv_buffer overflows or underflows. If this occurs, you will get a
count of the number of times it has occured at the completion of the video
stream encoding. This results from the video rate control mechanism
failing to maintain the video rate. An mpeg file will still be generated,
and is still playable by most players (I haven't found any that can't).
The most likely result will be a loss of audio/video sync. You can try
adjusting the vbv_buffer_size using the -y parameter.
Changes:
4/04/1997 - Ver 1.0 - Initial Release - John Schlichther
7/15/1997 - Ver 1.1 - Added support for 8 bit audio
at 11.025, 22.05, and 44.1 KHz rates
7/19/1997 - Ver 1.2 - improved low-pass filtering for 11025 and 22050 audio
- added 8 bit palletized video
- corrected chroma subsampling
- added option to specify system stream data rate in
K bits/s.
- added option to read in video encoding parameter file
7/30/1997 - Ver 1.3 - added option to handle avi's with bad data, ie:
replace bad frames with previous good one. (-e)
- added option to generate video only file (-n)
- added suppport for 10, 12 and 15 FPS video, frames
are duplicated to generate standard MPEG frame rate.
8/04/1997 - made options case insensitive
- handles video with odd pixel sizes (pads with blanks
to even pixel size hor and vert.
- changed intermediate file names to be based on output
filename instead of input file name.
- open max size up to 704 x 480
- increase max bit rate up to 4000K bit/sec
- decreased min bit rate down to 80K bit/sec
- added user control of vbv_buffer_size
- added motion search magnitude control (-m)
8/14/1997 - Ver 1.4 - bug fixes for VideoCD stream creation
- add size cropping option (-c x_size y_size)
- added force frame rate option (-f)
- open max size up to 720 x 480
11/19/1997 - Ver 1.5 - open max size limit to mpeg-1 limit, 4096x4096
- dynamically allocated memory for U and Y buffers
in readpic routine
- open max data rate up to 40,000K bit/sec
- report audio encoding progress in %
3/14/1999 - Ver 1.6 - added code by Adam Baker
to handle
multiple input avi files.
- minor tweaks to bitrates to minimize audio/video sync
problems
3/29/1999 - Ver 1.7 - fixed minor bug in audio code which would cause
a GP fault on some machines with certain avi source
files at end of audio encoding, preventing generation
of a multiplexed mpg file.
- added 12.5 to 25 fps upsampling rate
- added MMX support by Ron Grenier to dist1 routine in motion.c
- added -x switch to suppress MMX optimizations
10/01/1999 - Ver 1.8 - added MMX support by Ron Genier to fdct routine
- added 3DNow suport by Ron Grenier to dist1 routine
- changed chroma subsampling to FIR algorithm, should give
better colour in detailed areas
3/03/2000 - Ver 1.9 - added blur filter by Thomas Hieber (thieber@gmx.net)
- option -r
- added much more MMX code by Gilles Mouchard, including:
- option -q has been added to activate a less
accurate but much faster quantization
- option -t 0..4 has been added to decrease work
done in computing distance during
motion compensation
- disabled -v option (VideoCD), use avi2vcd instead,
available from www.mnsi.net/~jschlic1
5/06/2000 - Ver 1.10 - added "write sequence header to every GOP"-feature
- option -h wn
- initialization file *.par is now searched for in the
Windows directory and the order of options is irrelevant
(entwicklung@reetcom.de - Volker Bartheld)
7/10/2000 - ver 1.11 - fixed palletized video support
For the latest revision check out http://www.mnsi.net/~jschlic1.
Compiling:
The source code was compiled using MicroSoft Visual C++ 5.0, to
recompile, create a new project of the type "Win32 Console
Appplication". Add all the .c and .h files to the project, and
under the Project Settings menu, under the Link tab, add
vfw32.lib to the object/library modules list.
WARNING: Don't compile with version 6.0 of Visual C++. This results in
an executable which crashes with certain combinations of input videos
and computer configurations, the source of which has not been determined.
This was a problem with version 1.9. For version 1.10 I have gone back
to using Visual C++ 5.0 for avi2mpg1.
jschlic1@mnsi.net