FFmpeg wrapper.
More...
FFmpeg wrapper.
- Author
- Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
- Version
- $Id$ /
Definition at line 12 of file class.ilFFmpeg.php.
◆ convert()
static ilFFmpeg::convert |
( |
|
$a_file, |
|
|
|
$a_target_mime, |
|
|
|
$a_target_dir = "" , |
|
|
|
$a_target_filename = "" |
|
) |
| |
|
static |
Convert file to target mime type.
- Parameters
-
string | $a_file | source file (full path included) |
string | $a_target_mime | target mime type |
string | $a_target_dir | target directory (no trailing "/") |
string | $a_target_filename | target file name (no path!) |
- Returns
- string new file (full path)
Definition at line 194 of file class.ilFFmpeg.php.
References $formats, $ret, and ilUtil\escapeShellArg().
Referenced by ilObjMediaCastGUI\convertFileObject().
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) .
".");
Class for ffmpeg exception handling in ILIAS.
static escapeShellArg($a_arg)
◆ enabled()
static ilFFmpeg::enabled |
( |
| ) |
|
|
static |
◆ exec()
static ilFFmpeg::exec |
( |
|
$args | ) |
|
|
static |
◆ extractImage()
static ilFFmpeg::extractImage |
( |
|
$a_file, |
|
|
|
$a_target_filename, |
|
|
|
$a_target_dir = "" , |
|
|
|
$a_sec = 1 |
|
) |
| |
|
static |
Extract image from video file.
- Parameters
-
string | $a_file | source file (full path included) |
string | $a_target_dir | target directory (no trailing "/") |
string | $a_target_filename | target file name (no path!) |
- Returns
- string new file (full path)
Definition at line 251 of file class.ilFFmpeg.php.
References $ret, and ilUtil\escapeShellArg().
Referenced by ilObjMediaCastGUI\extractPreviewImageObject(), and ilDclMobRecordFieldModel\parseValue().
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) .
".");
Class for ffmpeg exception handling in ILIAS.
static escapeShellArg($a_arg)
◆ getCmd()
static ilFFmpeg::getCmd |
( |
| ) |
|
|
staticprivate |
◆ getFileInfo()
ilFFmpeg::getFileInfo |
( |
| ) |
|
◆ getLastReturnValues()
static ilFFmpeg::getLastReturnValues |
( |
| ) |
|
|
static |
◆ getPossibleTargetMimeTypes()
static ilFFmpeg::getPossibleTargetMimeTypes |
( |
|
$a_source_mime_type | ) |
|
|
static |
Get possible target formats.
- Parameters
-
Definition at line 115 of file class.ilFFmpeg.php.
118 if (in_array($a_source_mime_type, self::getSourceMimeTypes())) {
119 foreach (self::getTargetMimeTypes() as $tm) {
120 if ($tm != $a_source_mime_type) {
◆ getSourceMimeTypes()
static ilFFmpeg::getSourceMimeTypes |
( |
| ) |
|
|
static |
◆ getSupportedCodecsInfo()
static ilFFmpeg::getSupportedCodecsInfo |
( |
| ) |
|
|
static |
Get all supported codecs.
- Returns
Definition at line 153 of file class.ilFFmpeg.php.
155 $codecs = self::exec(
"-codecs");
◆ getSupportedFormatsInfo()
static ilFFmpeg::getSupportedFormatsInfo |
( |
| ) |
|
|
static |
◆ getTargetMimeTypes()
static ilFFmpeg::getTargetMimeTypes |
( |
| ) |
|
|
static |
Get target mime types.
(Please note, that we do not list all possible encoders here, only the ones that are desired for the use in ILIAS)
- Parameters
-
Definition at line 68 of file class.ilFFmpeg.php.
References $f, and $formats.
72 if (
$f[
"target"] ==
true) {
◆ supportsImageExtraction()
static ilFFmpeg::supportsImageExtraction |
( |
|
$a_mime | ) |
|
|
static |
◆ $formats
Initial value:= array(
"video/3pgg" => array(
"source" => true,
"target" => false
),
"video/x-flv" => array(
"source" => true,
"target" => false
),
"video/mp4" => array(
"source" => true,
"target" => true,
"parameters" => "-vcodec libx264 -strict experimental -acodec aac -sameq -ab 56k -ar 48000",
"suffix" => "mp4"
),
"video/webm" => array(
"source" => true,
"target" => true,
"parameters" => "-strict experimental -vcodec libvpx -acodec vorbis -ac 2 -sameq -ab 56k -ar 48000",
"suffix" => "webm"
)
)
Formats handled by ILIAS.
Note: In general the mime types do not reflect the complexity of media container/codec variants. For source formats no specification is needed here. For target formats we use fixed parameters that should result in best web media practice.
Definition at line 20 of file class.ilFFmpeg.php.
Referenced by getSupportedFormatsInfo().
◆ $last_return
ilFFmpeg::$last_return = array() |
|
static |
The documentation for this class was generated from the following file: