⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mpeg2enc.doc

📁 MPEG2视频编解码算法方面的源代码(包括编码和解码)
💻 DOC
📖 第 1 页 / 共 2 页
字号:

                                 mpeg2encode
                                 ===========

                   MPEG-2 Video Encoder, Version 1.1, June 1994

                        MPEG Software Simulation Group
                             (MPEG-L@netcom.com)


Contents:
=========

1. Overview
2. Features and Limitations
3. Usage
4. Interpreting the status information
5. Description of the Encoder Model
6. References


1. Overview
===========

  This is the second public release of our MPEG-2 encoder. It converts an
  ordered set of uncompressed input pictures into a compressed bitstream
  compliant with ISO/IEC 13818-2 DIS [1] (MPEG-2).

  This program will evolve to become: ISO/IEC 13818-5 Software Simulation
  of MPEG-2 Systems, Video, and Audio.


2. Features and Limitations
===========================

 2.1 Features

  - generates constant bit rate streams
  - encoder model based on MPEG-2 test model 5 (TM5) rev. 2 [2]
  - progressive and interlaced video
  - also generates ISO/IEC 11172-2 (MPEG-1) sequences
  - input formats: separate YUV, combined YUV, PPM
  - trace and statistics output
  - verifies user parameter settings are legal within Profile and Level


 2.2 Current limitations

  The encoder currently does not support

  - scalable extensions
  - MPEG-1 integer pel vectors (half-pel is typically 1 dB better anyway) 
    and D frame sequences.
  - checking for maximum number of generated bits per macroblock
  - automatic 3:2 pulldown detection or irregular 3:2 pulldown signaling.
  - intra refresh slices (e.g. low delay)
  - concealment motion vectors 
  - special low delay mode rate control
  - editing of encoded video 
  - variable bit rate encoding
  - scene change rate control
 
3. Usage
========

  The execution template for the encoder is:

      mpeg2encode parameter_file output.m2v

  Coding parameters can be modified by editing the parameter_file. Since the
  parser expects the operating parameters to be on certain line numbers, 
  kindly do not insert or delete lines from the file.

  We have provided a couple of sample parameter files in the par directory.
  It is recommended to use the one closest to your application as a starting
  point for customization.

  The first line of the parameter file is a comment which is inserted near
  the beginning of the MPEG bitstream as a user_data field, and can be 
  used for arbitrary purposes.

  The remaining lines are described below:

 /* name of source frame files */

  A printf format string defining the name of the input files. It has to
  contain exactly one numerical descriptor (%d, %x etc.):

  Example: frame%02d 
  Then the encoder looks for files: frame00, frame01, frame02

  The encoder adds an extension (.yuv, .ppm, etc.) which depends on the 
  input file format. Input files have to be in frame format, containing 
  two interleaved fields (for interlaced video).

 /* name of reconstructed frame files */

  This user parameter tells the encoder what name to give the reconstructed 
  frames. These frames are identical to frame reconstructions of decoders 
  following normative guidelines (except of course for differences caused by 
  different IDCT implementation). Specifying a name starting with - (or just 
  - by itself) disables output of reconstructed frames.

  The reconstructed frames are always stored in Y,U,V format (see below),
  independent of the input file format.

 /* name of intra quant matrix file     ("-": default matrix) */ 

  Setting this to a value other than  -  specifies a file containing
  a custom intra quantization matrix to be used instead of the default 
  matrix specified in ISO/IEC 13818-2 and 11172-2. This file has to contain 
  64 integer values (range 1...255) separated by white space (blank, tab, 
  or newline), one corresponding  to each of the 64 DCT coefficients. They 
  are ordered line by line, i.e. v-u frequency matrix order (not by the 
  zig-zag pattern used for transmission). The file intra.mat contains the 
  default matrix as a starting point for customization. It is neither 
  necessary or recommended to specify the default matrix explicitly.

  Large values correspond to coarse quantization and consequently more
  noise at that particular spatial frequency.

  For the intra quantization matrix, the first value in the file (DC value)
  is ignored. Use the parameter intra_dc_precision (see below) to define
  the quantization of the DC value.
    
 /* name of non intra quant matrix file ("-": default matrix) */

  This parameter field follows the same rules as described for the above 
  intra quant matrix parameter, but specifies the file for the NON-INTRA 
  coded (predicted / interpolated) blocks. In this case the first 
  coefficient of the matrix is NOT ignored.    

  The default matrix uses a constant value of 16 for all 64 coefficients.
  (a flat matrix is thought to statistically minimize mean square error). 
  The file inter.mat contains an alternate matrix, used in the MPEG-2 test
  model.

 /* name of statistics file */

  Statistics output is stored into the specified file. - directs statistics
  output to stdout.

 /* input picture file format */ 

  A number defining the format of the source input frames.
  
  Code  Format description
  ----  ------------------------------------------------------------------
  0     separate files for luminance (.Y extension), and chrominance (.U, .V)
        all files are in headerless 8 bit per pixel format. .U and .V must 
        correspond to the selected chroma_format (4:2:0, 4:2:2, 4:4:4, see
        below).  Note that in this document, Cb = U, and Cr = V. This format
        is also used in the Stanford PVRG encoder.

  1     similar to 0, but concatenated into one file (extension .yuv).
        This is the format used by the Berkeley MPEG-1 encoder.

  2     PPM, Portable PixMap, only the raw format (P6) is supported.


 /* number of frames */

  This defines the length of the sequence in integer units of frames.

 /* number of first frame */

  Usually 0 or 1, but any other (positive) value is valid.

 /* timecode of first frame */

  This line is used to set the timecode encoded into the first 'Group of
  Pictures' header. The format is based on the SMPTE style:

  hh:mm:ss:ff (hh=hour, mm=minute, ss=second, ff=frame (0..picture_rate-1)

 /* N (# of frames in GOP) */

  This defines the distance between I frames (and 'Group of Pictures'
  headers). Common values are 15 for 30 Hz video and 12 for 25 Hz video.

 /* M (I/P frame distance) */

  Distance between consecutive I or P frames. Usually set to 3.
  N has to be a multiple of M.   M = 1 means no B frames in the sequence.
  (in a future edition of this program, M=0 will mean only I frames).

 /* ISO/IEC 11172-2 stream */

  Set to 1 if you want to generate an MPEG-1 sequence. In this case some
  of the subsequent MPEG-2 specific values are ignored.

 /* picture format */

  0 selects frame picture coding, in which both fields of a frame are coded
  simultaneously, 1 select field picture coding, where fields are coded
  separately. The latter is permitted for interlaced video only.

 /* horizontal_size */

  Pixel width of the frames. It does not need to be a multiple of 16. 
  You have to provide a correct value even for PPM files (the PPM 
  file header is currently ignored).
 
 /* vertical_size */

  Pixel height of the frames. It does not need to be a multiple of 16. 
  You have to provide a correct value even for PPM files (the PPM file 
  header is currently ignored).

 /* aspect_ratio_information */

  Defines the display aspect ratio. Legal values are:

  Code    Meaning
  ----    --------------
  1       square pels
  2       4:3 display
  3       16:9 display
  4       2.21:1 display

  MPEG-1 uses a different coding of aspect ratios. In this cases codes
  1 to 14 are valid.

 /* frame_rate_code */

  Defines the frame rate (for interlaced sequences: field rate is twice 
  the frame rate). Legal values are:

  Code  Frames/sec    Meaning
  ----  ----------    -----------------------------------------------
  1     24000/1001    23.976 fps -- NTSC encapsulated film rate 
  2     24            Standard international cinema film rate
  3     25            PAL (625/50) video frame rate
  4     30000/1001    29.97 -- NTSC video frame rate 
  5     30            NTSC drop-frame (525/60) video frame rate
  6     50            double frame rate/progressive PAL 
  7     60000/1001    double frame rate NTSC
  8     60            double frame rate drop-frame NTSC

 /* bit_rate */

  A positive floating point value specifying the target bitrate.
  In units of bits/sec.

 /* vbv_buffer_size (in multiples 16 kbit) */

  Specifies, according to the Video Buffering Verifier decoder model,  
  the size of the bitstream input buffer required in downstream 
  decoders in order for the sequence to be decoded without underflows or 
  or overflows.  You probably will wish to leave this value at 112 for
  MPEG-2 Main Profile at Main Level, and 20 for Constrained Parameters
  Bitstreams MPEG-1.

 /* low_delay */
  
  When set to 1, this flag specifies whether encoder operates in low delay 
  mode.  Essentially, no B pictures are coded and a different rate control 
  strategy is adopted which allows picture skipping and VBV underflows.  
  This feature has not yet been implemented. Please leave at zero for now.

 /* constrained_parameters_flag */

  Always 0 for MPEG-2. You may set this to 1 if you encode an MPEG-1 
  sequence which meets the parameter limits defined in ISO/IEC 11172-2 
  for constrained parameter bitstreams:

    horizontal_size <= 768
    vertical_size   <= 576
    picture_area    <= 396 macroblocks
    pixel_rate      <= 396x25 macroblocks per second
    vbv_buffer_size <= 20x16384 bit
    bitrate         <= 1856000 bits/second
    motion vector range <= -64...63.5

 /* Profile ID */

  Specifies the subset of the MPEG-2 syntax required for decoding the 
  sequence. All MPEG-2 sequences generated by the current version of 
  the encoder are either Main Profile or Simple Profile sequences.

  Code  Meaning                       Typical use
  ----  --------------------------    ------------------------
  1     High Profile                  production equipment requiring 4:2:2
  2     Spatially Scalable Profile    Simulcasting 
  3     SNR Scalable Profile          Simulcasting
  4     Main Profile                  95 % of TVs, VCRs, cable applications
  5     Simple Profile                Low cost memory, e.g. no B pictures

 /* Level ID */

  Specifies coded parameter constraints, such as bitrate, sample rate, and 
  maximum allowed motion vector range.

  Code  Meaning         Typical use
  ----  --------------- -----------------------------------------------
  4     High Level      HDTV production rates: e.g. 1920 x 1080 x 30 Hz
  6     High 1440 Level HDTV consumer rates: e.g. 1440 x 960 x 30 Hz
  8     Main Level      CCIR 601 rates: e.g. 720 x 480 x 30 Hz
  10    Low Level       SIF video rate: e.g. 352 x 240 x 30 Hz

 /* progressive_sequence */
  
  0 in the case of a sequences containing interlaced video (e.g. 
  video camera source), 1 for progressive video (e.g. film source).

 /* chroma_format */

  Specifies the resolution of chrominance data
  Code  Meaning
  ----  ------- ----------------------------------------
  1     4:2:0   half resolution in both dimensions (most common format)
  2     4:2:2   half resolution in horizontal direction (High Profile only)
  3     4:4:4   full resolution (not allowed in any currently defined profile)

 /* video_format: 0=comp., 1=PAL, 2=NTSC, 3=SECAM, 4=MAC, 5=unspec. */
 
 /* color_primaries */

  Specifies the x, y chromaticity coordinates of the source primaries.

  Code   Meaning
  ----   -------
  1      ITU-R Rec. 709 (1990)
  2      unspecified
  4      ITU-R Rec. 624-4 System M
  5      ITU-R Rec. 624-4 System B, G
  6      SMPTE 170M
  7      SMPTE 240M (1987)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -