mpeg_stat


NAME
  mpeg_stat - analyzes MPEG-1 encoded bitstreams

SYNOPSIS
  mpeg_stat [ -all basename ] [ -block_info filename ] [ -dct
  ] [ -end N ] [ -histogram filename ] [ -offsets filename ] [
  -qscale filename ] [ -quiet ] [ -rate filename ] [ -
  ratelength N ] [ -time ] [ -size filename ] [ -start N ] [
  -syslog filename ] [ -userdata filename ] [ -verify ] [
  file_name ]

DESCRIPTION
  mpeg_stat decodes mpeg-1 encoded bitstreams collecting
  varying amounts of statistics.  Errors are sent to stderr,
  basic statistics to stdout.  The basic information is the
  pattern of frames used, number of bytes for each frame type,
  the specified parameters, and lengths of vectors.  For each
  frame type, the average size, compression rate, Q-factor,
  and time to decode are given.  Wherever a filename is
  requested - can be used to denote stdin/out.

OPTIONS
  -all basename : records information from all options
	   (qscale, block_info, etc.) into files with basenames of
	   basename (For wizards, -all foo -block_info bar will
	   record all options BUT -block_info into files of the
	   form foo.*).

  -block_info filename : records information about every block
	   into file filename.  Useful for detailed analysis and
	   to make specifics files for re-encoding (see
	   block2spec).  The format is:

	   frame frame# IPB-type mv-scale temporal_ref

	   slice slice# q-scale

	   block block# IPB-type Q-scale bits block-type
			<vectors-if-any> <cbp> <dct decode>
  Numbering starts at 0 (except slices) and all motion vectors
  are in half-pel units <X Y>.

  -dct : enables the decoded dct values to be output into the
	   block file.

  -end N : causes mpeg_stat to finish collecting statistics at
	   frame N.

  -histogram filename : summaries the overall statisitcs for
	   each frame type into the file.

  -offsets filename : record the offset of every picture, GOP,
	   and slice into file filename.

  -quiet : toggles the display of the frame-types as they are
	   parsed (and custom quantization matrices) [default:
	   on].

  -qscale filename : writes Q factor and custom quantization
	   matrix information into file filename.  The Q-factor
	   and number of blocks of that quality (ignoring skipped
	   blocks) for each type of frame is recorded.

  -rate filename : record the bit rate at every picture (after
	   the first second) into the file filename.  Also collect
	   minimum and maximum bit rate encountered in the summary
	   information.  (Rate is the number of bits used per
	   second, at every frame).

  -ratelength N : Change the measurement period for rate to N,
	   so it will measure the total rate required over any N
	   frame period (after the first N, of course).

  -size filename : stores information about the type (I,P,B)
	   and size of each frame in file filename (one frame per
	   line).

  -start N : causes mpeg_stat to begin collecting statistics
	   at frame N.  (Preceding frames will be parsed, but few
	   statistics are collected (the system layer counters
	   will sill be running).) -syslog filename : describes
	   the parsing of the system layer into the file filename.
	   Note this option is not turned on by -all.  -time :
	   prints the amount of time total and per-frame type
	   averages to decode.  This will give an estimate of time
	   in a software player, but is not generally useful, so
	   it is off by default.  -userdata filename : dumps user
	   data fields into a file.  Can be read in ASCII.  -
	   verify : does more work to check the validity of the
	   sequence.  Slows down the statistics, so it is
	   optional.

EXAMPLE
  Decoding the flowergarden sequence (mpeg_stat -quiet
  flower.mpg) should produce the following statistics:


  Reading /u/smoot/mpg/flower.mpg

  Frame sequence as to be displayed:
  BBPBBPBBPBBPBBIBBPBBPBBPBBPBBIBBPBBPBBPBBPBBIBBPBBPBBPBBPBBIBBPBBPBBPBBPBBI
  BBPBBPBBPBBPBBIBBPBBPBBPBBPBBIBBPBBPBBPBBPBBIBBPBBPBBPBBPBBIBBPBBPBBPBBPBB


  Searching for constant frame type sequence...pattern
  detected: IBBPBBPBBPBBPBB


  SUMMARY:

  Total Bytes read: 0. Total number of frames: 150.  Length is
  5.01 sec

  Width: 352      Height: 240 Avg. Frame Size: 4786 bytes + 6
  bits  (average rate 1147692.76 bits/sec)

  Total Compression Rate:  1.89 % of uncompressed 24 bit
  images
						  =  0.45 bits per pixel

  Number of Macroblocks [width * height = sum]: 22 x 15 = 330
  per frame Skipped Macroblocks = 4389 (9.46%), Coded
  Macroblocks = 41992 (90.54%)

  Total Time Decoding: 8.611 secs. 0.05721 sec/frame or 17.11
  frames/sec.

  MPEG-Viewer requirements:
		  Pixel aspect ratio of 0.6735
		  Required display speed: 29.97 frames/sec
		  Specified bit rate is 1.00 MBits/sec (2500 *
  400bits/sec)
		  Requested buffer size is 8K ints (16 bits).
		  And the constrained parameter flag is on.       The
  stream meets the constrained parameter requirements.

  Length of vectors in pixels:
		  Horizontal forward vectors, maximum :  39
  average:   6
		  Vertical forward vectors, maximum   :  22
  average:   1

		  Horizontal backward vectors, maximum:  29
  average:   5
		  Vertical backward vectors, maximum  :  16
  average:   1


  Frame specific information:

	  10  I FRAMES, average is:
		  Size: 17323 bytes + 1 bits (24.13%)
		  Compression Rate:  6.84%
		  Q Factor [scales quantization matrix]: 11.15
		  Time to Decode: 0.114039 secs.

	  40  P FRAMES, average is:
		  Size: 8031 bytes + 0 bits (44.74%)
		  Compression Rate:  3.17%
		  Q Factor [scales quantization matrix]: 10.85
		  Time to Decode: 0.075342 secs.

	  100 B FRAMES, average is:
		  Size: 2235 bytes + 4 bits (31.13%)
		  Compression Rate:  0.88%
		  Q Factor [scales quantization matrix]: 15.01
		  50.59% interpolated Macro Blocks
		  Time to Decode: 0.044516 secs.



NOTES
  The analyzer expects MPEG-1 video streams only. It can
  handle multiplexed MPEG streams (video+audio streams), but
  mostly analyzes the video portion.

  Some streams do not end with the proper sequence end code
  and will probably generate an "Improper sequence end code."
  error when done.  In general mpeg_stat attempts to catch and
  alert its user to errors in the stream.  Such errors are
  glossed over in mpeg_play.  Be aware that errors can disturb
  statistics gathering, generating odd results.

  This player can handle XING data files. Be aware that XING
  makes no use of temporal redundancy or motion vector
  information. In other words, they do not use any P or B
  frames in their streams. Instead, XING data is simply a
  sequence of I frames.

HISTORY
  The analyzer is based on the UC Berkeley mpeg_play player by
  Ketan Patel, Brian Smith, Henry Chi-To Ma, and Kim Man Liu.
  It was modified at the Technical University of Berlin,
  Germany, Dept. of Computer Science by Tom Pfeifer, Jens
  Brettin, Harald Masche, Alexander Schulze, and Dirk
  Schubert.  It has been further modified to collect much more
  information by Steve Smoot (UC Berkeley).

BUGS
  No statistics should be collected before the start frame.
  Sometimes system layer streams will indicate that they lack
  proper end codes, when they have them.  VBV size conformance
  is not checked.  Verification is not complete.  Frame
  numbers should probably be in display numbering not stream
  numbering.  Other bugs?  Send mail to <mpeg-
  bugs@plateau.cs.berkeley.edu>.

VERSION
  This is version 2.2, contining some new features since 2.1,
  and several bug fixes.  It is a major change since version
  1.0.

AUTHORS
  Ketan Patel - University of California, Berkeley,
	   kpatel@cs.berkeley.edu

  Brian Smith - University of California, Berkeley,
	   bsmith@cs.berkeley.edu

  Henry Chi-To Ma - University of California, Berkeley,
	   cma@cs.berkeley.edu

  Kim Man Liu - University of California, Berkeley,
	   kliu@cs.berkeley.edu

  Tom Pfeifer - Multimedia systems project -
	   pfeifer@fokus.gmd.de

  Steve Smoot - University of California, Berkeley,
	   smoot@cs.berkeley.edu