Wednesday, March 25, 2009

FFMPEG PHP installation on windows

We recently had a request from a client to install FFMPEG and the associated PHP module on a Windows server that was running Plesk 8.2 with PHP 5.2. This posed a bit of a problem because the FFMPEG project only releases source code releases, relying on others to make binary distributions. For linux distributions, it's usually in the package repository, but for windows, you have to dig around the internet until you can find someone that has compiled it for you, or you can compile it yourself. In addition, they refuse to go out of their way to make their code Windows friendly, which is fine, but it makes the process to compile it kind of complicated, since it doesn't work in Microsoft's C/C++ compiler by default, so you have to configure MinGW to compile it.

Finding a windows distribution of the main FFMPEG project was fairly easy. This site distributes binaries and also provides a very good guide on compiling it for yourself.

However, the PHP module is much harder. Especially since you have to find a module that is compatible with your version of PHP. Most of the available instructions point to PHP 4 modules, if you need a PHP 4 module, here is one good set of instructions. After much digging, I finally found a PHP 5 module here.

UPDATED: This link is now broken, we're currently hosting the PHP 5 module on our website here.

A complete set of instructions for completing this installation is below. My environment was Windows 2003, IIS 6, Plesk 8.2 and PHP 5.2.6:

  • If you plan to use the FFMPEG command-line tool, download the binary package from arrozcru.org. Use a tool such as 7-zip to decompress it and expand the tar file where you want to place it.
  • Download the zip file that includes the ffmpeg-php extension here and uncompress it. It includes several other software packages, you can ignore them, the files that we are interested in are in the ffmpeg-php-win32-all directory. UPDATED: This link is now broken, we're currently hosting the PHP 5 module on our website here.
  • Copy the avcodec-51.dll, avformat-51.dll, avutil-49.dll and pthreadGC2.dll files to the c:\windows\system32 directory.
  • Copy the php_ffmpeg.dll file to your PHP extensions directory. For me, this was "C:\Program Files\SWsoft\Plesk\Additional\PleskPHP5\ext"
  • Edit your php.ini file and add the following bit. For me this was located at "C:\Program Files\SWsoft\Plesk\Additional\PleskPHP5\php.ini"

    extension=php_ffmpeg.dll

  • If you are running PHP as an ISAPI filter, you'll probably need to restart IIS. I was running it as a CGI and I didn't need to restart.

13 comments:

Codename N said...

please could you help in ffmpeg-php installation on wamp

Unknown said...

Hey,

Seems that you were able to install ffmpeg-php on windows. The links you provided no longer work.

Could you help me by emailing the ffmpeg-php dll's to me? Instructions how to compile on mingw would also be great.

Thank You!

Unknown said...

Hey everyone,
I'm the owner of the site that use to host the files in the last link which use to be located at www.imgoingtoreportyou.com. My server isn't online anymore, which is why the link is broken. My current focus and site is http://www.myownserver.info and I'm working on re-assembling another package including the ffmpeg-php files.
The only problem right now is there's not a version that's been compiled for PHP5.3 and I have no idea how to do it nor where to begin when it comes to compiling stuff.
So for now I can only help those with PHP version 5.2.
I'll probably be posting the new files as a torrent to save server bandwidth since I no longer self-host it and bandwidth costs money.
If you want to be contacted when I finish this, go to the contact form, which you can find in the website's top menu, and send me a message and I'll send you a reply when it's up. Otherwise just keep an eye on my blog and I'll make a post about it there as well.

Enjoy!

Adam Jones said...

hi
does anyone know if the ffmpeg-php is available again online?

im desperate for a php 5.2 compatible copy as the version i have is very old and seems not to work.

Keith Bucher said...

Oops sorry everyone, took a break from blogging for a while. I couldn't find any other place where this module was available for download, so we're now hosting the PHP5 module for FFMPEG on our website. Enjoy!

download ffmpeg PHP5 module

Vivek Bharos said...

Thanks buddy that worked for me..

I tried a lot before but your solutions has made it for me..

Thanks a lot,

:)

Unknown said...

I tried the steps but when I put that in it doesn't load any of my websites.

Unknown said...

I looked at the log and this is the error:

Faulting application php-cgi.exe, version 5.2.6.6, time stamp 0x481b8f5f, faulting module php-cgi.exe, version 5.2.6.6, time stamp 0x481b8f5f, exception code 0xc0000005, fault offset 0x0000183a, process id 0xebc, application start time 0x01caab6a23ef1ed2.

Birj System said...

Thank you! After 3 days of searching I found your blog. Now ffmpeg working with Apache2, PHP5.2.5.5 windows7 in 32 bits. Thanks!

MuscleJunkie said...

Is there a PECL extention available for php5.2.17 NTS?

Amereservant said...

Hey Keith,
I'm the owner of the former sites you had linked to and I want to apologize for the broken links. I've created a new site and a much better tutorial (along with updated ffmpeg sources) at http://myownhomeserver.com/2012/02/how-to-install-ffmpeg-php-for-windows-apache-http-server/. I'll assure you this site won't be going anywhere. I hope this helps!

Jorge Luis Veliz said...

coooll thanks for save me :D

otr214426 said...

LIVE Entry – 1 (March-21-2014)

Problem: HP Printer not connecting to my laptop.

I had an issue while connecting my 2 year old HP printer to my brother's laptop that I had borrowed for starting my own business. I used a quick google search to fix the problem but that did not help me.

I then decided to get professional help to solve my problem. After having received many quotations from various companies, i decided to go ahead with Online Tech Repair (www.onlinetechrepairs.com).

Reasons I chose them over the others:
1) They were extremely friendly and patient with me during my initial discussions and responded promptly to my request.
2) Their prices were extremely reasonable.
3) They were ready and willing to walk me through the entire process step by step and were on call with me till i got it fixed.

How did they do it
1) They first asked me to state my problem clearly and asked me a few questions. This was done to detect any physical connectivity issues with the printer.
2) After having answered this, they confirmed that the printer and the laptop were functioning correctly.
3) They then, asked me if they could access my laptop remotely to troubleshoot the problem and fix it. I agreed.
4) One of the tech support executives accessed my laptop and started troubleshooting.
5) I sat back and watched as the tech support executive was navigating my laptop to spot the issue. The issue was fixed.
6) I was told that it was due to an older version of the driver that had been installed.

My Experience
I loved the entire friendly conversation that took place with them. They understood my needs clearly and acted upon the solution immediately. Being a technical noob, i sometimes find it difficult to communicate with tech support teams. It was a very different experience with the guys at Online Tech Repairs. You can check out their website www.onlinetechrepairs.com or call them on 1-914-613-3786.
Would definitely recommend this service to anyone who needs help fixing their computers.
Thanks a ton guys. Great Job....!!