This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
More...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Learning e.V.
ILIAS is licensed with the GPL-3.0, see https://www.gnu.org/licenses/gpl-3.0.en.html You should have received a copy of said license along with the source code, too.
If this is not the case or you just want to try ILIAS, you'll find us at: https://www.ilias.de https://github.com/ILIAS-eLearning FFmpeg wrapper
- Author
- Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de
Definition at line 23 of file class.ilFFmpeg.php.
◆ enabled()
static ilFFmpeg::enabled |
( |
| ) |
|
|
static |
Checks, whether FFmpeg support is enabled (path is set in the setup)
Definition at line 61 of file class.ilFFmpeg.php.
61 : bool
62 {
63 if (defined("PATH_TO_FFMPEG") && PATH_TO_FFMPEG != "") {
64 return true;
65 }
66 return false;
67 }
Referenced by ilDclMobRecordFieldModel\parseValue().
◆ escapeShellArg()
static ilFFmpeg::escapeShellArg |
( |
string |
$a_arg | ) |
|
|
staticprotected |
Definition at line 121 of file class.ilFFmpeg.php.
121 : string
122 {
123 setlocale(
124 LC_CTYPE,
125 "UTF8",
126 "en_US.UTF-8"
127 );
128
129 return escapeshellarg($a_arg);
130 }
◆ exec()
static ilFFmpeg::exec |
( |
string |
$args | ) |
|
|
staticprotected |
Definition at line 104 of file class.ilFFmpeg.php.
104 : array
105 {
106 $win = (stripos(php_uname(), "win") === 0);
108 if ($win && str_contains($cmd, " ") && $cmd[0] !== '"') {
109 $cmd = '"' . $cmd . '"';
110 if ($args) {
111 $cmd .= " " . $args;
112 }
113 } elseif ($args) {
114 $cmd .= " " . $args;
115 }
116 $arr = [];
118 return $arr;
119 }
static getCmd()
Get ffmpeg command.
static exec(string $args)
◆ extractImage()
static ilFFmpeg::extractImage |
( |
string |
$a_file, |
|
|
string |
$a_target_filename, |
|
|
string |
$a_target_dir = "" , |
|
|
int |
$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!) |
int | $a_sec | |
- Returns
- string new file (full path)
- Exceptions
-
Definition at line 151 of file class.ilFFmpeg.php.
156 : string {
157 $spi = pathinfo($a_file);
158
159
160 $target_dir = ($a_target_dir != "")
161 ? $a_target_dir
162 : $spi['dirname'];
163
164 $target_file = $target_dir . "/" . $a_target_filename;
165
166 $sec = $a_sec;
168 $a_file
171 self::$last_return = $ret;
172
173 if (is_file($target_file)) {
174 return $target_file;
175 } else {
176 throw new ilFFmpegException(
"It was not possible to extract an image from " . basename($a_file) .
".");
177 }
178 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static escapeShellArg(string $a_arg)
Referenced by ilDclMobRecordFieldModel\parseValue().
◆ extractPNGFromVideoInZip()
static ilFFmpeg::extractPNGFromVideoInZip |
( |
string |
$zip, |
|
|
string |
$path, |
|
|
int |
$sec = 1 |
|
) |
| |
|
static |
Definition at line 180 of file class.ilFFmpeg.php.
184 : string {
189
190 $command1 = "unzip -p $zip $path > $tmp_file";
191 shell_exec($command1);
192 $command2 = "ffmpeg -i $tmp_file -f image2 -vframes 1 -ss $sec -vcodec png pipe:1";
193
194 $ret = (string) shell_exec($command2);
195 unlink($tfile);
196 return $ret;
197 }
static escapeShellArg(string $a_arg)
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
◆ getCmd()
static ilFFmpeg::getCmd |
( |
| ) |
|
|
staticprivate |
Get ffmpeg command.
Definition at line 99 of file class.ilFFmpeg.php.
99 : string
100 {
101 return PATH_TO_FFMPEG;
102 }
◆ getLastReturnValues()
static ilFFmpeg::getLastReturnValues |
( |
| ) |
|
|
static |
Get last return values.
Definition at line 136 of file class.ilFFmpeg.php.
136 : ?array
137 {
139 }
static array $last_return
◆ getSourceMimeTypes()
static ilFFmpeg::getSourceMimeTypes |
( |
| ) |
|
|
static |
- Returns
- string[]
Definition at line 72 of file class.ilFFmpeg.php.
72 : array
73 {
74 $ttypes = array();
75 foreach (self::$formats as $k =>
$f) {
76 if (
$f[
"source"] ==
true) {
77 $ttypes[] = $k;
78 }
79 }
80 return $ttypes;
81 }
References Vendor\Package\$f.
◆ supportsImageExtraction()
static ilFFmpeg::supportsImageExtraction |
( |
string |
$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"
)
)
Definition at line 34 of file class.ilFFmpeg.php.
◆ $last_return
array ilFFmpeg::$last_return = array() |
|
static |
The documentation for this class was generated from the following file: