首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >视频嵌入的海报图像

视频嵌入的海报图像
EN

Stack Overflow用户
提问于 2013-12-11 10:19:38
回答 1查看 3.4K关注 0票数 0

在我的主页上,我有4个嵌入式视频。为了减少加载时间,我想要生成缩略图,链接到另一个页面与真正的嵌入式视频。

如何生成这些缩略图?

注意到:

  • 嵌入式视频来自几个视频粉碎网站(每日运动,youtube,vimeo或例如:这段视频 .)
  • 视频每天都由网站管理员添加,他无法为每个视频制作缩略图。
EN

回答 1

Stack Overflow用户

发布于 2014-02-09 07:28:43

如果您需要本地视频的海报/缩略图,可以使用试试这个链接这也能帮上忙来描述如何在php中使用ff-mpeg获取海报图像、大小、长度、标题。

代码语言:javascript
复制
function captureVideoPosterImg($movie_file = '')
{
    extension_loaded('ffmpeg');
    $movie_file = 'E:\wamp new\www\projects\indiemade_live\developer\uploads\comments\11\14\video\04072011094613_24062011234404_s Sporting Goods- Teams Come Alive.flv';
    // Instantiates the class ffmpeg_movie so we can get the information you want the video  
    $movie = new ffmpeg_movie($movie_file);  
    // Get The duration of the video in seconds  
    echo $Duration = round($movie->getDuration(), 0);  
    // Get the number of frames of the video  
    $TotalFrames = $movie->getFrameCount();  
    // Get the height in pixels Video  
    $height = $movie->getFrameHeight();  
    // Get the width of the video in pixels  
    $width = $movie->getFrameWidth();  
    //Receiving the frame from the video and saving 
    // Need to create a GD image ffmpeg-php to work on it  
    $image = imagecreatetruecolor($width, $height);  
    // Create an instance of the frame with the class ffmpeg_frame  
    $Frame = new ffmpeg_frame($image);  
    // Choose the frame you want to save as jpeg  
    $thumbnailOf = (int) round($movie->getFrameCount() / 2.5);  
    // Receives the frame  
    $frame = $movie->GetFrame($thumbnailOf);  
    // Convert to a GD image  
    $image = $frame->toGDImage();  
    // Save to disk.  
    //echo $movie_file.'.jpg';
    imagejpeg($image, $movie_file.'.jpg', 100);

    return $movie_file.'.jpg';
}
票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/20516437

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档