{
    "content": [
        {
            "type": "text",
            "text": "# PPMTOMPEG (man)\n\n## NAME\n\nppmtompeg - encodes MPEG-1 bitstreams\n\n## SYNOPSIS\n\nppmtompeg [ options ] parameter-file\n\n## DESCRIPTION\n\nppmtompeg  produces  an MPEG-1 video stream.  paramfile is a parameter file which includes a\nlist of input files and other parameters.  The file is described in detail below.  The  -gop,\n-combinegops,  -frames,  and  -combineframes  options  are all exclusive.  This man page is\nprobably incomplete.  For complete usage, see the User's Guide.\n\n## TLDR\n\n> Encode an MPEG-1 stream.\n\n- Produce an MPEG-1 stream using the parameter file to specify inputs and outputs:\n  `ppmtompeg {{path/to/parameter_file}}`\n- Encode the GOP with the specified number only:\n  `ppmtompeg {{-g|-gop}} {{gop_num}} {{path/to/parameter_file}}`\n- Specify the first and last frame to encode:\n  `ppmtompeg {{-fr|-frames}} {{first_frame}} {{last_frame}} {{path/to/parameter_file}}`\n- Combine multiple MPEG frames into a single MPEG-1 stream:\n  `ppmtompeg -combine_frames {{path/to/parameter_file}}`\n\n*Source: tldr-pages*\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **OPTIONS** (15 subsections)\n- **PARAMETER FILE**\n- **NOTES**\n- **PARALLEL OPERATION**\n- **VERSION**\n- **BUGS**\n- **AUTHORS**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "PPMTOMPEG",
        "section": "",
        "mode": "man",
        "summary": "ppmtompeg - encodes MPEG-1 bitstreams",
        "synopsis": "ppmtompeg [ options ] parameter-file",
        "tldr_summary": "Encode an MPEG-1 stream.",
        "tldr_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}}"
            }
        ],
        "tldr_source": "official",
        "flags": [
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "case, the statistics are output to stdout. The statistics use the following abbrevia‐ tions: bits per block (bpb), bits per frame (bpf), seconds per frame (spf), and bits per second (bps)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "seconds. A negative values tells the program not to report at all. 0 is the default (reports 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": "Particularly useful when reading input from stdin."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": ""
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "version of the DCT."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "rameter file is the same as for normal usage. The output file will be the normal out‐ put file with the suffix \".gop.<gopnum>\" No sequence info is output."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "stream. A sequence header/ender are inserted. In this case, the parameter file need only contain the YUVSIZE value, an output file, and perhaps a list of input GOP files (see below)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "firstframe to lastframe, inclusive. The parameter file is the same as for normal usage. The output will be placed in separate files, one per frame, with the file names being the normal output file with the suffix \".frame.<frame num>\" No GOP header information is output. (Thus, the parameter file need not include the GOPSIZE value)"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "Sequence and GOP headers are inserted appropriately. In this case, the parameter file need only contain the YUVSIZE value, the GOPSIZE value, an output file, and perhaps a list of frame files (see below)."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "the program is using parallel encoding. (see 'man nice.')"
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "slaves for use in parallel encoding."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "frame. In summary, prints averages of luminance only (Y). SNR is defined as 10*log(variance of original/variance of error). Peak SNR is defined as 20*log(255/RMSE). Note that the encoder will run a little slower if you want it to print the SNR."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "the images when set, so there is no need to specify -snr then."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "info is bits per frame, and also bits per I-frame-to-I-frame."
            },
            {
                "flag": "",
                "long": null,
                "arg": null,
                "description": "histograms -- one for P, forward B, and backward B vectors. Each histogram is a 2-di‐ mensional array, and there is one entry for each vector in the search window."
            }
        ],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-stat",
                        "lines": 4
                    },
                    {
                        "name": "-quiet",
                        "lines": 4
                    },
                    {
                        "name": "-realquiet",
                        "lines": 2
                    },
                    {
                        "name": "-no",
                        "lines": 1
                    },
                    {
                        "name": "-float",
                        "lines": 2
                    },
                    {
                        "name": "-gop",
                        "lines": 3
                    },
                    {
                        "name": "-combine",
                        "lines": 4
                    },
                    {
                        "name": "-frames",
                        "lines": 5
                    },
                    {
                        "name": "-combine",
                        "lines": 4
                    },
                    {
                        "name": "-nice",
                        "lines": 2
                    },
                    {
                        "name": "-max",
                        "lines": 2
                    },
                    {
                        "name": "-snr",
                        "lines": 5
                    },
                    {
                        "name": "-mse",
                        "lines": 2
                    },
                    {
                        "name": "-bit",
                        "lines": 2
                    },
                    {
                        "name": "-mv-histogram",
                        "lines": 5
                    }
                ]
            },
            {
                "name": "PARAMETER FILE",
                "lines": 115,
                "subsections": []
            },
            {
                "name": "NOTES",
                "lines": 38,
                "subsections": []
            },
            {
                "name": "PARALLEL OPERATION",
                "lines": 42,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 7,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 18,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "ppmtompeg - encodes MPEG-1 bitstreams\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "ppmtompeg [ options ] parameter-file\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "ppmtompeg  produces  an MPEG-1 video stream.  paramfile is a parameter file which includes a\nlist of input files and other parameters.  The file is described in detail below.  The  -gop,\n-combinegops,  -frames,  and  -combineframes  options  are all exclusive.  This man page is\nprobably incomplete.  For complete usage, see the User's Guide.\n",
                "subsections": []
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-stat",
                        "content": "case, the statistics are output to stdout.  The statistics use the following abbrevia‐\ntions:  bits per block (bpb), bits per frame (bpf), seconds per frame (spf), and  bits\nper second (bps).\n"
                    },
                    {
                        "name": "-quiet",
                        "content": "seconds.  A negative values tells the program not to report at all.  0 is the  default\n(reports once after each frame).  Note that the time remaining is an estimate and does\nnot take into account time to read in frames.\n"
                    },
                    {
                        "name": "-realquiet",
                        "content": "Particularly useful when reading input from stdin.\n"
                    },
                    {
                        "name": "-no",
                        "content": ""
                    },
                    {
                        "name": "-float",
                        "content": "version of the DCT.\n"
                    },
                    {
                        "name": "-gop",
                        "content": "rameter file is the same as for normal usage.  The output file will be the normal out‐\nput file with the suffix \".gop.<gopnum>\"  No sequence info is output.\n"
                    },
                    {
                        "name": "-combine",
                        "content": "stream.   A sequence header/ender are inserted.  In this case, the parameter file need\nonly contain the YUVSIZE value, an output file, and perhaps a list of input GOP files\n(see below).\n"
                    },
                    {
                        "name": "-frames",
                        "content": "firstframe to lastframe, inclusive.  The parameter file is the same  as  for  normal\nusage.   The  output  will  be  placed in separate files, one per frame, with the file\nnames being the normal output file with the suffix \".frame.<frame num>\"  No GOP header\ninformation is output.  (Thus, the parameter file need not include the GOPSIZE value)\n"
                    },
                    {
                        "name": "-combine",
                        "content": "Sequence and GOP headers are inserted appropriately.  In this case, the parameter file\nneed  only contain the YUVSIZE value, the GOPSIZE value, an output file, and perhaps\na list of frame files (see below).\n"
                    },
                    {
                        "name": "-nice",
                        "content": "the program is using parallel encoding.  (see 'man nice.')\n"
                    },
                    {
                        "name": "-max",
                        "content": "slaves for use in parallel encoding.\n"
                    },
                    {
                        "name": "-snr",
                        "content": "frame.   In  summary,  prints  averages  of  luminance  only  (Y).   SNR is defined as\n10*log(variance  of  original/variance  of   error).    Peak   SNR   is   defined   as\n20*log(255/RMSE).   Note  that  the encoder will run a little slower if you want it to\nprint the SNR.\n"
                    },
                    {
                        "name": "-mse",
                        "content": "the images when set, so there is no need to specify -snr then.\n"
                    },
                    {
                        "name": "-bit",
                        "content": "info is bits per frame, and also bits per I-frame-to-I-frame.\n"
                    },
                    {
                        "name": "-mv-histogram",
                        "content": "histograms -- one for P, forward B, and backward B vectors.  Each histogram is a 2-di‐\nmensional array, and there is one entry for each vector in the search window.\n\n\n"
                    }
                ]
            },
            "PARAMETER FILE": {
                "content": "The parameter file MUST contain the following lines (except when using the  -combinegops  or\n-combineframes options):\n\n\nPATTERN <pattern>\n\nOUTPUT <output file>\n\nINPUTDIR <directory>\nall  input  files  must  reside in this directory.  If you want to refer to the\ncurrent directory, use '.' (an empty INPUTDIR value would refer  to  the  root\ndirectory).  If input files will be coming in from standard input, use 'stdin'.\n\nINPUT\nThis  line must be followed by a list of the input files (in display order) and\nthen the line\nENDINPUT\nThere are three types of lines between INPUT and ENDINPUT.  First, a line  may\nsimply be the name of an input file.  Secondly, the line may be of the form\n<singlestarexpr> [x-y]\nsinglestarexpr  can  have a single '*' in it.  It is replaced by all the num‐\nbers between x and y inclusive.  So, for example, the line\ntennis*.ppm [12-15]\nis replaced by tennis12.ppm, tennis13.ppm, tennis14.ppm, tennis15.ppm.  Uniform\nzero-padding occurs, as well.  For example, the line\nfootball.*.ppm [001-130]\nis replaced by football.001.ppm, football.002.ppm, ..., football.009.ppm, foot‐\nball.010.ppm, ..., football.130.ppm.  The third type of line is:\n<singlestarexpr> [x-y+s]\nWhere the line is treated exactly as above, except that we skip  by  s.   Thus,\nthe line\nfootball.*.ppm [001-130+4]\nis  replaced  by  football.001.ppm,  football.005.ppm,  football.009.ppm, foot‐\nball.013.ppm, etc.\n\nBASEFILEFORMAT <YUV or PPM or PNM or JPEG or JMOVIE>\nAll the input files must be converted to YUV, JPEG(v4),  JMOVIE,  PNM,  or  PPM\nformat.  This line specifies which of the three formats (actually PPM is a sub‐\nset of PNM).  The reason for having a separate PPM option  is  for  simplicity.\nIf  your  files  are RAWBITS ppm files, then use the PPM option rather than the\nPNM.  Also, depending on the system, file reads will go much  faster  with  the\nPPM option (as opposed to PNM).\n\nINPUTCONVERT <conversion command>\nYou must specify how to convert a file to the base file format.  In the conver‐\nsion command, each '*' is replaced by the filename (the  items  listed  between\nINPUT and ENDINPUT).  If no conversion is necessary, then you would just say:\nINPUTCONVERT *\nIf you had a bunch of gif files, you might say:\nINPUTCONVERT giftoppm *\nIf you have a bunch of separate a.Y, a.U, and a.V files, then you might say:\nINPUTCONVERT cat *.Y *.U *.V\nInput conversion is not allowed with input from stdin.\n\nGOPSIZE <n>\nn  is  roughly  the number of frames in a Group of Pictures (roughly be‐\ncause a GOP must begin with an I-frame)\n\nSLICESPERFRAME <n>\nn is roughly the number of slices per frame.  Note, at  least  one  MPEG\nplayer may complain if slices do not start at the left side of an image.\nTo ensure this does not happen, make sure the number of rows is  divisi‐\nble by SLICESPERFRAME.\n\nPIXEL <FULL or HALF>\nuse half-pixel motion vectors, or only full-pixel ones\n\nRANGE <n>\nuse a search range of +/- n pixels\n\nPSEARCHALG <algorithm>\nalgorithm must be one of {EXHAUSTIVE, TWOLEVEL, SUBSAMPLE, LOGARITHMIC}.\nTells what kind of search procedure should be used  for  P-frames.   Ex‐\nhaustive  gives  the  best  compression, but logarithmic is the fastest.\nYou select the desired combination of speed and  compression.   TWOLEVEL\nis  an  exhaustive  full-pixel  search,  followed by a local half- pixel\nsearch around the best full-pixel vector (the PIXEL  option  is  ignored\nfor this search algorithm).\n\nBSEARCHALG <algorithm>\nalgorithm  must be one of {SIMPLE, CROSS2, EXHAUSTIVE}.  Tells what kind\nof search procedure should be used for B-frames.  Simple means find best\nforward and backward vectors, then interpolate.  Cross2 means find those\ntwo vectors, then see what backward vector best matches the best forward\nvector,  and vice versa.  Exhaustive does an n-squared search and is EX‐\nTREMELY slow in relation to the others (Cross2 is about twice as slow as\nSimple).\n\nIQSCALE <n>\nuse n as the qscale for I-frames\n\nPQSCALE <n>\nuse n as the qscale for P-frames\n\nBQSCALE <n>\nuse n as the qscale for B-frames\n\nREFERENCEFRAME <ORIGINAL or DECODED>\nIf ORIGINAL is specified, then the original images are used when comput‐\ning motion vectors.  To be more accurate, use DECODED, in which the  de‐\ncoded  images  are used.  This should increase the quality of the image,\nbut will take a bit longer to encode.\nThe following lines are optional:\n\n\nFORCEIALIGN\nThis option is only relevant for parallel execution (see  below).\nIt  forces  each processor to encode a block of N frames, where N\nmust be a multiple of the pattern length.  Since the first  frame\nin any pattern is an I-frame, this forces each block encoded by a\nprocessor to begin with an I-frame.\nfoo\n\n\n",
                "subsections": []
            },
            "NOTES": {
                "content": "If the BASEFILEFORMAT is YUV, then the parameter file must contain:\nYUVSIZE <w>x<h>\nwhere w = width, h = height (in pixels) of image, and\nYUVFORMAT <ABEKAS or PHILLIPS or UCB or EYUV or pattern>.\nSee the file doc/INPUT.FORMAT for more information.\n\nIf the -combine-gops option is used, then only the YUVSIZE and OUTPUT values need be  speci‐\nfied  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 no input GOP files are speci‐\nfied, then the default is to use the output file name with suffix  \".gop.<gopnum>\"  starting\nfrom 0 as the input files.\n\nIf  the  -combine-frames  option is used, then only the YUVSIZE, GOPSIZE, and OUTPUT values\nneed be specified in the parameter file.  In addition, the parameter file may  specify  input\nframe  files  in  the same manner as normal input files -- except instead of using INPUTDIR,\nINPUT, and ENDINPUT, use FRAMEINPUTDIR, FRAMEINPUT, and  FRAMEENDINPUT.   If  no  input\nframe  files  are  specified,  then  the  default  is to use the output file name with suffix\n\".frame.<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\n'#'  are  ignored.  Any other lines are ignored except for those between INPUT and ENDINPUT.\nThis allows you to use the same parameter file for normal usage  and  for  -combinegops  and\n-combineframes.\n\nThe encoder is case-sensitive so, except for file names and directories, everything should be\nin upper case.\n\nThe lines may appear in any order, except the following exceptions.  INPUT must appear before\nENDINPUT   (also,  GOPINPUT  before  GOPENDINPUT and FRAMEINPUT before FRAMEENDINPUT).\nAll lines between INPUT and ENDINPUT must be the frames in play order.\n\nThe encoder is prepared to handle up to 16 B frames between reference  frames  when  encoding\nwith  input  from stdin.  To increase this amount, change the constant BFRAMERUN in frame.c\nand recompile.\n\n\n",
                "subsections": []
            },
            "PARALLEL OPERATION": {
                "content": "The encoder may be run on multiple machines at once.  To do so, add a line \"PARALLEL\" in  the\nparameter  file,  followed  by a listing, one machine per line, then \"ENDPARALLEL\".  Each of\nthe lines should be in one of two forms.  If the machine has access to the file server,  then\nthe line should be:\n\n<machine> <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 is a remote machine, then the line should be:\n\nREMOTE <machine> <user> <executable> <parameter file>\n\nFull paths should generally be used when describing executables and  parameter  files.   This\nINCLUDES  the  parameter  file given as an argument to the original call to ppmtompeg.  Also,\n.rhosts files on the appropriate machines should have the appropriate information.\n\nThe encoder will use the original machine for the master and I/O server processes,  and  uses\nthe listed machines as slaves to do the computation.\n\nOptional lines are\n\nRSH <remote shell command>\nThe  encoder  uses the remote shell command to start processes on other machines.  The\ndefault command is 'rsh.'  If your machine supports a different  command,  specify  it\nhere.\n\nPARALLELTESTFRAMES <n>\nn is the number of frames to encode initially on each processor\n\nPARALLELTIMECHUNKS <t>\nsubsequently,  each  slave  processor will be asked to encode for approximately t sec‐\nonds.  Smaller values of <t> increase communication, but improve load balancing.\n\nThe default values for these two options are n = 3 frames and t = 30 seconds.\n\nPARALLELPERFECT\nIf this line is present, then scheduling is done on the assumption that work distribu‐\ntion will be perfectly even -- meaning that each machine is about the same speed.  The\nframes will simply be divided up evenly between the processors.  This has  the  advan‐\ntage  of  very  minimal  scheduling  overhead, but is obviously wrong if machines have\nvarying speeds, or if the network load makes performance uneven.\n",
                "subsections": []
            },
            "VERSION": {
                "content": "This is version 1.5 it contins new features and bug fixes from version 1.3.\n",
                "subsections": []
            },
            "BUGS": {
                "content": "Not really a bug, but at least a limitation: If writing to an output  file,  ppmtompeg  some‐\ntimes uses <filename>.* as temporary files.\n\nNo known bugs, but if you find any, report them to mpeg-bugs@plateau.cs.berkeley.edu.\n\n\n",
                "subsections": []
            },
            "AUTHORS": {
                "content": "Kevin Gong - University of California, Berkeley, keving@cs.berkeley.edu\n\nKetan Patel - University of California, Berkeley, kpatel@cs.berkeley.edu\n\nDan Wallach - University of California, Berkeley, dwallach@cs.berkeley.edu\n\nDarryl Brown - University of California, Berkeley, darryl@cs.berkeley.edu\n\nEugene Hung - University of California, Berkeley, eyhung@cs.berkeley.edu\n\nSteve Smoot - University of California, Berkeley, smoot@cs.berkeley.edu\n\n\n\n\n\n\n1 February 1995                              PPMTOMPEG(1)",
                "subsections": []
            }
        }
    }
}