加入收藏 | 设为首页 | 会员中心 | 我要投稿 安卓应用网 (https://www.0791zz.com/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 编程开发 > PHP > 正文

PHP从FLV文件获取视频预览图的方法

发布时间:2020-05-25 16:10:19 所属栏目:PHP 来源:互联网
导读:这篇文章主要介绍了PHP从FLV文件获取视频预览图的方法,实例分析了php操作flv文件获取截图的技巧,具有一定参考借鉴价值,需要的朋友可以参考下

本文实例讲述了PHP从FLV文件获取视频预览图的方法。分享给大家供大家参考。具体实现方法如下:

代码如下:

&1"); $duration = ob_get_contents(); ob_end_clean(); // debug ("Duration: ",$duration); preg_match('/Duration: (.*?),/',$duration,$matches); $duration = $matches[1]; // debug ("Duration: ",$duration); $duration_array = split(':',$duration); $duration = $duration_array[0] * 3600 + $duration_array[1] * 60 + $duration_array[2]; $time = $duration * $percent / 100; // debug (" Time: ",$time); $time = intval($time/3600) . ":" . intval(($time-(intval($time/3600)*3600))/60) . ":" . sprintf("%01.3f",($time-(intval($time/60)*60))); // debug (" Time: ",$time); } $browser = (isset($_GET['browser'])) ? strval($_GET['browser']) : 'true'; // debug (" Browser: ",$browser); if ($browser == "true") { header('Content-Type: image/png'); exec("/usr/bin/ffmpeg -vcodec png -i "" . $videofile . "" -ss " . $time . " -vframes 1 -f image2 -"); //header('Content-Type: image/jpeg'); //exec("/usr/bin/ffmpeg -vcodec mjpeg -i "" . $videofile . "" -ss " . $time . " -vframes 1 -f image2 -"); } else { exec("/usr/bin/ffmpeg -vcodec png -i "" . $videofile . "" -ss " . $time . " -vframes 1 -f image2 "" . $image . ""%d.png"); //exec("/usr/bin/ffmpeg -vcodec mjpeg -i "" . $videofile . "" -ss " . $time . " -vframes 1 -f image2 "" . $image . ""%d.jpg"); } ?>

希望本文所述对大家的php程序设计有所帮助。

(编辑:安卓应用网)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读