国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 編程 > PHP > 正文

php操作flv文件獲取截圖的方法

2020-03-22 18:22:35
字體:
來源:轉載
供稿:網友
這篇文章主要介紹了PHP從FLV文件獲取視頻預覽圖的方法,實例分析了php操作flv文件獲取截圖的技巧,具有一定參考借鑒價值,需要的朋友可以參考下

本文實例講述了PHP從FLV文件獲取視頻預覽圖的方法。具體實現方法如下:

代碼如下:

 ?php// references http://www.longtailvideo.com/support/forum/Modules/12661/External-PHP-with-FFmpeg-using-readfile-// generate a preview image from an FLV file on-the-fly, or to save// call with: ffmpeg_image.php?file=video.flv time=00:00:05 browser=true// call with: ffmpeg_image.php?file=video.flv percent=75.3 browser=true// no time defaults to 00:00:01 (one second), no browser defaults to true $videofile = (isset($_GET[ file ])) ? strval($_GET[ file ]) : video.flv $image = substr($videofile, 0, strlen($videofile) - 4);$time = (isset($_GET[ time ])) ? strval($_GET[ time ]) : 00:00:01 // debug ( File: , $videofile);// debug ( Image: , $image);// debug ( Time: , $time);// check time formatif (!preg_match( //d/d:/d/d:/d/d/ , $time)) $time = 00:00:00 if (isset($_GET[ percent ])) $percent = $_GET[ percent // debug ( Percent: , $percent); ob_start(); exec( /usr/bin/ffmpeg -i / . $videofile . / 2 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 -  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中流的基本知識

PHP中html' target='_blank'>static關鍵字的定義、遲綁定以及與self關鍵字的區別

PHP單例模式的概念及特點

以上就是php操作flv文件獲取截圖的方法的詳細內容,PHP教程

鄭重聲明:本文版權歸原作者所有,轉載文章僅為傳播更多信息之目的,如作者信息標記有誤,請第一時間聯系我們修改或刪除,多謝。

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 山阴县| 定日县| 临漳县| 哈巴河县| 铁力市| 游戏| 黄龙县| 宜城市| 饶平县| 平山县| 淮安市| 金门县| 揭阳市| 平乐县| 利津县| 江阴市| 山西省| 永泰县| 英吉沙县| 棋牌| 安仁县| 铜山县| 梁平县| 维西| 长丰县| 长寿区| 姚安县| 交城县| 淳安县| 山东省| 合肥市| 北宁市| 汉阴县| 皋兰县| 雅安市| 准格尔旗| 道孚县| 大邑县| 娱乐| 乌鲁木齐县| 绵竹市|