Jump to content

Saving FLV Thumbnails


rondog

Recommended Posts

Hey guys,

I have a fairly large FLV database and I am using FFMPEG to create thumbnails dynamically so when a user uploads an FLV, it will automatically create a thumbnail. That works perfectly for me right now. My concern is that it calls createthumb.php every time in turn calling the ffmpeg program(in other words it isnt caching):

 

<?php
header("Content-type: image/jpeg");
$moviefile = $_GET['source'];
$mov = new ffmpeg_movie($moviefile,false);
$img = $mov->getFrame(50);
$showImg = $img->toGDImage();
$mkNewImg = new ffmpeg_frame($showImg);

$maxWid = 150;
$oldWid = $mkNewImg->getWidth();
$oldHgt = $mkNewImg->getHeight();
$movRatio = $oldWid/$oldHgt;

if($oldWid > $maxWid) {
$newWid = $maxWid;
}

$newHgt = $newWid / $movRatio;

$mkNewImg->resize($newWid,$newHgt);
$newImg = $mkNewImg->toGDImage();
imagejpeg($newImg, $mkThumbFile,40);
imagedestroy($newImg);
?>

 

I am not sure how much overhead it produces, but I think what I would like to achieve is for the first time around, run this createthumb.php and actually store this thumbnail on the server, insert it into the database and then so the next time the user sees the flv it will first check if it has already been created and if not run createthumb.php

 

any ideas?

Link to comment
https://forums.phpfreaks.com/topic/100163-saving-flv-thumbnails/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.