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 foreach (self::$formats as $k => $f)
74 if ($f[
"target"] ==
true)
91 foreach (self::$formats as $k => $f)
93 if ($f[
"source"] ==
true)
108 if (in_array($a_mime, self::getSourceMimeTypes()))
124 if (in_array($a_source_mime_type, self::getSourceMimeTypes()))
126 foreach (self::getTargetMimeTypes() as $tm)
128 if ($tm != $a_source_mime_type)
143 return PATH_TO_FFMPEG;
164 $codecs = self::exec(
"-codecs");
203 static function convert($a_file, $a_target_mime, $a_target_dir =
"", $a_target_filename =
"")
207 if (self::$formats[$a_target_mime][
"target"] !=
true)
209 include_once(
"./Services/MediaObjects/exceptions/class.ilFFmpegException.php");
212 $pars = self::$formats[$a_target_mime][
"parameters"];
213 $spi = pathinfo($a_file);
216 $target_dir = ($a_target_dir !=
"")
221 $target_filename = ($a_target_filename !=
"")
223 : $spi[
'filename'].
".".self::$formats[$a_target_mime][
"suffix"];
225 $target_file = $target_dir.
"/".$target_filename;
230 self::$last_return =
$ret;
232 if (is_file($target_file))
238 include_once(
"./Services/MediaObjects/exceptions/class.ilFFmpegException.php");
239 throw new ilFFmpegException(
"It was not possible to convert file ".basename($a_file).
".");
252 return self::$last_return;
264 static function extractImage($a_file, $a_target_filename, $a_target_dir =
"",
269 $spi = pathinfo($a_file);
272 $target_dir = ($a_target_dir !=
"")
276 $target_file = $target_dir.
"/".$a_target_filename;
279 $cmd =
"-y -i ".ilUtil::escapeShellArg($a_file).
" -r 1 -f image2 -vframes 1 -ss ".$sec.
" ".
ilUtil::escapeShellArg($target_file);
282 self::$last_return =
$ret;
284 if (is_file($target_file))
290 include_once(
"./Services/MediaObjects/exceptions/class.ilFFmpegException.php");
291 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 execQuoted($cmd, $args=NULL)
exec command and fix spaces on windows
static getSourceMimeTypes()
Get source mime types.
static getSupportedFormatsInfo()
Get all supported formats.
static getCmd()
Get ffmpeg command.
static extractImage($a_file, $a_target_filename, $a_target_dir="", $a_sec=1)
Extract image from video file.
static $formats
Formats handled by ILIAS.
static getPossibleTargetMimeTypes($a_source_mime_type)
Get possible target formats.
Create styles array
The data for the language used.
static exec($args)
Execute ffmpeg.
static escapeShellArg($a_arg)
static enabled()
Checks, whether FFmpeg support is enabled (path is set in the setup)
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
static supportsImageExtraction($a_mime)
Check if mime type supports image extraction.