Home  >  Article  >  Backend Development  >  Detailed explanation of ffmpeg in php

Detailed explanation of ffmpeg in php

小云云
小云云Original
2018-03-31 09:06:3514053browse

This article mainly shares with you the detailed explanation of ffmpeg in php, I hope it can help you.

ffmpeg-php extension

php video thumbnail, the more commonly used one is ffmpeg-php

1: Install ffmpeg

ffmpeg download link http: //ffmpeg.org/download.html

Extract the installation package

tar -jxvf ffmpeg-x.x.tar.bz2

Enter the directory

cd ffmpeg- x.x

Compile and install

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

After the installation is completed, execute ffmpeg -version

If it can appear Information similar to the following indicates that ffmpeg is installed successfully.

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 Install ffmpeg-php

Official download link

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

The official version has not been updated for a long time. I tried it on centos 7 + php5.6&php7.1 centos6.5+php5 but it didn’t work. An error will be reported when configuring make.

Later I found a version on github. Compiled and installed successfully on centos7.2+php5.5.6 (centos7 + php7.1 still doesn’t work)

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

You can also visit my Baidu cloud disk to download

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

Enter the ffmpeg-php directory to compile and expand

/usr/local/php/bin/phpize

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

make && make install

Note (if an error occurs after make, it is a problem with the ffmpeg-php version. Stop fussing and change the version (or try lowering the php version)).

In the php configuration file php.ini, add

extension=ffmpeg.so

Restart php. Check whether there is ffmpeg information in phpinfo().

If there is, OK

Or execute

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

If there is output, OK

Related recommendations:

PHP Call ffmpeg to take video screenshots and splice script examples to share

php Method to call ffmpeg to obtain video information

php uses ffmpeg to extract the audio and video content Video screen

The above is the detailed content of Detailed explanation of ffmpeg in php. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn