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)
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;
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) .
".");
259 $spi = pathinfo($a_file);
262 $target_dir = ($a_target_dir !=
"")
266 $target_file = $target_dir .
"/" . $a_target_filename;
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) .
".");
An exception for terminatinating execution or to throw for unit testing.
Class for ffmpeg exception handling in ILIAS.
static getSupportedFormatsInfo()
Get all supported formats.
static $formats
Formats handled by ILIAS.
static getPossibleTargetMimeTypes($a_source_mime_type)
Get possible target formats.
static exec($args)
Execute ffmpeg.
static getSupportedCodecsInfo()
Get all supported codecs.
static getTargetMimeTypes()
Get target mime types.
static getCmd()
Get ffmpeg command.
static enabled()
Checks, whether FFmpeg support is enabled (path is set in the setup)
static convert($a_file, $a_target_mime, $a_target_dir="", $a_target_filename="")
Convert file to target mime type.
static getLastReturnValues()
Get last return values.
getFileInfo()
Get file info.
static getSourceMimeTypes()
Get source mime types.
static supportsImageExtraction($a_mime)
Check if mime type supports image extraction.
static extractImage( $a_file, $a_target_filename, $a_target_dir="", $a_sec=1)
Extract image from video file.
static execQuoted($cmd, $args=null)
exec command and fix spaces on windows
static escapeShellArg($a_arg)