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:
Shish 2014-04-10 08:14:17 +01:00
parent f72bfbb050
commit 6c9a4a3b86

View file

@ -18,7 +18,27 @@
class VideoFileHandler extends DataHandlerExtension { class VideoFileHandler extends DataHandlerExtension {
protected function create_thumb($hash) { 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) { protected function supported_ext($ext) {