Drupal modules for browsing and managing Fedora-based digital repositories.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

55 lines
1.2 KiB

<?php
14 years ago
// $Id$
14 years ago
/**
* @file
* Ffmpeg wrapper class
*/
14 years ago
/**
* FFMpeg wrapper class for generating movie thumbnails
*
* This Class implements the methods defined in the STANDARD_QT content model
*/
class Ffmpeg {
14 years ago
/**
* Default constructor
*/
function Ffmpeg() {
14 years ago
}
14 years ago
/**
* Extract a thumbnail from the movie
* @param type $parameterArray
* @param type $dsid
* @param type $file
* @param type $file_ext
* @return type
*/
function extract_thumbnail($parameterArray, $dsid, $file, $file_ext) {
14 years ago
$defaults = array('ss' => '00:00:10', 's' => null);
$params = array_merge($defaults, $parameterArray);
$system = getenv('System');
14 years ago
$file_suffix = '_' . $dsid . '.' . $file_ext;
$returnValue = TRUE;
$output = array();
$size = '';
14 years ago
if ($params['s'] != null) {
$size = ' -s ' . escapeshellarg($params['s']);
}
exec('ffmpeg -i ' . escapeshellarg($file) . ' -r 1 -ss ' . escapeshellarg($params['ss']) . ' ' . $size . ' -t 1 ' . escapeshellarg($file . $file_suffix));
if (!file_exists($file . $file_suffix)) {
return false;
}
$_SESSION['fedora_ingest_files']["$dsid"] = $file . $file_suffix;
return TRUE;
}
14 years ago
}