SourceForge project page:
Google ffmpeg-php discussion group:
API Docs
Browse SVN:
Anonymous SVN:
  1. svn co https://ffmpeg-php.svn.sourceforge.net/svnroot/ffmpeg-php ffmpeg-php


ffmpeg-php is an extension for PHP that adds an easy to use, object-oriented API for accessing and retrieving information from video and audio files. It has methods for returning frames from movie files as images that can be manipulated using PHP's image functions. This works well for automatically creating thumbnail images from movies. ffmpeg-php is also useful for reporting the duration and bitrate of audio files (mp3, wma...). ffmpeg-php can access many of the video formats supported by ffmpeg (mov, avi, mpg, wmv...)


09/21/07 - Offical Gentoo package available! Gentoo users can now install using 'emerge ffmpeg-php'.

07/16/07 - Offical Debian package available! Debian users can now install using 'apt-get install php5-ffmpeg'. A big thanks to Raphael Geissert for all his work on this, and for all the tips on getting ffmpeg-php to play well with Debian's packaging system. A unoffical package for PHP4 is available at his personal repository.

05/24/07 - Ffmpeg and ffmpeg-php installation services available. For $75 USD (via Paypal) I will install ffmpeg and ffmpeg on your Linux server. Email ffmpeg.php@gmail.com for more info.

08/15/06 - The ffmpeg-php sources have been migrated from CVS to Subversion. CVS is still available from the command line but will no longer be updated.



ffmpeg-php is not compatible with ffmpeg's swscaler. Enabling swscaler in ffmpeg disables the img_convert functions that ffmpeg-php needs to do its thing. Ffmpeg must be configured and compiled without the '--enable-swscale' flag.

Some users have posted Windows builds to the ffmpeg-php google group. I hear from folks that they work great but I haven't had time to test them personally yet.

Apparently there is some sort of conflict between the php IMAP extension and ffmpeg-php in certain cases. The IMAP extension seems to conflict with a few other extensions so for now I am assuming it is a problem with IMAP.


Sites Using ffmpeg-php

Here's a list of some of my favorite sites using ffmpeg-php.

If you have a site to add to the list, shoot me an email at ffmpeg[dot]php[at]gmail[dot]com


These instructions are for Linux. I don't know the first thing about 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.


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.


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.

$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");


API Documentation


Q: How come it doesn't work with some Quicktime movies?

A: ffmpeg must be compiled with zlib support to read Quicktime movies with compressed headers.

Q: How come it doesn't work with <myfavoritetype> movies?

A: The ffmpeg-php extension uses ffmpeg libraries for access to video info. Some movie types have limited support in ffmpeg. Some encoders create non-standard movies which may cause problems for ffmpeg. If the movie can't be read correctly by ffmpeg then it won't work with ffmpeg-php. Consult the ffmpeg documentation for more info on supported formats. If ffmpeg-php won't read a movie, try using the ffmpeg command line program to convert the movie to another type. If it fails, then ffmpeg (and thus ffmpeg-php) don't support your movie type. If ffmpeg converts it correctly then the problem is most likely in ffmpeg-php, in which case you can bug me about it.

Q: ffmpeg-php doesn't do the one freakin' thing I absolutely need! Can you add it to the program?

Ffmpeg-php was written specifically for a project I was working on and have now finished. There is no ongoing development at all beyond just keeping it compatible with the ever changing ffmpeg API (and even then I just wait for someone to complain). That said, I am available for hire if you need further development or customization as long as the resulting code is made open source also.

Q: I can't get it to install. What's the deal?

Ffmpeg-php can sometimes be a pain to install. This is mostly due to the strange voodoo it has to do to detect if GD is available in PHP. Sometimes this fails for no apparent reason. Add to that the ever changing ffmpeg SVN and it can get even more tricky. If you get stuck, ask on the Google group and someone can probably talk you through it. If you get really stuck I'd be happy to install ffmpeg and ffmpeg-php (and any other videoshare prerequisites) on your server for $75 bucks. I'll need ssh root access to the machine and about 45 minutes. (Linux only, I'm not a Windows dude) Feel free to contact me for the details: ffmpeg.php@gmail.com


If you find ffmpeg-php useful, want to report a bug, or want to request a feature, please use the SourceForge project page.

Google Groups Subscribe to ffmpeg-php
Browse Archives at groups.google.com
SourceForge.net Logo freshmeat.net