You are here

public function PHPVideoToolkit::addVideo in Video 7.2

Same name and namespace in other branches
  1. 7 libraries/phpvideotoolkit/phpvideotoolkit.php5.php \PHPVideoToolkit::addVideo()

This process will combine the original input video with the video specified by this function. This function accepts more than one video as arguments. They will be added in order of the arguments. ie. input_video -> video1 -> video2 etc The process of doing this can take a long time as each incoming video has to be first converted into a format that accepts joining. The default joining codec is "mpg". However for almost lossless quality you can use the "yuv4mpegpipe" format. This is of course dependent upon your ffmpeg binary. You can check to see if you server supports yuv4mpegpipe by typing "ffmpeg -formats" into the command line. If you want to use the yuv4mpegpipe format you can add the flag, FFMPEG_USE_HQ_JOIN to the end of the video inputs. WARNING: High Quality joins will take longer to process. (well duh!)

@access public

Parameters

$video1, $video2, $video3... $video(n) Paths of videos to attach to the input video.:

$flag integer FFMPEG_USE_HQ_JOIN If you wish to use the yuv4mpegpipe format for join add this to the end of the video list.:

File

libraries/phpvideotoolkit/phpvideotoolkit.php5.php, line 2220
Libary to access FFmpeg

Class

PHPVideoToolkit

Code

public function addVideo() {
  $videos = func_get_args();
  $videos_length = count($videos);

  // 			is last arg the hq join flag
  // 			check to see if a starter file has been added, if not set the input as an array
  if ($this->_input_file === NULL) {
    $this->_input_file = array();
  }
  elseif (is_string($this->_input_file)) {
    $this->_input_file = array(
      $this->_input_file,
    );
  }
  foreach ($videos as $key => $file) {
    if (!preg_match('/\\%([0-9]+)d/', $file) && strpos($file, '%d') === FALSE && !is_file($file)) {

      // 					input file not valid
      return $this
        ->_raiseError('addVideo_file_404', array(
        'file' => $file,
      ));

      // <-				exits
    }
    array_push($this->_input_file, $file);

    // 				array_push($this->_input_file, escapeshellarg($file));
  }
}