title: problem generating thumbnail in php from flv
body: <p>I am trying to generate a thumbnail from a flv file, but it's not working....as in, there is no thumbnail file being created in the tmp folder:</p>
  
  <pre><code>function getVideoDuration( $vid )
  {
      global $config;
  
      $flv = $config['FLVDO_DIR']. '/' .$vid. '.flv';
      if ( file_exists($flv) ) {
          exec($config['mplayer']. ' -vo null -ao null -frames 0 -identify "' .$flv. '"', $p);
          while ( list($k,$v) = each($p) ) {
              if ( $length = strstr($v, 'ID_LENGTH=') ) {
                  break;
              }
          }
  
          $lx = explode('=', $length);
  
          return $lx['1'];
      }
  
      return false;
  }
  
  function regenVideoThumbs( $vid )
  {
      global $config;
  
      $err        = NULL;
      $duration   = getVideoDuration($vid);
      if ( !$duration ) {
          $err = 'Failed to get video duration! Converted video not found!?';
      }
  
      $fc     = 0;
      $flv    = $config['FLVDO_DIR']. '/' .$vid. '.flv';
      if ( $err == '' ) {
          settype($duration, 'float');
          $timers = array(ceil($duration/2), ceil($duration/2), ceil($duration/3), ceil($duration/4));
          @mkdir($config['TMP_DIR']. '/thumbs/' .$vid);
  
          foreach ( $timers as $timer ) {
              if ( $config['thumbs_tool'] == 'ffmpeg' ) {
                  $cmd = $config['ffmpeg']. ' -i ' .$flv. ' -f image2 -ss ' .$timer. ' -s ' .$config['img_max_width']. 'x' .$config['img_max_height']. ' -vframes 2 -y ' .$config['TMP_DIR']. '/thumbs/' .$vid. '/%08d.jpg';
              } else {
                  $cmd = $config['mplayer']. ' ' .$flv. ' -ss ' .$timer. ' -nosound -vo jpeg:outdir=' .$config['TMP_DIR']. '/thumbs/' .$vid. ' -frames 2';
              }
              exec($cmd); echo $cmd; die();
              $tmb    = ( $fc == 0 ) ? $vid : $fc. '_' .$vid;
              $fd     = $config['TMB_DIR']. '/' .$tmb. '.jpg';
              $ff     = $config['TMP_DIR']. '/thumbs/' .$vid. '/00000002.jpg';
              if ( !file_exists($ff) )
                  $ff = $config['TMP_DIR']. '/thumbs/' .$vid. '/00000001.jpg';
              if ( !file_exists($ff) )
                  $ff = $config['BASE_DIR']. '/images/default.gif';
  
              createThumb($ff, $fd, $config['img_max_width'], $config['img_max_height']);
              ++$fc;
          }
      }
  
      return $err;
  }
  </code></pre>
  
  <p>On running this, I always end up with <code>$ff</code> being set to </p>
  
  <pre><code>$config['BASE_DIR']. '/images/default.gif'; 
  </code></pre>
  
  <p>For testing purposes I added in the echo after the command is executed... and it shows</p>
  
  <pre><code>/usr/local/bin/mplayer /home/localtesttube/public_html/dev/flvideo/1251.flv -ss 10 -nosound -vo jpeg:outdir=/home/localtesttube/public_html/dev/tmp/thumbs/1251 -frames 2
  </code></pre>