REQUIREMENTS
============
ffmpeg-0.4.9pre1 or higher built with the –enable-shared option (ffmpeg cvs recommended)
php-4.3.x or higher
gd-2.0.x or higher or the version of GD bundled with PHP
INSTALLATION INSTRUCTIONS
=========================
These instructions are for Linux since I don’t have windows. If you
successfully build on windows, let me know how you did it and I’ll update
the instructions.
BUILDING FFMPEG
—————
cd /path/to/ffmpeg
./configure –enable-shared –prefix=/usr/local
make clean && make
[become root]
make install
BUILDING FFMPEG-PHP AS A SHARED EXTENSION
—————————————–
1. Build php if not already built or installed by your distro (See the file INSTALL in your php source
directory)
2. Unpack the archive
tar -xjf ffmpeg-php.X.XX.tar.gz
3. cd into the ffmpeg extension directory
cd ffmpeg-php.X.XX/
4. Run phpize (included with your php install) to build configuration files
phpize
5. Configure and build
./configure
在这步将会出现Make sure you’ve built ffmpeg as shared libs using the –enable-shared option错误
Here is the solution:
Step1: cd /usr/local/include/ffmpeg
Check if you have the ffmpeg directory created under /usr/local/include.
I did not have if myself, so I had to create it.
If you do not have it either, then create it and go to step 2.
Step 2:
cp -p /usr/local/src/ffmpeg/libavformat/avio.h /usr/local/include/ffmpeg
cp -p /usr/local/src/ffmpeg/libavformat/avformat.h /usr/local/include/ffmpeg
cp -p /usr/local/src/ffmpeg/libavcodec/avcodec.h /usr/local/include/ffmpeg
Step 3: configure, make, and make install your ffmpeg package. Not
your ffmpeg-php package, that one you do after you do your ffmpeg.
6. Install the shared extension
make
make install (as root)
If everything went as planned, ffmpeg-php is now installed as a shared library.
You must explicitly load it in your scripts using dl(ffmpeg.so) or if you want
it available to all scripts by default add extension=ffmpeg.so to your php.ini
file which will tell php to load it when starting up.
BUILDING FFMPEG-PHP AS PART OF THE PHP BINARY
———————————————
1. Unpack the archive and copy the ffmpeg extension directory into your the php
sources extensions directory
tar -xjf ffmpeg-php.X.XX.tar.gz
cp ffmpeg /path/to/php_sources/ext
2. Run autoconf to rebuild the php configure script and add the –with-ffmpeg
option
cd /path/to/php_sources
autoconf
2. configure php using…
./configure –with-ffmpeg=yes
…and build and install php.
The ffmpeg-php methods should now be built directly into php and so no need to
explicitly load the extension at runtime.
TESTING THE INSTALLATION
————————
1. Put the directory test_media and test_ffmpeg.php script under your web root
somewhere (put both in the same directory).
2. Load test_ffmpeg.php into your browser.
RESULTS: You should get a listing of the methods provided by the ffmpeg-php
module as well as some test output from the methods.
omg.. good work, dude