1 MPEG MPEG compression and decompression SYNOPSIS $ mpeg [-d] [-NTSC] [-CIF] [-QCIF] [-PF] [-NPS] [-MBPS mbps] [-UTC] [-XING] [-DMVB] [-MVNT] [-a StartNumber] [-b EndNumber] [-h HorizontalSize] [-v VerticalSize] [-f FrameInterval] [-g GroupInterval] [-4] [-c] [-i MCSearchLimit] [-o] [-p PictureRate] [-q Quantization] [-r Target Rate] [-s StreamFile] [-x Target Filesize] [-y] [-z ComponentFileSuffix i] ComponentFilePrefix1 [ComponentFilePrefix2 ComponentFilePrefix3] 2 DESCRIPTION Mpeg is a multimedia image sequence compression/decompression program that performs MPEG encoding and decoding. 2 OPTIONS -NTSC indicates that the source frame size for the Luminance component is 352x240 and for the Chrominance components is 176x120. This is the default size. -CIF indicates that the source frame size for the Luminance component is 352x288 and for the Chrominance components is 176x144. -QCIF indicates that the source frame size for the Luminance component is 176x144 and for the Chrominance components is 88x72. -PF indicates that the component sizes specified by -h and -v are not multiples of 16 and furthermore that the input files (or output files) should be exactly that specified by the component size -h and -v (or as read from the compressed stream). Otherwise the input and output files will be the component size rounded up to a multiple of 16 in each dimension. -NPS The NPS option allows the encoder to encode without having the restriction that the last macroblock in a slice cannot be skipped. For coding purposes, the first macroblock in a slice must be coded, although the decoder will probably handle that case as well. -MBPS This specifies the macroblocks per slice. If left unspecified then the number of macroblocks per slice is the number of macroblocks on one row of the image. -UTC Forces the frame number of the image to match the Group-of-Pictures time code. Only useful for the decoder. -XING enables XING compatible encoding for intra-frame only files for the XING decoders. May not be robust, but eventually XING encoders and decoders will become more MPEG compatible. This specifies 160x120 encoding (apparently the defacto) for XING decoders. If you wish to overide the 160x120 encoding for XING image format, use the -h and -v options after the -XING option. By default -PF is always selected with -XING option. -DMVB denotes Dynamic Motion Vector Bounding. Should reduce the overall bits spent in the motion vectors if set. Generally doesn't do that much for the default settings, but changing the search limit will automatically enable the dynamic motion vector bounding feature. -MVNT disables the motion vector telescoping. Generally telescoping is a big gain when the search window is small, though if the search window grows large, telescoping may not be beneficial. -a denotes the following value to be the start of the filename index [inclusive]. Defaults to 0. -b denotes the following value to be the end of the filename index [inclusive]. Defaults to 0. -d enables the decoder. The only options useful for the decoder are the filename specifications and the -NPS, -UTC commmands; the rest of the command-line information is used for encoding. -h is the horizontal size of the picture in terms of the luminance component, used for a non -NTSC, -CIF, -QCIF filesize. See the preceding note about -PF about the dimensions of the file relative to that of the component. -v is the vertical size of the picture in terms of the luminance component, used for a non -NTSC, -CIF, -QCIF filesize. See the preceding note about -PF about the dimensions of the file relative to that of the component. -f is the number of interpolated frames between each intra/predicted frame. FrameInterval-1 is the number of interpolated frames within each frame interval. -g is the number of frame intervals per group-of-pictures. With a group interval of 1 then there are no predicted frames. The value GroupInterval-1 is the number of predicted frames in each group of pictures. -4 is used to DC Intraframe mode where only the DC components of each picture block is coded. -i is the diameter of the motion estimation search. The diameter must be be positive. The default value is 15 for a search window of approx (+- 7.5, +- 7.5). The motion estimation is telescopic for frame distances greater than 1 (thus having a greater effective range). The telescopic motion estimation can be turned off by the -MVNT flag. This option can now have a value greater than 15 but less than approximately 960. For large values the estimation becomes very slow. -o signals that the program interpreter will read the control algorithms from the standard input. -p specifies the picture rate by a code directly placed into the stream. It must be a number between 0 and 8. (default 5=30Hz). -q gives a value for the quantization not in the presence of rate control (rate control automatically changes the quantization values). If rate control is specified, this parameter gives a value for the initial quantization of the first frame (which the program usually takes an educated guess at). -r specified a rate for the coded stream. If this is enabled, a buffer model is used to limit the size of the coding stream. Note this is given in bits per second. -s specifies the filename to store the coded image. If unspecified it defaults to ComponentFilePrefix0.mpg. -v designates that quantization decisions are to be written to standard output. This is the verbose mode. -x gives a target filesize for the compressed stream. This overrides the rate option -r, if specified. This is specified in bits. The actual implementation of this technique is through calculating the equivalent bit-rate. Since the buffer usually has some contents at the end of coding, the final filesize is larger than actually designated. -y enables the double-precision floating point Reference DCT. The default is the Chen DCT. -z denotes the component file suffixes in sequential order. For example -z .y.clr -z .u.clr -z .v.clr indicates that the luminance and the two chrominance files end with a suffix of &.y.clr, &.u.clr, and &.v.clr, in that order. If unspecified, the suffixes default to &.Y, *.U, and &.V. ComponentFilePrefix must be specified. In general, the other component files share the same prefix and will default to ComponentFilePrefix1 if not explicitly specified. However, in some cases the prefix is what changes in the file and we can specify this individually. 2 EXAMPLES To encode a set of raw raster scan YCbCr (also known as digital YUV) files with dimension 352x240 Y, 176x120 U,V, with labels, hello0.Y hello0.U hello0.V, hello1.Y hello1.U hello1.V, &..., hello12.Y hello12.U hello12.V through the mpeg encoder, type $ mpeg -a 0 -b 12 hello -s hello.mpg This creates the output file hello.mpg. In order to decode such a file into a sequence of image files with prefix goodbye, type $ mpeg -d -s hello.mpg goodbye The output will be placed in the files goodbye0.Y goodbye0.U goodbye0.V, goodbye1.Y goodbye1.U goodbye1.V, &..., goodbye12.Y goodbye12.U goodbye12.V. These image sequences can be displayed by the cv program. The image sequences can also be converted to ppm and back through the programs cyuv2ppm and ppm2cyuv Those utility programs available by anonymous ftp from havefun.stanford.edu:pub/cv/CVv1.2.1.tar.Z. There are more options within an internal program interpreter. Please see the accompanying documentation in doc.ps for more details. 2 FTP mpeg is available by anonymous ftp from havefun.stanford.edu:pub/mpeg/MPEGv1.2.tar.Z. 2 BUGS Somewhat slower than many commercial implementations. Please inform the author at achung@cs.stanford.edu if any bugs are found. 2 AUTHOR Andy Hung 2 VMS_Port Patrick Moreau - CENA/Athis-Mons (France) pmoreau@cena.dgac.fr moreau_p@decus.fr