You are here

public function PHPVideoToolkit::setInputFile in Video 7.2

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

Sets the input file that is going to be manipulated.

@access public

Parameters

string $file The absolute path of the file that is required to be manipulated.:

mixed $input_frame_rate If 0 (default) then no input frame rate is set, if FALSE it is automatically retrieved, otherwise: any other integer will be set as the incoming frame rate.

Return value

boolean FALSE on error encountered, TRUE otherwise

1 call to PHPVideoToolkit::setInputFile()
PHPVideoToolkit::prepareImagesForConversionToVideo in libraries/phpvideotoolkit/phpvideotoolkit.php5.php
Compiles an array of images into a video. This sets the input file (setInputFile) so you do not need to set it. The images should be a full absolute path to the actual image file. NOTE 1; This copies and renames all the supplied images into a…

File

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

Class

PHPVideoToolkit

Code

public function setInputFile($file, $input_frame_rate = 0, $validate_decode_codecs = TRUE) {
  $files_length = count($file);

  // 			if the total number of files entered is 1 then only one file is being processed
  if ($files_length == 1) {

    //				check the input file, if there is a %d in there or a similar %03d then the file inputted is a sequence, if neither of those is found
    //				then qheck to see if the file exists
    if (!preg_match('/\\%([0-9]+)d/', $file) && strpos($file, '%d') === FALSE && !is_file($file)) {

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

      // <-				exits
    }
    $escaped_name = $file;

    // 				$escaped_name = escapeshellarg($files[0]);
    $this->_input_file = $escaped_name;
    $this->_input_file_id = md5($escaped_name);
    if ($input_frame_rate !== 0) {
      $info = $this
        ->getFileInfo();
      if (isset($info['video']) === TRUE) {
        if ($input_frame_rate === FALSE) {
          $input_frame_rate = $info['video']['frame_rate'];
        }

        // 						input frame rate is a command hack
        $this
          ->addCommand('-r', $input_frame_rate, TRUE);
      }
    }
  }
  else {

    // 				more than one video is being added as input so we must join them all
    call_user_func_array(array(
      &$this,
      'addVideo',
    ), array(
      $file,
      $input_frame_rate,
    ));
  }
  return TRUE;
}