Installation

These instructions are for Linux. I don't know Windows or Mac.

Building the ffmpeg-php Extension
Build and install PHP if it is not already installed
Unpack the ffmpeg-php sources
  1. tar -xjf ffmpeg-php-X.x.x.tbz2
Change to the ffmpeg-php extension directory and run phpize (included with your PHP installation) to build configuration files. NOTE: if your php installation does not include phpize, you may have to install a php-dev package for your distro (usually named: php-dev, php-devel or similar)
  1. cd ffmpeg-php-X.x.x/
  2. phpize
Configure and build the extension.
  1. ./configure && make
Install the shared extension.
  1. sudo make install
If everything went as planned, ffmpeg-php is now installed as a shared extension.

Configuration

If you've built ffmpeg-php as a shared extension but want to make it available to all scripts by default, add extension=ffmpeg.so to your php.ini file to load ffmpeg-php at PHP startup. Make sure to restart apache when you are done to reload php.ini.

Testing the Installation

RESULTS: You should get a listing of the methods provided by the ffmpeg-php module as well as some test output from the methods.

Usage

If you've the installed ffmpeg-php extension as a shared library but haven't set it to auto-load in your php.ini file, you'll need to use the PHP dl() function to make ffmpeg-php available to your scripts. Add the following PHP code to the beginning of scripts you want to call ffmpeg-php methods in.

<?php
$extension 
"ffmpeg";
$extension_soname $extension "." PHP_SHLIB_SUFFIX;
$extension_fullname PHP_EXTENSION_DIR "/" $extension_soname;

// load extension
if(!extension_loaded($extension)) {
    
dl($extension_soname) or die("Can't load extension $extension_fullname\n");
}
?>