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:
josch 2008-04-07 14:19:06 +00:00
parent 23a16e7484
commit 3bc4efe274
4 changed files with 9 additions and 5 deletions

View file

@ -93,7 +93,8 @@ sub fill_results
#before code cleanup, this was a really obfuscated array/hash creation #before code cleanup, this was a really obfuscated array/hash creation
push @{ $page->{'results'}->{'result'} }, 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, 'duration' => $duration,
'viewcount' => $viewcount, 'viewcount' => $viewcount,
'rdf:RDF' => 'rdf:RDF' =>

View file

@ -143,7 +143,8 @@ while(1)
$duration = int($1*3600 + $2*60 + $3 + $4/10 + .5); $duration = int($1*3600 + $2*60 + $3 + $4/10 + .5);
#create thumbnail #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 #the width/height calculation could of course be much shorter but less readable then
#all thumbs have equal height #all thumbs have equal height
@ -151,7 +152,8 @@ while(1)
$tnheight = $tnmaxheight; $tnheight = $tnmaxheight;
$tnwidth = int($tnheight*($width/$height)/2 + .5)*2; $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; $vmaxheight = 640;

View file

@ -32,7 +32,7 @@ if($userinfo->{'username'})
{ {
$subject.=$tag." "; $subject.=$tag." ";
} }
$page->{'uploadform'}->{'DC.Subject'} = $ubject; $page->{'uploadform'}->{'DC.Subject'} = $subject;
$page->{'innerresults'} = ['']; $page->{'innerresults'} = [''];

View file

@ -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 #before code cleanup, this was a really obfuscated array/hash creation
push @{ $page->{'video'} }, push @{ $page->{'video'} },
{ {
'thumbnail' => "$domain/video-stills/$id", 'thumbnail' => "$domain/video-stills/thumbnails/$id",
'preview' => "$domain/video-stills/previews/$id",
'filesize' => $filesize, 'filesize' => $filesize,
'duration' => $duration, 'duration' => $duration,
'width' => $width, 'width' => $width,