From 94d6461568b154d3c228b91912c431474c6ef184 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Tue, 21 Nov 2017 16:06:03 -0800 Subject: Video thumbnail generator --- Zotlabs/Thumbs/Video.php | 53 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Zotlabs/Thumbs/Video.php (limited to 'Zotlabs/Thumbs/Video.php') diff --git a/Zotlabs/Thumbs/Video.php b/Zotlabs/Thumbs/Video.php new file mode 100644 index 000000000..5e09ef9a3 --- /dev/null +++ b/Zotlabs/Thumbs/Video.php @@ -0,0 +1,53 @@ + Date: Mon, 25 Dec 2017 16:06:24 -0800 Subject: document that imagick calls/execs ffmpeg for mp4 video thumbnails --- Zotlabs/Thumbs/Video.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Thumbs/Video.php') diff --git a/Zotlabs/Thumbs/Video.php b/Zotlabs/Thumbs/Video.php index 5e09ef9a3..d0f72bcdd 100644 --- a/Zotlabs/Thumbs/Video.php +++ b/Zotlabs/Thumbs/Video.php @@ -32,12 +32,18 @@ class Video { fclose($ostream); } + /* + * Note: imagick convert may try to call 'ffmpeg' (or other conversion utilities) under + * the covers for this particular operation. If this is not installed or not in the path + * for the web server user, errors may be reported in the web server logs. + */ + $imagick_path = get_config('system','imagick_convert_path'); if($imagick_path && @file_exists($imagick_path)) { $cmd = $imagick_path . ' ' . escapeshellarg(PROJECT_BASE . '/' . $tmpfile . '[0]') . ' -thumbnail ' . $width . 'x' . $height . ' ' . escapeshellarg(PROJECT_BASE . '/' . $outfile); // logger('imagick thumbnail command: ' . $cmd); - exec($cmd); + @exec($cmd); if(! file_exists($outfile)) { logger('imagick scale failed.'); -- cgit v1.2.3 From 66d0b4d0d57d98540e36e3a9f6fa5ccd84ea5ff9 Mon Sep 17 00:00:00 2001 From: zotlabs Date: Sat, 30 Dec 2017 23:24:24 -0800 Subject: provide warning if ffmpeg not found and video thumbnail is requested --- Zotlabs/Thumbs/Video.php | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'Zotlabs/Thumbs/Video.php') diff --git a/Zotlabs/Thumbs/Video.php b/Zotlabs/Thumbs/Video.php index d0f72bcdd..05127355e 100644 --- a/Zotlabs/Thumbs/Video.php +++ b/Zotlabs/Thumbs/Video.php @@ -38,6 +38,12 @@ class Video { * for the web server user, errors may be reported in the web server logs. */ + + $ffmpeg = trim(shell_exec('which ffmpeg')); + if($ffmpeg) { + logger('ffmpeg not found in path. Video thumbnails may fail.'); + } + $imagick_path = get_config('system','imagick_convert_path'); if($imagick_path && @file_exists($imagick_path)) { $cmd = $imagick_path . ' ' . escapeshellarg(PROJECT_BASE . '/' . $tmpfile . '[0]') . ' -thumbnail ' . $width . 'x' . $height . ' ' . escapeshellarg(PROJECT_BASE . '/' . $outfile); @@ -52,7 +58,7 @@ class Video { @rename($outfile,$file . '.thumb'); } } - + @unlink($tmpfile); } } -- cgit v1.2.3