A start on video thumbnailing; see #400
Almost certainly not working yet; not tested, just committing so that other people have something to work with and we aren't duplicating effort
This commit is contained in:
parent
f72bfbb050
commit
6c9a4a3b86
1 changed files with 21 additions and 1 deletions
|
@ -18,7 +18,27 @@
|
|||
|
||||
class VideoFileHandler extends DataHandlerExtension {
|
||||
protected function create_thumb($hash) {
|
||||
copy("ext/handle_video/thumb.jpg", warehouse_path("thumbs", $hash));
|
||||
global $config;
|
||||
|
||||
$w = $config->get_int("thumb_width");
|
||||
$h = $config->get_int("thumb_height");
|
||||
$q = $config->get_int("thumb_quality");
|
||||
|
||||
$inname = warehouse_path("images", $hash);
|
||||
$outname = warehouse_path("thumbs", $hash);
|
||||
|
||||
switch($config->get_string("video_thumb_engine")) {
|
||||
default:
|
||||
case 'static':
|
||||
copy("ext/handle_video/thumb.jpg", $outname);
|
||||
break;
|
||||
case 'ffmpeg':
|
||||
$ffmpeg = $config->get_string("thumb_ffmpeg_path");
|
||||
$cmd = "$ffmpeg -i $inname -s {$w}x{$h} -ss 00:00:00.0 -f image2 -vframes 1 $outname"
|
||||
exec($cmd, $output, $ret);
|
||||
log_debug('handle_video', "Generating thumbnail with command `$cmd`, returns $ret");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected function supported_ext($ext) {
|
||||
|
|
Reference in a new issue