ffmpeg-php擴展

php視頻縮略圖,較經常使用的是ffmpeg-phpphp

1: 安裝 ffmpeghtml

ffmpeg的下載連接  http://ffmpeg.org/download.htmlgit

解壓安裝包github

tar -jxvf ffmpeg-x.x.tar.bz2centos

進入目錄php7

cd ffmpeg-x.xui

編譯安裝centos7

./configure --enable-shared && make && make install.net

安裝完成以後 執行 ffmpeg -versioncode

若是可以出現相似下列信息,說明ffmpeg安裝成功。

ffmpeg version 2.5.11 Copyright (c) 2000-2016 the FFmpeg developers
built on Apr 17 2017 16:47:15 with gcc 4.8.5 (GCC) 20150623 (Red Hat 4.8.5-11)
configuration: --enable-shared
libavutil      54. 15.100 / 54. 15.100
libavcodec     56. 13.100 / 56. 13.100
libavformat    56. 15.102 / 56. 15.102
libavdevice    56.  3.100 / 56.  3.100
libavfilter     5.  2.103 /  5.  2.103
libswscale      3.  1.101 /  3.  1.101
libswresample   1.  1.100 /  1.  1.100

 2 安裝ffmpeg-php

官方的下載連接

https://sourceforge.net/projects/ffmpeg-php/files/ffmpeg-php/

官方版本已經好久好久不更新了,我在centos 7 + php5.6&php7.1   centos6.5+php5  試了都不行。在configure完 make的時候會報錯。

後來在github上找了一個版本。在centos7.2+php5.5.6 上編譯安裝成功 (centos7 + php7.1仍是不行)

地址:    git clone https://github.com/tony2001/ffmpeg-php.git 

也能夠訪問個人百度雲盤進行下載

https://pan.baidu.com/s/1skQTVlj

進入 ffmpeg-php目錄 進行編譯擴展

/usr/local/php/bin/phpize   

./configure --with-php-config=/usr/local/php/bin/php-config

make && make install

注意(若是make以後出現錯誤,那就是ffmpeg-php版本的問題,別再折騰了,換版本吧(或者下降php版本試試))。

在php的配置文件 php.ini中 添加  

extension=ffmpeg.so

重啓php。在 phpinfo()中查看有無ffmpeg信息。

有的話就OK

或者執行 

/usr/local/php/bin/php -i |grep ffmpeg

 要是有輸出的話OK

相關文章
相關標籤/搜索