proper thumbnail scaling

git-svn-id: http://yolanda.mister-muffin.de/svn@103 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
josch 2007-10-20 10:23:54 +00:00
parent 04c5926e86
commit 4d82b80a2e

View file

@ -138,7 +138,16 @@ while(1)
#create thumbnail #create thumbnail
$thumbnailsec = int($duration/3 + .5); $thumbnailsec = int($duration/3 + .5);
system "ffmpeg -i $gnutube_root/tmp/$id -vcodec mjpeg -vframes 1 -an -f rawvideo -ss $thumbnailsec -s 320x240 $gnutube_root/video-stills/$id";
#the width/height calculation could of course be much shorter but less readable then
$tnwidth = 160;
$tnheight = int(160*($height/$width) + .5);
if($tnheight > 120)
{
$tnheight = 120;
$tnwidth = int(120*($width/$height) + .5);
}
system "ffmpeg -i $gnutube_root/tmp/$id -vcodec mjpeg -vframes 1 -an -f rawvideo -ss $thumbnailsec -s ".$tnwidth."x$tnheight $gnutube_root/video-stills/$id";
#check if the upload already is in the right format #check if the upload already is in the right format
if ($container eq 'ogg' and $video eq 'theora' and $audio eq 'vorbis') if ($container eq 'ogg' and $video eq 'theora' and $audio eq 'vorbis')