private function PHPVideoToolkit::_captureExecBuffer in Video 7.2
Same name and namespace in other branches
- 7 libraries/phpvideotoolkit/phpvideotoolkit.php5.php \PHPVideoToolkit::_captureExecBuffer()
3 calls to PHPVideoToolkit::_captureExecBuffer()
- 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::getFFmpegInfo in libraries/
phpvideotoolkit/ phpvideotoolkit.php5.php - Returns information about the specified file without having to use ffmpeg-php as it consults the ffmpeg binary directly. NOTE: calling this statically for caching to work you must set the temp directory.
- PHPVideoToolkit::getFileInfo in libraries/
phpvideotoolkit/ phpvideotoolkit.php5.php - 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
File
- libraries/
phpvideotoolkit/ phpvideotoolkit.php5.php, line 537 - Libary to access FFmpeg
Class
Code
private function _captureExecBuffer($command) {
$buffer = array();
$err = 0;
exec($command . ' 2>&1', $buffer, $err);
if ($err !== 127) {
if (isset($buffer[0]) === FALSE) {
$tmp_file = $this->_tmp_directory . '_temp_' . uniqid(time() . '-') . '.txt';
exec($command . ' &>' . $tmp_file, $buffer, $err);
if ($handle = fopen($tmp_file, 'r')) {
$buffer = array();
while (!feof($handle)) {
array_push($buffer, fgets($handle, 4096));
}
fclose($handle);
}
@unlink($tmp_file);
}
}
$this->_command_output[] = array(
'command' => $command,
'output' => implode("\n", $buffer),
);
return $buffer;
}