21 "video/3pgg" => array(
25 "video/x-flv" => array(
32 "parameters" =>
"-vcodec libx264 -strict experimental -acodec aac -sameq -ab 56k -ar 48000",
35 "video/webm" => array(
38 "parameters" =>
"-strict experimental -vcodec libvpx -acodec vorbis -ac 2 -sameq -ab 56k -ar 48000",
53 if (defined(
"PATH_TO_FFMPEG") && PATH_TO_FFMPEG !=
"") {
72 if (
$f[
"target"] ==
true) {
89 if (
$f[
"source"] ==
true) {
103 if (in_array($a_mime, self::getSourceMimeTypes())) {
118 if (in_array($a_source_mime_type, self::getSourceMimeTypes())) {
119 foreach (self::getTargetMimeTypes() as $tm) {
120 if ($tm != $a_source_mime_type) {
134 return PATH_TO_FFMPEG;
143 public static function exec($args)
155 $codecs = self::exec(
"-codecs");
194 public static function convert($a_file, $a_target_mime, $a_target_dir =
"", $a_target_filename =
"")
199 include_once(
"./Services/MediaObjects/exceptions/class.ilFFmpegException.php");
203 $spi = pathinfo($a_file);
206 $target_dir = ($a_target_dir !=
"")
211 $target_filename = ($a_target_filename !=
"")
213 : $spi[
'filename'] .
"." .
self::$formats[$a_target_mime][
"suffix"];
215 $target_file = $target_dir .
"/" . $target_filename;
219 $ret = self::exec($cmd .
" 2>&1");
220 self::$last_return =
$ret;
222 if (is_file($target_file)) {
225 include_once(
"./Services/MediaObjects/exceptions/class.ilFFmpegException.php");
226 throw new ilFFmpegException(
"It was not possible to convert file " . basename($a_file) .
".");
239 return self::$last_return;
259 $spi = pathinfo($a_file);
262 $target_dir = ($a_target_dir !=
"")
266 $target_file = $target_dir .
"/" . $a_target_filename;
271 $ret = self::exec($cmd .
" 2>&1");
272 self::$last_return =
$ret;
274 if (is_file($target_file)) {
277 include_once(
"./Services/MediaObjects/exceptions/class.ilFFmpegException.php");
278 throw new ilFFmpegException(
"It was not possible to extract an image from " . basename($a_file) .
".");
static getTargetMimeTypes()
Get target mime types.
static getLastReturnValues()
Get last return values.
getFileInfo()
Get file info.
static convert($a_file, $a_target_mime, $a_target_dir="", $a_target_filename="")
Convert file to target mime type.
static getSupportedCodecsInfo()
Get all supported codecs.
Class for ffmpeg exception handling in ILIAS.
static getSourceMimeTypes()
Get source mime types.
static getSupportedFormatsInfo()
Get all supported formats.
static getCmd()
Get ffmpeg command.
static $formats
Formats handled by ILIAS.
static extractImage( $a_file, $a_target_filename, $a_target_dir="", $a_sec=1)
Extract image from video file.
static getPossibleTargetMimeTypes($a_source_mime_type)
Get possible target formats.
static execQuoted($cmd, $args=null)
exec command and fix spaces on windows
static exec($args)
Execute ffmpeg.
static escapeShellArg($a_arg)
static enabled()
Checks, whether FFmpeg support is enabled (path is set in the setup)
static supportsImageExtraction($a_mime)
Check if mime type supports image extraction.