{
    "mode": "man",
    "parameter": "ppmtompeg",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/ppmtompeg/1/json",
    "generated": "2026-10-01T17:37:30Z",
    "synopsis": "ppmtompeg [options] parameter-file",
    "sections": {
        "NAME": {
            "content": "ppmtompeg - encode an MPEG-1 bitstream\n\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "ppmtompeg [options] parameter-file\n\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "This program is part of Netpbm(1).\n\nppmtompeg  produces  an  MPEG-1  video  stream.   MPEG-1 is the first great video compression\nmethod, and is what is used in Video CDs (VCD).  ppmtompeg originated in the year 1995.   DVD\nuses  a  more  advanced method, MPEG-2.  There is an even newer method called MPEG-4 which is\nalso called Divx.  I don't know where one finds that used.\n\nThere's technically a difference between a compression method for video and  an  actual  file\n(stream)  format  for  a movie, and I don't know if it can be validly said that the format of\nthe stream ppmtompeg produces is MPEG-1.\n\nMencoder from the \u001b]8;;http://www.mplayerhq.hu\u001b\\Mplayer package\u001b]8;;\u001b\\  is probably superior  for  most  video  format  generation\nneeds, if for no other reason than that it is more popular.\n\nThe programming library \u001b]8;;http://pm2v.free.fr\u001b\\PM2V\u001b]8;;\u001b\\  generates MPEG-2 streams.\n\nUse  \u001b]8;;http://www.mplayerhq.hu\u001b\\Mplayer\u001b]8;;\u001b\\    (not  part of Netpbm) to do the reverse conversion: to create a series of PNM\nfiles from an MPEG stream.\n\nparamfile is a parameter file which includes a list of input  files  and  other  parameters.\nThe file is described in detail below.\n\nTo understand this program, you need to understand something about the complex MPEG-1 format.\nOne  source  of information about this standard format is the section Introduction to MPEG in\nthe \u001b]8;;http://www.faqs.org/faqs/compression-faq/\u001b\\Compression FAQ\u001b]8;;\u001b\\ .\n\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "The -gop, -combinegops, -frames, and -combineframes options are all mutually exclusive.\n\n\n",
            "subsections": [
                {
                    "name": "-stat stat_file",
                    "content": "This option causes ppmtompeg to append the statistics that it write to Standard Output\nto the file statfile as well.  The statistics use the following  abbreviations:  bits\nper  block  (bpb),  bits per frame (bpf), seconds per frame (spf), and bits per second\n(bps).\n\nThese statistics include how many I, P, and B frames there were, and information about\ncompression and quality.\n\n\n"
                },
                {
                    "name": "-quiet _",
                    "content": "causes ppmtompeg not to report remaining time more often than every numseconds  sec‐\nonds  (unless  the  time  estimate  rises, which will happen near the beginning of the\nrun).  A negative value tells ppmtompeg not to report at all.  0 is the  default  (re‐\nports  once  after  each frame).  Note that the time remaining is an estimate and does\nnot take into account time to read in frames.\n\n"
                },
                {
                    "name": "-realquiet",
                    "content": "causes ppmtompeg to run silently, with the only screen output being errors.  Particu‐\nlarly useful when reading input from stdin.  The equivalent of the -quiet  common  op‐\ntion of most other Netpbm programs.\n\n"
                },
                {
                    "name": "-no_frame_summary",
                    "content": "This option prevents ppmtompeg from printing a summary line for each frame\n\n"
                },
                {
                    "name": "-float_dct",
                    "content": "forces  ppmtompeg  to use a more accurate, yet more computationally expensive version\nof the DCT.\n\n"
                },
                {
                    "name": "-gop _",
                    "content": "causes ppmtompeg to encode only the numbered GOP (first GOP is 0).  The parameter file\nis the same as for normal usage.  The output file will be the normal output file  with\nthe suffix .gop.gopnum.  ppmtompeg does not output any sequence information.\n\n"
                },
                {
                    "name": "-combine_gops",
                    "content": "causes  ppmtompeg  simply to combine some GOP files into a single MPEG output stream.\nppmtompeg inserts a sequence header and trailer.  In this  case,  the  parameter  file\nneeds  only to contain the SIZE value, an output file, and perhaps a list of input GOP\nfiles (see below).\n\nIf you don't supply a list of input GOP files is used, then ppmtompeg  assumes  you're\nusing  the  same parameter file you used when you created the input (with the -gop op‐\ntion) and calculates the corresponding gop filenames itself.  If this is not the case,\nyou can specify input GOP files in the same manner as normal input files -- except in‐\nstead of using INPUTDIR, INPUT, and  ENDINPUT,  use  GOPINPUTDIR,  GOPINPUT,  and\nGOPENDINPUT.   If  no  input GOP files are specified, then the default is to use the\noutput file name with suffix .gop.gopnum, with gopnum starting from 0, as the  input\nfiles.\n\nThus, unless you're mixing and matching GOP files from different sources, you can sim‐\nply  use the same parameter file for creating the GOP files (-gop) and for later turn‐\ning them into an MPEG stream (-combinegops).\n\n\n"
                },
                {
                    "name": "-frames _",
                    "content": "This option causes ppmtompeg  to  encode  only  the  frames  numbered  firstframe  to\nlastframe,  inclusive.  The parameter file is the same as for normal usage.  The out‐\nput will be placed in separate files, one per frame, with the  file  names  being  the\nnormal  output  file name with the suffix .frame.framenum.  No GOP header information\nis output.  (Thus, the parameter file need not include the GOPSIZE value)\n\nUse ppmtompeg -combineframes to combine these frames later into an MPEG stream.\n\n\n"
                },
                {
                    "name": "-combine_frames",
                    "content": "This option causes ppmtompeg simply to combine some individual MPEG frames  (such  as\nyou  might  have  created with an earlier run of ppmtompeg -frames) into a single MPEG\nstream.  Sequence and GOP headers are inserted appropriately.  In this case, the para‐\nmeter file needs to contain only the SIZE value, the GOPSIZE value, an  output  file,\nand perhaps a list of frame files (see below).\n\nThe  parameter  file  may specify input frame files in the same manner as normal input\nfiles -- except instead of using INPUTDIR, INPUT, and ENDINPUT, use FRAMEINPUTDIR,\nFRAMEINPUT, and FRAMEENDINPUT. If no input frame files are specified, then the  de‐\nfault  is  to  use  the  output file name with suffix .frame.framenum, with framenum\nstarting from 0, as the input files.\n\n\n\n"
                },
                {
                    "name": "-nice",
                    "content": "ity.  (This is relevant only if you are running ppmtompeg in  parallel  mode.   Other‐\nwise, there are no remote processes).  See 'man nice.'\n\n"
                },
                {
                    "name": "-max_machines _",
                    "content": "This  option  causes ppmtompeg to use no more than nummachines machines as slaves for\nuse in parallel encoding.\n\n"
                },
                {
                    "name": "-snr",
                    "content": "tistics.  Prints SNR (Y U V) and peak SNR (Y U V) for each frame.  In summary,  prints\naverages  of  luminance only (Y).  SNR is defined as 10*log(variance of original/vari‐\nance of error).  Peak SNR is defined as 20*log(255/RMSE).  Note that ppmtompeg runs  a\nlittle slower when you use this option.\n\n"
                },
                {
                    "name": "-mse",
                    "content": "tomatically reports the quality of the images, so there is no  need  to  specify  -snr\nthen.\n\n"
                },
                {
                    "name": "-bit_rate_info _",
                    "content": "This  option makes ppmtompeg write bit rate information into the file ratefile.  Bit\nrate information is bits per frame, and also bits per I-frame-to-I-frame.\n\n"
                },
                {
                    "name": "-mv_histogram",
                    "content": "This option causes ppmtompeg to print a histogram of the motion vectors  as  part  of\nstatistics.   There  are three histograms -- one for P frame, one for forward B frame,\nand one for backward B frame motion vectors.\n\nThe output is in the form of a matrix, each entry corresponding to one  motion  vector\nin the search window. The center of the matrix represents (0,0) motion vectors.\n\n"
                },
                {
                    "name": "-debug_sockets",
                    "content": "This  option  causes  ppmtompeg  to print to Standard Output messages that narrate the\ncommunication between the machines when you run ppmtompeg in \u001b]8;;#parallel\u001b\\parallel mode\u001b]8;;\u001b\\ .\n\n"
                },
                {
                    "name": "-debug_machines",
                    "content": "This option causes ppmtompeg to print to Standard Output  messages  that  narrate  the\nprogress  of the conversion on the various machines when you run ppmtompeg in \u001b]8;;#parallel\u001b\\parallel\nmode\u001b]8;;\u001b\\ .\n\n\n\n"
                }
            ]
        },
        "PARAMETER FILE": {
            "content": "The parameter file must contain the following lines (except when using the  -combinegops  or",
            "subsections": [
                {
                    "name": "-combine_frames",
                    "content": "PATTERN pattern\nThis  statement  specifies the pattern (sequence) of I frames, P frames, and B frames.\npattern is just a sequence of the letters I, P, and B with nothing between.  Example:\n\nPATTERN IBBPBBPBBPBBPBB\n</pre>\n\nSee\n\u001b]8;;#ipb\u001b\\I Frames, P Frames, B Frames\u001b]8;;\u001b\\\n.\n\n\nOUTPUT output file\nThis names the file where the output MPEG stream goes.\n\n\nINPUTDIR directory\nThis statement tells where the input images (frames) come from.\nIf each frame is in a separate file, directory is the directory\nwhere they all are.  You may use . to refer to the current\ndirectory.  A null directory refers to the root directory of the\nsystem file tree.\n\nTo have ppmtompeg read all the frames serially from Standard\nInput, specify\nINPUTDIR stdin\n\n\n\nINPUT  This line must be followed by a list of the input files (in display  order)  and  then\nthe line ENDINPUT.\n\nThere  are three types of lines between INPUT and ENDINPUT.  First, a line may simply\nbe the name of an input file.  Second, the line may be of  the  form  singlestarexpr\n[x-y].  singlestarexpr can have a single * in it.  It is replaced by all the numbers\nbetween  x  and  y inclusive.  So, for example, the line tennis*.ppm [12-15] refers to\nthe files tennis12.ppm, tennis13.ppm, tennis14.ppm, tennis15.ppm.\n\nUniform zero-padding occurs, as well.  For example, the line football.*.ppm  [001-130]\nrefers  to  the files football.001.ppm, football.002.ppm, ..., football.009.ppm, foot‐\nball.010.ppm, ..., football.130.ppm.\n\nThe third type of line is: singlestarexpr [x-y+s], where the line is treated exactly\nas above, except that we skip by s.  Thus, the line football.*.ppm [001-130+4]  refers\nto  the  files football.001.ppm, football.005.ppm, football.009.ppm, football.013.ppm,\netc.\n\nFurthermore, a line may specify a shell command to execute to generate lines to be in‐\nterpreted as described above, as if those lines were in the  parameter  file  instead.\nUse back ticks, like in the Bourne Shell, like this:\n\n`cat myfilelist`\n\n\nIf  input  is from Standard Input (per the INPUTDIR statement), ppmtompeg ignores the\nINPUT/ENDINPUT block, but it still must be present.\n\n\nBASEFILEFORMAT {PPM | PNM | YUV |\nJPEG | JMOVIE} ppmtompeg must convert all input files to  one  of  the  following\nformats as a first step of processing: PNM, YUV, JPEG(v4), or JMOVIE.  (The conversion\nmay  be  trivial  if your input files are already in one of these formats).  This line\nspecifies which of the four formats.  PPM is actually a subset of PNM.   The  separate\nspecification  is  allowed  for backward compatibility.  Use PNM instead of PPM in new\napplications.\n\n\nINPUTCONVERT conversioncommand\nYou must specify how to convert a file to the base file format.  If no  conversion  is\nnecessary, then you would just say:\n\nINPUTCONVERT *\n\n\nOtherwise,  conversioncommand  is  a shell command that causes an image in the format\nyour specified with BASEFILEFORMAT to be written to Standard Output.  ppmtompeg exe‐\ncutes the command once for each line between INPUT and ENDINPUT (which  is  normally,\nbut not necessarily, a file name).  In the conversion command, ppmtompeg replaces each\n'*' with the contents of that line.\n\nIf you had a bunch of gif files, you might say:\nINPUTCONVERT giftopnm *\n\n\nIf you have a bunch of separate a.Y, a.U, and a.V files (where\nthe U and V have already been subsampled), then you might say:\n\nINPUTCONVERT cat *.Y *.U *.V\n\n\nInput conversion is not allowed with input from stdin, so use\n\nINPUTCONVERT *\n\n\nas described above.\n\n\nSIZE widthxheight\n\nwidth and height are the width and height of each frame in pixels.\n\nWhen  ppmtompeg  can  get  this information from the input image files, it ignores the\nSIZE parameter and you may omit it.\n\nWhen the image files are in YUV format, the files don't contain dimension information,\nso SIZE is required.\n\nWhen ppmtompeg is running in parallel mode, not all of the processes  in  the  network\nhave  access to the image files, so SIZE is required and must give the same dimensions\nas the input image files.\n\n\nYUVSIZE widthxheight\nThis is an obsolete synonym of SIZE.\n\n\nYUVFORMAT {ABEKAS | PHILLIPS | UCB |\nEYUV | pattern} This is meaningful  only  when  BASEFILEFORMAT\nspecifies YUV format, and then it is required.  It specifies the sub-format of the YUV\nclass.\n\n\n\nGOPSIZE n\nn  is  the  number  of  frames in a Group of Pictures.  Except that because a GOP must\nstart with an I frame, ppmtompeg makes a GOP as much longer than n as  it  has  to  to\nmake the next GOP start with an I frame.\n\nNormally,  it makes sense to make your GOP size a multiple of your pattern length (the\nlatter is determined by the PATTERN parameter file statement).\n\nSee \u001b]8;;#gop\u001b\\Group Of Pictures\u001b]8;;\u001b\\ .\n\n\nSLICESPERFRAME n\nn is roughly the number of slices per frame.  Note, at least one MPEG player may  com‐\nplain  if  slices  do not start at the left side of an image.  To ensure this does not\nhappen, make sure the number of rows is divisible by SLICESPERFRAME.\n\n\nPIXEL {FULL | HALF}\nuse half-pixel motion vectors, or just full-pixel ones It is  usually  important  that\nyou  use half-pixel motion vectors, because it results in both better quality and bet‐\nter compression.\n\n\n\nRANGE n\nUse a search range of n pixels in each of the four directions from  a  subject  pixel.\n(So the search window is a square n*2 pixels on a side).\n\n\nPSEARCHALG {EXHAUSTIVE | TWOLEVEL |\nSUBSAMPLE | LOGARITHMIC} This statement tells ppmtompeg what kind of search\ntechnique (algorithm) to use for P frames.  You select the desired\ncombination of speed and compression.  EXHAUSTIVE gives the\nbest compression, but LOGARITHMIC is the fastest.\nTWOLEVEL is an exhaustive full-pixel search, followed by a\nlocal half- pixel search around the best full-pixel vector (the\nPIXEL option is ignored for this search technique).\n\n\nBSEARCHALG {SIMPLE | CROSS2 | EXHAUSTIVE}\nThis statement tells ppmtompeg what kind of search\ntechnique (algorithm) to use for B frames.  SIMPLE means\nfind best forward and backward vectors, then interpolate.\nCROSS2 means find those two vectors, then see what backward\nvector best matches the best forward vector, and vice versa.\nEXHAUSTIVE does an n-squared search and is\nextremely slow in relation to the others (CROSS2\nis about half as fast as SIMPLE).\n\n\nIQSCALE n\nUse n as the qscale for I frames.\nSee \u001b]8;;#qscale\u001b\\Qscale\u001b]8;;\u001b\\ .\n\n\nPQSCALE n\nUse n as the qscale for P frames.\nSee \u001b]8;;#qscale\u001b\\Qscale\u001b]8;;\u001b\\ .\n\n\nBQSCALE n\nUse n as the qscale for B frames.\nSee \u001b]8;;#qscale\u001b\\Qscale\u001b]8;;\u001b\\ .\n\n\nREFERENCEFRAME {ORIGINAL | DECODED}\nThis  statement  determines  whether ppmtompeg uses the original images or the decoded\nimages when computing motion vectors.  Using  decoded  images  is  more  accurate  and\nshould  increase  the  playback  quality of the output, but it makes the encoding take\nlonger and seems to give worse compression.  It also causes  some  complications  with\nparallel  encoding. (see the section on parallel encoding).  One thing you can do as a\ntrade-off is select ORIGINAL here, and lower the qscale (see QSCALE if the quality  is\nnot good enough.\n\nOriginal or Decoded? (Normalized)\n────────────────────────────────────────────────────────────────────\nReference   Compression   Speed   Quality I   Quality P   Quality B\nDecoded      1000       1000      1000         969         919\nOriginal       885       1373      1000         912         884\n\n\n\n\n\n\nThe following lines are optional:\n\n\n\n\nFORCEENCODELASTFRAME\nThis statement is obsolete.  It does nothing.\n\nBefore  Netpbm  10.26 (January 2005), ppmtompeg would drop trailing B frames from your\nmovie, since a movie can't end with a B frame.  (See  \u001b]8;;#ipb\u001b\\I Frames, P Frames, B Frames\u001b]8;;\u001b\\  .)\nYou  would have to specify FORCEENCODELASTFRAME to stop that from happening and get\nthe same function that ppmtompeg has today.\n\n\n\nNIQTABLE\nThis statement specifies a custom non-intra quantization table.  If you don't  specify\nthis statement, ppmtompeg uses a default non-intra quantization table.\n\nThe  8 lines immediately following NIQTABLE specify the quantization table.  Each line\ndefines a table row and consists of 8 integers, whitespace-delimited, which define the\ntable columns.\n\n\nIQTABLE\nThis is analogous to NIQTABLE, but for the intra quantization table.\n\n\nASPECTRATIO ratio\nThis statement specifies the aspect ratio for ppmtompeg to specify in the MPEG output.\nI'm not sure what this is used for.\n\nratio must be 1.0, 0.6735, 0.7031, 0.7615, 0.8055,  0.8437,  0.8935,  0.9157,  0.9815,\n1.0255, 1.0695, 1.0950, 1.1575, or 1.2015.\n\n\nFRAMERATE rate\nThis specifies the frame rate for ppmtompeg to specify in the MPEG output.  Some play‐\ners use this value to determine the playback rate.\n\nrate must be 23.976, 24, 25, 29.97, 30, 50, 59.94, or 60.\n\n\nBITRATE rate\nThis specifies the bit rate for Constant Bit Rate (CBR) encoding.\n\nrate must be an integer.\n\n\nBUFFERSIZE size\nThis  specifies  the  value  ppmtompeg  is to specify in the MPEG output for the Video\nBuffering Verifier (VBV) buffer size needed to decode the sequence.\n\nA Video Verifying Buffer is a buffer in which a decoder keeps the decoded bits in  or‐\nder  to  match  the  uneven  speed of the decoding with the required constant playback\nspeed.\n\nAs ppmtompeg encodes the image, it simulates the decoding process in terms of how many\nbits would be in the VBV as each frame gets decoded, assuming a VBV of  the  size  you\nindicate.\n\nIf  you specify the WARNVBVUNDERFLOW statement, ppmtompeg issues a warning each time\nthe simulation underflows the buffer, which suggests that an underflow would occur  on\nplayback, which suggests the buffer is too small.\n\nIf  you  specify the WARNVBVOVERFLOW statement, ppmtompeg issues a warning each time\nthe simulation overflows the buffer, which suggests that an overflow  would  occur  on\nplayback, which suggests the buffer is too small.\n\n\nWARNVBVUNDERFLOW\n\nWARNVBVOVERFLOW\nSee BUFFERSIZE.\n\nThese  options were new in Netpbm 10.26 (January 2005).  Before that, ppmtompeg issued\nthe warnings always.\n\n\n\n\nThe following statements apply only to parallel operation:\n\n\n\n\nPARALLEL\nThis statement, paired with END PARALLEL, is what causes ppmtompeg to operate in  par‐\nallel mode.  See \u001b]8;;#parallel\u001b\\Parallel Operation\u001b]8;;\u001b\\ .\n\n\nEND PARALLEL\nThis goes with PARALLEL.\n\n\nPARALLELTESTFRAMES n\nThe  master  starts  off by measuring each slave's speed.  It does this by giving each\nslave n frames to encode and noting how long the slave takes to finish.  These are not\njust test frames, though -- they're real frames and the results  become  part  of  the\noutput.   ppmtompeg  is  old  and measures time in undivided seconds, so to get useful\ntimings, specify enough frames that it will take at least 5 seconds to  process  them.\nThe default is 10.\n\nIf  you specify FORCEIALIGN, ppmtompeg will increase the test frames value enough to\nmaintain the alignment.\n\nIf there aren't enough frames for every slave to have the  indicated  number  of  test\nframes, ppmtompeg will give some slaves fewer.\n\n\n\nPARALLELTIMECHUNKS t\nWhen  you  specify  this  statement, the master attempts to feed work to the slaves in\nchunks that take t seconds to process.  It uses the speed measurement it made when  it\nstarted  up  (see PARALLELTESTFRAMES) to decide how many frames to put in the chunk.\nThis statement obviously doesn't affect the first batch of work sent  to  each  slave,\nwhich is the one used to measure the slave's speed.\n\nSmaller  values  of t increase communication, but improve load balancing.  The default\nis 30 seconds.\n\nYou may specify only one of  PARALLELTIMECHUNKS,  PARALLELCHUNKTAPER,  and  PARAL‐\nLELPERFECT.  PARALLELCHUNKTAPER is usually best.\n\n\nPARALLELCHUNKTAPER\nWhen  you  specify  this  statement,  the  master  distributes  work  like with PARAL‐\nLELTIMECHUNKS, except that the master chooses the number of seconds for the  chunks.\nIt starts with a large number and, as it gets closer to finishing the job, reduces it.\nThat  way,  it  reduces scheduling overhead when precise scheduling isn't helpful, but\nstill prevents a slave from finishing early after all the work has already been handed\nout to the other slaves, and then sitting idle while there's still work to do.\n\nYou may specify only one of  PARALLELTIMECHUNKS,  PARALLELCHUNKTAPER,  and  PARAL‐\nLELPERFECT.  PARALLELCHUNKTAPER is usually best.\n\n\n\nPARALLELPERFECT\nIf  this statement is present, ppmtompeg schedules on the assumption that each machine\nis about the same speed.  The master will simply divide up the frames  evenly  between\nthe  slaves  --  each slave gets the same number of frames.  If some slaves are faster\nthan others, they will finish first and remain idle while the slower slaves continue.\n\nThis has the advantage of minimal scheduling overhead.  Where  slaves  have  different\nspeeds,  though, it makes inefficient use of the fast ones.  Where slaves are the same\nspeed, it also has the disadvantage that they all finish at the  same  time  and  feed\ntheir  output  to the single Combine Server in a burst, which makes less efficient use\nof the Combine Server and thus can increase the total elapsed time.\n\nYou may specify only one of  PARALLELTIMECHUNKS,  PARALLELCHUNKTAPER,  and  PARAL‐\nLELPERFECT.  PARALLELCHUNKTAPER is usually best.\n\n\nRSH remoteshellcommand\nppmtompeg  executes  the  shell command remoteshellcommand to start a process on an‐\nother machine.  The default command is rsh, and whatever command you specify must have\ncompatible semantics.  ssh is usually compatible.  The command ppmtompeg uses  is  one\nlike this: ssh remote.host.com -l username shellcommand.\n\nBe  sure  to  set up .rhosts files or SSH key authorizations where needed.  Otherwise,\nyou'll have to type in passwords.\n\nOn some HP machines, rsh is the restricted shell, and you want to specify remsh.\n\n\nFORCEIALIGN\nThis statement forces each slave to encode a chunk of frames which is  a  multiple  of\nthe pattern length (see PATTERN).  Since the first frame in any pattern is an I frame,\nthis forces each chunk encoded by a slave to begin with an I frame.\n\nThis  document used to say there was an argument to FORCEIALIGN which was the number\nof frames ppmtompeg would use (and was required  to  be  a  multiple  of  the  pattern\nlength).  But ppmtompeg has apparently always ignored that argument, and it does now.\n\n\nKEEPTEMPFILES\nThis  statement causes ppmtompeg not to delete the temporary files it uses to transmit\nencoded frames to the combine server.  This means you will be left  with  a  file  for\neach frame, the same as you would get with the -frames option.\n\nThis is mostly useful for debugging.\n\nThis  works  only  if  you're  using  a  shared  filesystem to communicate between the\nservers.\n\nThis option was new in Netpbm 10.26 (January 2005).\n\n\n\n\n"
                },
                {
                    "name": "Parameter File Notes",
                    "content": "If you use the -combinegops option, then you need to specify only the SIZE and OUTPUT  val‐\nues  in  the  parameter file.  In addition, the parameter file may specify input GOP files in\nthe same manner as normal input files --  except  instead  of  using  INPUTDIR,  INPUT,  and\nENDINPUT,  use  GOPINPUTDIR,  GOPINPUT,  and  GOPENDINPUT.  If you specify no input GOP\nfiles, then ppmtompeg uses by default the output file name  with  suffix  .gop.gopnum,  with\ngopnum starting from 0, as the input files.\n\nIf  you use the -combineframes option, then you need to specify only the SIZE, GOPSIZE, and\nOUTPUT values in the parameter file.  In addition, the parameter file may specify input frame\nfiles in the same manner as normal input files -- except instead of using  INPUTDIR,  INPUT,\nand  ENDINPUT,  use  FRAMEINPUTDIR,  FRAMEINPUT,  and FRAMEENDINPUT.  If no input frame\nfiles are  specified,  then  the  default  is  to  use  the  output  file  name  with  suffix\n.frame.framenum, with framenum starting from 0, as the input files.\n\nAny number of spaces and tabs may come between each option and value.  Lines beginning with #\nare ignored.  Any other lines are ignored except for those between INPUT and ENDINPUT.  This\nallows  you  to  use the same parameter file for normal usage and for -combinegops and -com‐\nbineframes.\n\nThe file format is case-sensitive so all keywords should be in upper case.\n\nThe statements may appear in any order, except that the order within a block statement  (such\nas INPUT ... END INPUT) is significant.\n\nppmtompeg is prepared to handle up to 16 B frames between reference frames when encoding with\ninput  from  stdin.   (To build a modified ppmtompeg with a higher limit, change the constant\nBFRAMERUN in frame.c and recompile).\n\n"
                }
            ]
        },
        "GENERAL USAGE INFORMATION": {
            "content": "",
            "subsections": [
                {
                    "name": "Qscale",
                    "content": "The quantization scale values (qscale) give a trade-off between quality and compression.  Us‐\ning different Qscale values has very little effect on speed.  The qscale values  can  be  set\nseparately for I, P, and B frames.\n\nYou select the qscale values with the IQSCALE, PQSCALE, and BSCALE parameter file statements.\n\nA qscale value is an integer from 1 to 31.  Larger numbers give better compression, but worse\nquality.   In  the following, the quality numbers are peak signal-to-noise ratio, defined as:\nsignal-to-noise formula where MSE is the mean squared error.\n\n\nFlower garden tests:\n"
                },
                {
                    "name": "Qscale vs Quality",
                    "content": "────────────────────────────────────────\nQscale   I Frames   P Frames   B Frames\n1       43.2       46.3       46.5\n6       32.6       34.6       34.3\n11       28.6       29.5       30.0\n16       26.3       26.8       28.6\n21       24.7       25.0       27.9\n26       23.5       23.9       27.5\n31       22.6       23.0       27.3\n"
                },
                {
                    "name": "Qscale vs Compression",
                    "content": "────────────────────────────────────────\nQscale   I Frames   P Frames   B Frames\n1          2          2          2\n6          7         10         15\n11         11         18         43\n16         15         29         97\n21         19         41        173\n26         24         56        256\n31         28         73        330\n\n\n"
                },
                {
                    "name": "Search Techniques",
                    "content": "There are several different motion vector search techniques available.  There  are  different\ntechniques available for P frame search and B frame search. Using different search techniques\npresent little difference in quality, but a large difference in compression and speed.\n\n\nThere are 4 types of P frame search: Exhaustive, TwoLevel, SubSample, and Logarithmic.\n\n\nThere are 3 types of B frame search: Exhaustive, Cross2, and Simple.\n\nThe recommended search techniques are TwoLevel and Logarithmic for P frame search, and Cross2\nand Simple for B frame search. Here are some numbers comparing the different search methods:\n"
                },
                {
                    "name": "P frame Motion Vector Search (Normalized)",
                    "content": "─────────────────────────────────────────────────────────────────────────────────\nTechnique   Compression        1   Speed              2   Quality            3\n⟨#smallbetter⟩         ⟨#largefaster⟩         ⟨#largebetter⟩\nExhaustive           1000                   1000                   1000\nSubSample           1008                   2456                   1000\nTwoLevel           1009                   3237                   1000\nLogarithmic           1085                   8229                   998\n"
                },
                {
                    "name": "B frame Motion Vector Search (Normalized)",
                    "content": "────────────────────────────────────────────────────────────────────────────────\nTechnique   Compression        1   Speed              2   Quality            3\n⟨#smallbetter⟩         ⟨#largefaster⟩         ⟨#largebetter⟩\nExhaustive           1000                   1000                   1000\nCross2           975                    1000                   996\nSimple           938                    1765                   991\n\n1Smaller numbers are better compression.\n\n2Larger numbers mean faster execution.\n\n3Larger numbers mean better quality.\n\nFor  some  reason,  Simple  seems to give better compression, but it depends on the image se‐\nquence.\n\nSelect the search techniques with the PSEARCHALG and BSEARCHALG parameter file statements.\n\n\n"
                },
                {
                    "name": "Group Of Pictures (GOP)",
                    "content": "A Group of Pictures (GOP) is a roughly independently decodable sequence of frames.   An  MPEG\nvideo stream is made of one or more GOP's.  You may specify how many frames should be in each\nGOP with the GOPSIZE parameter file statement.  A GOP always starts with an I frame.\n\nInstead  of  encoding  an  entire sequence, you can encode a single GOP.  To do this, use the"
                },
                {
                    "name": "-gop",
                    "content": "tompeg with the -combinegops command option.\n\n\n"
                },
                {
                    "name": "Slices",
                    "content": "A slice is an independently decodable unit in a frame.  It can be as small as one macroblock,\nor  it can be as big as the entire frame.  Barring transmission error, adding slices does not\nchange quality or speed; the only effect is slightly worse compression.  More slices are used\nfor noisy transmission so that errors are more recoverable. Since usually errors are not such\na problem, we usually just use one slice per frame.\n\n\nControl the slice size with the SLICESPERFRAME parameter file statement.\n\nSome MPEG playback systems require that each slice consist of whole rows of macroblocks.   If\nyou  are  encoding  for this kind of player, if the height of the image is H pixels, then you\nshould set the SLICESPERFRAME to some number which divides H/16.  For example, if the image\nis 240 pixels (15 macroblocks) high, then you should use only 15,  5,  3,  or  1  slices  per\nframe.\n\n\nNote: these MPEG playback systems are really wrong, since the MPEG standard says this doesn't\nhave to be so.\n\n\n\n"
                },
                {
                    "name": "Search Window",
                    "content": "The  search  window is the window in which ppmtompeg searches for motion vectors.  The window\nis a square.  You can specify the size of the square, and whether to allow half-pixel  motion\nvectors or not, with the RANGE and PIXEL parameter file statements.\n\n"
                },
                {
                    "name": "I Frames, P Frames, B Frames",
                    "content": "In  MPEG-1, a movie is represented as a sequence of MPEG frames, each of which is an I Frame,\na P Frame, or a B Frame.  Each represents an actual frame of the movie (don't get confused by\nthe dual use of the word \"frame.\"  A movie frame is a graphical image.  An MPEG  frame  is  a\nset of data that describes a movie frame).\n\nAn  I  frame  (\"intra\"  frame) describes a movie frame in isolation -- without respect to any\nother frame in the movie.  A P frame (\"predictive\" frame) describes a movie frame by describ‐\ning how it differs from the movie frame described by the latest preceding I  or P frame.  A B\nframe (\"bidirectional\" frame) describes a movie frame by describing how it differs  from  the\nmovie frames described by the nearest I or P frame before and after it.\n\nNote  that  the  first  frame of a movie must be described by an I frame (because there is no\nprevious movie frame) and the last movie frame must be described by an I or P frame  (because\nthere is no subsequent movie frame).\n\nBeyond  that, you can choose which frames are represented by which types.  You specify a pat‐\ntern, such as IBPBP and ppmtompeg simply repeats it over and over throughout the movie.   The\npattern  affects  speed,  quality,  and stream size.  Here is a chart which shows some of the\ntrade-offs:\n"
                },
                {
                    "name": "Comparison of I/P/B Frames (Normalized)",
                    "content": "────────────────────────────────────\nFrame Type   Size   Speed   Quality\nI frames   1000   1000     1000\nP frames   409     609      969\nB frames    72     260      919\n\n(this is with constant qscale)\n\n\nA standard sequence is IBBPBBPBBPBBPBB.\n\n\nSelect the sequence with the PATTERN parameter file statement.\n\nSince the last MPEG frame cannot be a B frame (see above), if the pattern you  specify  indi‐\ncates a B frame for the last movie frame of the movie, ppmtompeg makes it an I frame instead.\n\nBefore Netpbm 10.26 (January 2005), ppmtompeg instead drops the trailing B frames by default,\nand you need the FORCEENCODELASTFRAME parameter file statement to make it do this.\n\nThe  MPEG  frames  don't appear in the MPEG-1 stream in the same order that the corresponding\nmovie frames appear in the movie -- the B frames come after the I and P frames on which  they\nare  based.   For  example, if the movie is 4 frames that you will represent with the pattern\nIBBP, the MPEG-1 stream will start with an I frame describing movie frame 0.  The next  frame\nin  the  MPEG-1  stream  is  a  P frame describing movie frame 3.  The last two frames in the\nMPEG-1 stream are B frames describing movie frames 1 and 2, respectively.\n\n\n"
                },
                {
                    "name": "Specifying Input and Output Files",
                    "content": "Specify the input frame images with the INPUTDIR, INPUT, ENDINPUT, BASEFILEFORMAT,  SIZE,\nYUVFORMAT and INPUTCONVERT parameter file statements.\n\nSpecify the output file with the OUTPUT parameter file statement.\n\n\n"
                },
                {
                    "name": "Statistics",
                    "content": "ppmtompeg  can  generate  a  variety  of statistics about the encoding.  See the -stat, -snr,"
                },
                {
                    "name": "-mv_histogram -quiet -no_frame_summary -bit_rate_info",
                    "content": ""
                }
            ]
        },
        "PARALLEL OPERATION": {
            "content": "You can run ppmtompeg on multiple machines at once, encoding the same MPEG stream.  When  you\ndo, the machines are used as shown in the following diagram.  We call this \"parallel mode.\"\n",
            "subsections": [
                {
                    "name": "ppmtompeg-par.gif",
                    "content": "To do parallel processing, put the statement\n\nPARALLEL\n\n\nin the parameter file, followed by a listing of the machines, one machine per line, then\n\nENDPARALLEL\n\n\nEach  of the machine lines must be in one of two forms.  If the machine has filesystem access\nto the input files, then the line is:\n\nmachine user executable\n\nThe executable is normally ppmtompeg (you may need to give the complete path if you've  built\nfor  different  architectures).   If the machine does not have filesystem access to the input\nfiles, the line is:\n\nREMOTE machine user executable parameter file\n\nThe -maxmachines command option limits the number of machines ppmtompeg will  use.   If  you\nspecify  more  machines  in the parameter file than -maxmachines allows, ppmtompeg uses only\nthe machines listed first.  This is handy if you want to experiment with different amounts of\nparallelism.\n\nIn general, you should use full path file names when  describing  executables  and  parameter\nfiles.  This includes the parameter file argument on the original invocation of ppmtompeg.\n\nAll  file  names  must be the same on all systems (so if e.g. you're using an NFS filesystem,\nyou must make sure it is mounted at the same mountpoint on all systems).\n\nBecause not all of the processes involved in parallel operation have easy access to the input\nfiles, you must specify the SIZE parameter file statement when you do parallel operation.\n\nThe machine on which you originally invoke ppmtompeg is the master machine.  It hosts a \"com‐\nbine server,\", a \"decode server,\" and a number of \"i/o servers,\" all as  separate  processes.\nThe  other  machines  in the network (listed in the parameter file) are slave machines.  Each\nhosts a single process that continuously requests work from the  master  and  does  it.   The\nslave  process  does  the  computation to encode MPEG frames.  It processes frames in batches\nidentified by the master.\n\nThe master uses a remote shell command to start a process on a slave machine.  By default, it\nuses an rsh shell command to do this.  But use the RSH parameter file  statement  to  control\nthis.  The shell command the master executes remotely is ppmtompeg, but with options to indi‐\ncate that it is to perform slave functions.\n\nThe  various  machines talk to each other over TCP connections.  Each machine finds and binds\nto a free TCP port number and tells its partners the port number.  These port numbers are  at\nleast 2048.\n\nUse  the  PARALLELTESTFRAMES,  PARALLELTIMECHUNKS,  and  PARALLELPERFECT  parameter file\nstatements to control the way the master divides up work among the slaves.\n\nUse the -nice command option to cause all slave processes to run \"nicely,\" i.e. as low prior‐\nity processes.  That way, this substantial and long-running CPU load will have minimal impact\non other, possibly interactive, users of the systems.\n\n"
                }
            ]
        },
        "SPEED": {
            "content": "Here is a look at ppmtompeg speed, in single-node (not parallel) operation:\n",
            "subsections": [
                {
                    "name": "Compression Speed",
                    "content": "───────────────────────────────────────\nMachine Type   Macroblocks per second1\nHP 9000/755             280\nDEC 3000/400             247\nHP 9000/750             191\nSparc 10             104\nDEC 5000             68\n1A macroblock is a 16x16 pixel square\n\nThe measurements in the table are with inputs and outputs via a conventional locally attached\nfilesystem.  If you are using a network filesystem over a single 10 MB/s Ethernet, that  con‐\nstrains your speed more than your CPU speed.  In that case, don't expect to get better than 4\nor 5 frames per second no matter how fast your CPUs are.\n\nNetwork  speed  is even more of a bottleneck when the slaves do not have filesystem access to\nthe input files -- i.e. you declare them REMOTE.\n\nWhere I/O is the bottleneck, size of the input frames can make a big difference.  So YUV  in‐\nput is better than PPM, and JPEG is better than both.\n\nWhen you're first trying to get parallel mode working, be sure to use the -debugmachines op‐\ntion  so  you can see what's going on.  Also, -debugsockets can help you diagnose communica‐\ntion problems.\n\n\n"
                }
            ]
        },
        "AUTHORS": {
            "content": "•      Kevin Gong - University of California, Berkeley, keving@cs.berkeley.edu\n\n\n•      Ketan Patel - University of California, Berkeley, kpatel@cs.berkeley.edu\n\n\n•      Dan Wallach - University of California, Berkeley, dwallach@cs.berkeley.edu\n\n\n•      Darryl Brown - University of California, Berkeley, darryl@cs.berkeley.edu\n\n\n•      Eugene Hung - University of California, Berkeley, eyhung@cs.berkeley.edu\n\n\n•      Steve Smoot - University of California, Berkeley, smoot@cs.berkeley.edu\n",
            "subsections": []
        },
        "DOCUMENT SOURCE": {
            "content": "This manual page was generated by the Netpbm tool 'makeman' from  HTML  source.   The  master\ndocumentation is at\n\nhttp://netpbm.sourceforge.net/doc/ppmtompeg.html\n\nnetpbm documentation                        23 July 2006                    Ppmtompeg User Manual(1)",
            "subsections": []
        }
    },
    "summary": "ppmtompeg - encode an MPEG-1 bitstream",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option causes ppmtompeg to append the statistics that it write to Standard Output to the file statfile as well. The statistics use the following abbreviations: bits per block (bpb), bits per frame (bpf), seconds per frame (spf), and bits per second (bps). These statistics include how many I, P, and B frames there were, and information about compression and quality."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "causes ppmtompeg not to report remaining time more often than every numseconds sec‐ onds (unless the time estimate rises, which will happen near the beginning of the run). A negative value tells ppmtompeg not to report at all. 0 is the default (re‐ ports once after each frame). Note that the time remaining is an estimate and does not take into account time to read in frames."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "causes ppmtompeg to run silently, with the only screen output being errors. Particu‐ larly useful when reading input from stdin. The equivalent of the -quiet common op‐ tion of most other Netpbm programs."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option prevents ppmtompeg from printing a summary line for each frame"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "forces ppmtompeg to use a more accurate, yet more computationally expensive version of the DCT."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "causes ppmtompeg to encode only the numbered GOP (first GOP is 0). The parameter file is the same as for normal usage. The output file will be the normal output file with the suffix .gop.gopnum. ppmtompeg does not output any sequence information."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "causes ppmtompeg simply to combine some GOP files into a single MPEG output stream. ppmtompeg inserts a sequence header and trailer. In this case, the parameter file needs only to contain the SIZE value, an output file, and perhaps a list of input GOP files (see below). If you don't supply a list of input GOP files is used, then ppmtompeg assumes you're using the same parameter file you used when you created the input (with the -gop op‐ tion) and calculates the corresponding gop filenames itself. If this is not the case, you can specify input GOP files in the same manner as normal input files -- except in‐ stead of using INPUTDIR, INPUT, and ENDINPUT, use GOPINPUTDIR, GOPINPUT, and GOPENDINPUT. If no input GOP files are specified, then the default is to use the output file name with suffix .gop.gopnum, with gopnum starting from 0, as the input files. Thus, unless you're mixing and matching GOP files from different sources, you can sim‐ ply use the same parameter file for creating the GOP files (-gop) and for later turn‐ ing them into an MPEG stream (-combinegops)."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option causes ppmtompeg to encode only the frames numbered firstframe to lastframe, inclusive. The parameter file is the same as for normal usage. The out‐ put will be placed in separate files, one per frame, with the file names being the normal output file name with the suffix .frame.framenum. No GOP header information is output. (Thus, the parameter file need not include the GOPSIZE value) Use ppmtompeg -combineframes to combine these frames later into an MPEG stream."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option causes ppmtompeg simply to combine some individual MPEG frames (such as you might have created with an earlier run of ppmtompeg -frames) into a single MPEG stream. Sequence and GOP headers are inserted appropriately. In this case, the para‐ meter file needs to contain only the SIZE value, the GOPSIZE value, an output file, and perhaps a list of frame files (see below). The parameter file may specify input frame files in the same manner as normal input files -- except instead of using INPUTDIR, INPUT, and ENDINPUT, use FRAMEINPUTDIR, FRAMEINPUT, and FRAMEENDINPUT. If no input frame files are specified, then the de‐ fault is to use the output file name with suffix .frame.framenum, with framenum starting from 0, as the input files."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "ity. (This is relevant only if you are running ppmtompeg in parallel mode. Other‐ wise, there are no remote processes). See 'man nice.'"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option causes ppmtompeg to use no more than nummachines machines as slaves for use in parallel encoding."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "tistics. Prints SNR (Y U V) and peak SNR (Y U V) for each frame. In summary, prints averages of luminance only (Y). SNR is defined as 10*log(variance of original/vari‐ ance of error). Peak SNR is defined as 20*log(255/RMSE). Note that ppmtompeg runs a little slower when you use this option."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "tomatically reports the quality of the images, so there is no need to specify -snr then."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option makes ppmtompeg write bit rate information into the file ratefile. Bit rate information is bits per frame, and also bits per I-frame-to-I-frame."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option causes ppmtompeg to print a histogram of the motion vectors as part of statistics. There are three histograms -- one for P frame, one for forward B frame, and one for backward B frame motion vectors. The output is in the form of a matrix, each entry corresponding to one motion vector in the search window. The center of the matrix represents (0,0) motion vectors."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option causes ppmtompeg to print to Standard Output messages that narrate the communication between the machines when you run ppmtompeg in \u001b]8;;#parallel\u001b\\parallel mode\u001b]8;;\u001b\\ ."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "This option causes ppmtompeg to print to Standard Output messages that narrate the progress of the conversion on the various machines when you run ppmtompeg in \u001b]8;;#parallel\u001b\\parallel mode\u001b]8;;\u001b\\ ."
        }
    ],
    "examples": [],
    "see_also": [],
    "tldr": {
        "source": "official",
        "description": "Encode an MPEG-1 stream.",
        "examples": [
            {
                "description": "Produce an MPEG-1 stream using the parameter file to specify inputs and outputs",
                "command": "ppmtompeg {{path/to/parameter_file}}"
            },
            {
                "description": "Encode the GOP with the specified number only",
                "command": "ppmtompeg {{-g|-gop}} {{gop_num}} {{path/to/parameter_file}}"
            },
            {
                "description": "Specify the first and last frame to encode",
                "command": "ppmtompeg {{-fr|-frames}} {{first_frame}} {{last_frame}} {{path/to/parameter_file}}"
            },
            {
                "description": "Combine multiple MPEG frames into a single MPEG-1 stream",
                "command": "ppmtompeg -combine_frames {{path/to/parameter_file}}"
            }
        ]
    }
}