You are here

public function PHPVideoToolkit::getFileInfo in Video 7.2

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

Returns information about the specified file without having to use ffmpeg-php as it consults the ffmpeg binary directly. This idea for this function has been borrowed from a French ffmpeg class located: http://www.phpcs.com/codesource.aspx?ID=45279

Parameters

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

Return value

FALSE on error encountered, TRUE otherwise

10 calls to PHPVideoToolkit::getFileInfo()
PHPVideoToolkit::execute in libraries/phpvideotoolkit/phpvideotoolkit.php5.php
Commits all the commands and executes the ffmpeg procedure. This will also attempt to validate any outputted files in order to provide some level of stop and check system.
PHPVideoToolkit::extractFrame in libraries/phpvideotoolkit/phpvideotoolkit.php5.php
Extracts exactly one frame
PHPVideoToolkit::extractFrames in libraries/phpvideotoolkit/phpvideotoolkit.php5.php
Extracts frames from a video. (Note; If set to 1 and the duration set by $extract_begin_timecode and $extract_end_timecode is equal to 1 you get more than one frame. For example if you set $extract_begin_timecode='00:00:00' and…
PHPVideoToolkit::extractSegment in libraries/phpvideotoolkit/phpvideotoolkit.php5.php
Extracts a segment of video and/or audio (Note; If set to 1 and the duration set by $extract_begin_timecode and $extract_end_timecode is equal to 1 you get more than one frame. For example if you set $extract_begin_timecode='00:00:00' and…
PHPVideoToolkit::fileHasAudio in libraries/phpvideotoolkit/phpvideotoolkit.php5.php
Determines if the input media has an audio stream.

... See full list

File

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

Class

PHPVideoToolkit

Code

public function getFileInfo($file = FALSE) {

  // if the file has not been specified check to see if an input file has been specified
  if ($file === FALSE) {
    if (!$this->_input_file) {
      return $this
        ->_raiseError('getFileInfo_no_input');
    }
    $file = $this->_input_file;
  }
  $file = escapeshellarg($file);

  // create a hash of the filename
  $hash = md5($file);

  // check to see if the info has already been generated
  if (isset(self::$_file_info[$hash]) === TRUE) {
    return self::$_file_info[$hash];
  }

  // execute the ffmpeg lookup
  $buffer = $this
    ->_captureExecBuffer($this->_ffmpeg_binary . ' -i ' . $file);
  $buffer = implode("\r\n", $buffer);
  $data = $this
    ->parseFileInfo($buffer);

  // check that some data has been obtained
  if (empty($data)) {
    $data = FALSE;
  }
  else {
    $data['_raw_info'] = $buffer;
  }

  // cache info and return
  return self::$_file_info[$hash] = $data;
}