From: Konstantinos <dal...@us...> - 2006-08-27 08:27:30
|
Update of /cvsroot/playerstage/code/gazebo/manual In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16128 Modified Files: gazebo.dox Added Files: create_mpeg.html Log Message: Added frames to MPEG Howto --- NEW FILE: create_mpeg.html --- /** @page mpeg HOWTO: Creating MPEG movies from PNM frames There are many ways to create MPEG files from the PNM frames generated by Gazebo. One of the easiest is to use the <tt>ppmtompeg</tt> program that is part of the <a href="http://netpbm.sourceforge.net/">Netpbm</a> software package and included by default in many distributions. @section mpeg_basics Some MPEG basics During MPEG compression each frame is divided into slices that are separately compressed. The frame is then encoded as an I, P or B frame. I frames are independent frames, where the P frames are given as the difference to the preceding P or I frame and the B frames as the difference to both the preceding and following I or P frame. Several frames are grouped into GOPs (Group of Pictures) that correspond to independently decoded sequences. Each such GOP starts with an I frame. @section mpeg_ppmtompeg Using ppmtompeg The ppmtompeg program parses a parameter file that contains all the information pertaining to the creation of a single MPEG sequence. The syntax of this file is relatively simple. The contents of a typical file are included below followed by a basic line by line explanation. @verbatim OUTPUT movie.mpeg INPUT_DIR . INPUT *.pnm [0100-0500] END_INPUT BASE_FILE_FORMAT PNM INPUT_CONVERT * FRAME_RATE 25 PATTERN IBBPBBPBBPBBPBB SLICES_PER_FRAME 16 GOP_SIZE 30 PIXEL HALF IQSCALE 1 PQSCALE 5 BQSCALE 10 RANGE 5 PSEARCH_ALG TWOLEVEL BSEARCH_ALG CROSS2 REFERENCE_FRAME DECODED @endverbatim The first line specifies the output file, which in this case is movie.mpeg. The <tt>INPUT_DIR</tt> specifies the directory were the frames reside, in this case is the same as the parameter file. The files used to create the MPEG sequence are between the <tt>INPUT</tt> and <tt>END_INPUT</tt> tags. It can contain individual files or a range of files. In this case the input contains the files from 0100.pnm to 0500.pnm. The <tt>BASE_FILE_FORMAT</tt> specifies the format of the files and the <tt>INPUT_CONVERT</tt> is used when the files are not in PNM format already. Here no conversion is necessary. Next the frame rate is defined as 25 fps, followed by the <tt>PATTERN</tt> option. This option specifies the sequence of I, B and P frames. Many I frames usually means better picture quality at the expense of bigger file sizes. The <tt>GOP_SIZE</tt> usually is a multiple of the PATTERN size, but not necessarily. The <tt>SLICES_PER_FRAME</tt> defines the number of slices that each frame will be divided into to be compressed. Larger number of this option result in larger file sizes with little to no effect in picture quality. The rest of the options refer to the picture quality and the compression algorithms used. @section mpeg_create Creating the MPEG file To create the MPEG file it is sufficient to create a param file with the contents above in the directory were the frames reside and issue the following command: @verbatim $ ppmtompeg param @endverbatim @section mpeg_extra Resizing the video, adding a watermark, etc. It is possible to take advantage of the <tt>INPUT_CONVERT</tt> option and the <a href="http://www.imagemagick.org/index.php"> Imagemagick</a> program to resize the video, add watermarks or create other effects. The following line in the parameter file will resize all the frames to 320x240 before creating the sequence. This will <b>not</b> affect the files existing on disk. @verbatim INPUT_CONVERT convert -size 320x240 * - @endverbatim The following line will add a caption "My text" in white letters near the top left corner of the MPEG video. @verbatim INPUT_CONVERT convert -font arial -fill white -pointsize 18 -draw 'text 10,20 "My text"' * - @endverbatim Although there can be only one INPUT_CONVERT option, it is possible to combine the above two effects in a single command @verbatim INPUT_CONVERT convert -size 320x240 -font arial -fill white -pointsize 18 -draw 'text 10,20 "My text"' * - @endverbatim @section mpeg_moreinfo More information For extended descriptions of all the options offered by ppmtompeg, check the program's <a href="http://netpbm.sourceforge.net/doc/ppmtompeg.html">manual page</a>. For more information on the operations available with the convert program of the Imagemagick package check <a href="http://www.imagemagick.org/script/convert.php">http://www.imagemagick.org/script/convert.php</a>. */ Index: gazebo.dox =================================================================== RCS file: /cvsroot/playerstage/code/gazebo/manual/gazebo.dox,v retrieving revision 1.26 retrieving revision 1.27 diff -C2 -d -r1.26 -r1.27 *** gazebo.dox 3 Mar 2006 21:11:04 -0000 1.26 --- gazebo.dox 27 Aug 2006 15:27:26 -0000 1.27 *************** *** 402,406 **** player.html \ ../utils \ ! plugin_models.html static_models.html standards.html \ ../libgazebo/gazebo.h \ ../server \ --- 402,407 ---- player.html \ ../utils \ ! plugin_models.html static_models.html create_mpeg.html \ ! standards.html \ ../libgazebo/gazebo.h \ ../server \ |