added random thumbnail and preview generation
git-svn-id: http://yolanda.mister-muffin.de/svn@276 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
parent
23a16e7484
commit
3bc4efe274
4 changed files with 9 additions and 5 deletions
|
@ -93,7 +93,8 @@ sub fill_results
|
|||
#before code cleanup, this was a really obfuscated array/hash creation
|
||||
push @{ $page->{'results'}->{'result'} },
|
||||
{
|
||||
'thumbnail' => $duration == 0 ? "/images/tango/video-x-generic.png" : "/video-stills/$id",
|
||||
'thumbnail' => "$domain/video-stills/thumbnails/$id",
|
||||
'preview' => "$domain/video-stills/previews/$id",
|
||||
'duration' => $duration,
|
||||
'viewcount' => $viewcount,
|
||||
'rdf:RDF' =>
|
||||
|
|
|
@ -143,7 +143,8 @@ while(1)
|
|||
$duration = int($1*3600 + $2*60 + $3 + $4/10 + .5);
|
||||
|
||||
#create thumbnail
|
||||
$thumbnailsec = int($duration/3 + .5);
|
||||
$thumbnailsec = int(rand($duration));
|
||||
$previewsec = $thumbnailsec;
|
||||
|
||||
#the width/height calculation could of course be much shorter but less readable then
|
||||
#all thumbs have equal height
|
||||
|
@ -151,7 +152,8 @@ while(1)
|
|||
$tnheight = $tnmaxheight;
|
||||
$tnwidth = int($tnheight*($width/$height)/2 + .5)*2;
|
||||
|
||||
system "ffmpeg -i /tmp/$id -vcodec mjpeg -vframes 1 -an -f rawvideo -ss $thumbnailsec -s ".$tnwidth."x$tnheight $root/video-stills/$id";
|
||||
system "ffmpeg -i /tmp/$id -vcodec mjpeg -vframes 1 -an -f rawvideo -ss $thumbnailsec -s ".$tnwidth."x$tnheight $root/video-stills/thumbnails/$id";
|
||||
system "ffmpeg -i /tmp/$id -vcodec mjpeg -vframes 1 -an -f rawvideo -ss $previewsec $root/video-stills/previews/$id";
|
||||
|
||||
$vmaxheight = 640;
|
||||
|
||||
|
|
|
@ -32,7 +32,7 @@ if($userinfo->{'username'})
|
|||
{
|
||||
$subject.=$tag." ";
|
||||
}
|
||||
$page->{'uploadform'}->{'DC.Subject'} = $ubject;
|
||||
$page->{'uploadform'}->{'DC.Subject'} = $subject;
|
||||
|
||||
$page->{'innerresults'} = [''];
|
||||
|
||||
|
|
|
@ -128,7 +128,8 @@ if($query->url_param('title') or $query->url_param('id'))
|
|||
#before code cleanup, this was a really obfuscated array/hash creation
|
||||
push @{ $page->{'video'} },
|
||||
{
|
||||
'thumbnail' => "$domain/video-stills/$id",
|
||||
'thumbnail' => "$domain/video-stills/thumbnails/$id",
|
||||
'preview' => "$domain/video-stills/previews/$id",
|
||||
'filesize' => $filesize,
|
||||
'duration' => $duration,
|
||||
'width' => $width,
|
||||
|
|
Loading…
Reference in a new issue