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

首頁 > 編程 > PHP > 正文

php使用ffmpeg獲取視頻信息并截圖的實現方法

2020-03-22 17:54:00
字體:
來源:轉載
供稿:網友
本文實例講述了php使用ffmpeg獲取視頻信息并截圖的方法。分享給大家供大家參考,具體如下:$movie = new ffmpeg_movie('4.mp4');$width=$movie- getFrameWidth();$height=$movie- getFrameHeight();$count= $movie- getFrameCount();print $count . '';$n = round ( $count/16 );print $n . '';for ( $i = 1; $i $i ++ ) { $img = 'screencap' . $i . '.png'; $x = $n * $i; $f = $movie- getFrame($x); $gd_image = $f- toGDImage(); imagepng($gd_image, $img); imagedestroy($gd_image); echo "$extension = "ffmpeg";$extension_soname = $extension . "." . PHP_SHLIB_SUFFIX;$extension_fullname = PHP_EXTENSION_DIR . "/" . $extension_soname;// load extensionif (!extension_loaded($extension)) { dl($extension_soname) or die("Can't load extension $extension_fullname/n");if (php_sapi_name() != 'cli') { echo 'printf("ffmpeg-php version string: %s/n", FFMPEG_PHP_VERSION_STRING);printf("ffmpeg-php build date string: %s/n", FFMPEG_PHP_BUILD_DATE_STRING);printf("libavcodec build number: %d/n", LIBAVCODEC_BUILD_NUMBER);printf("libavcodec version number: %d/n", LIBAVCODEC_VERSION_NUMBER);print_html' target='_blank'>class_methods("ffmpeg_movie");print_class_methods("ffmpeg_frame");// get an array for movies from the test media directory$movies = getDirFiles(dirname(__FILE__) . '/tests/test_media');echo "--------------------/n/n";foreach($movies as $movie) { $mov = new ffmpeg_movie($movie); printf("file name = %s/n", $mov- getFileName()); printf("duration = %s seconds/n", $mov- getDuration()); printf("frame count = %s/n", $mov- getFrameCount()); printf("frame rate = %0.3f fps/n", $mov- getFrameRate()); printf("comment = %s/n", $mov- getComment()); printf("title = %s/n", $mov- getTitle()); printf("author = %s/n", $mov- getAuthor()); printf("copyright = %s/n", $mov- getCopyright()); printf("get bit rate = %d/n", $mov- getBitRate()); printf("has audio = %s/n", $mov- hasAudio() == 0 'No' : 'Yes'); if ($mov- hasAudio()) { printf("get audio stream id= %s/n", $mov- getAudioStreamId()); printf("get audio codec = %s/n", $mov- getAudioCodec()); printf("get audio bit rate = %d/n", $mov- getAudioBitRate()); printf("get audio sample rate = %d /n", $mov- getAudioSampleRate()); printf("get audio channels = %s/n", $mov- getAudioChannels()); printf("has video = %s/n", $mov- hasVideo() == 0 'No' : 'Yes'); if ($mov- hasVideo()) { printf("frame height = %d pixels/n", $mov- getFrameHeight()); printf("frame width = %d pixels/n", $mov- getFrameWidth()); printf("get video stream id= %s/n", $mov- getVideoStreamId()); printf("get video codec = %s/n", $mov- getVideoCodec()); printf("get video bit rate = %d/n", $mov- getVideoBitRate()); printf("get pixel format = %s/n", $mov- getPixelFormat()); printf("get pixel aspect ratio = %s/n", $mov- getPixelAspectRatio()); $frame = $mov- getFrame(10); printf("get frame = %s/n", is_object($frame) 'true' : 'false'); printf(" get frame number = %d/n", $mov- getFrameNumber()); printf(" get frame width = %d/n", $frame- getWidth()); printf(" get frame height = %d/n", $frame- getHeight()); echo "/n--------------------/n/n";if (php_sapi_name() != 'cli') { echo '';/* FUNCTIONS */function print_class_methods($class) { echo "/nMethods available in class '$class':/n"; $methods = get_class_methods($class); if (is_array($methods)) { foreach($methods as $method) { echo $method . "/n"; } else { echo "No Methods Defined/n";function getDirFiles($dirPath) if ($handle = opendir($dirPath)) while (false !== ($file = readdir($handle))) { $fullpath = $dirPath . '/' . $file; if (!is_dir($fullpath) && $file != "CVS" && $file != "." && $file != "..") $filesArr[] = trim($fullpath); closedir($handle); return $filesArr;
更多關于PHP相關內容感興趣的讀者可查看本站專題:《PHP圖形與圖片操作技巧匯總》、《php操作office文檔技巧總結(包括word,excel,access,ppt)》、《php日期與時間用法總結》、《php面向對象程序設計入門教程》、《php字符串(string)用法總結》、《php+mysql數據庫操作入門教程》及《php常見數據庫操作技巧匯總》希望本文所述對大家PHP程序設計有所幫助。PHP教程

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

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 贞丰县| 当涂县| 潍坊市| 德兴市| 南昌县| 雅安市| 安徽省| 庆安县| 新营市| 顺平县| 环江| 民县| 吐鲁番市| 阜城县| 宁化县| 余庆县| 武鸣县| 金沙县| 兖州市| 小金县| 比如县| 治县。| 大余县| 甘谷县| 东阿县| 日喀则市| 惠东县| 外汇| 阳朔县| 老河口市| 通江县| 堆龙德庆县| 贡山| 万载县| 汝城县| 甘南县| 阜新市| 峨边| 张家界市| 怀远县| 福安市|