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;
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).
".");
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).
".");