• How to install ffmpeg-php for Windows Apache HTTP Server

    by  • February 8, 2012 • PHP, Tutorials, XAMPP • 36 Comments

    This tutorial shows how to install ffmpeg-php on a Windows 7 32-bit PC running XAMPP/PHP 5.3. This is one of the most requested tutorials and has been for some time, so I’ve decided to revisit it and see if I could produce an updated version along with the source file links needed.
    I have chosen to use a fresh install of Windows 7 32-bit for the tutorial along with XAMPP as the Apache2/PHP 5.3 server.

    Prerequisites

    The main catch to installing and using ffmpeg-php extension for Windows is the version of PHP that is required in order for it to work. Since the person who compiled the ffmpeg-php extension did so using a VC6 (Visual Basic 6 compiler) version of PHP 5.3, the highest version of PHP 5.3 we can use is 5.3.5. This also means we can’t use versions of XAMPP newer than version 1.7.4 since it also is the most recent version compiled with VC6.

    If you are using XAMPP for this tutorial, you can Direct Link to download from their Sourceforge.net page. (Direct Link to download)
    If you’re using a manual installation of PHP 5.3, you can find it on their Archives page.

    ** UPDATE – 12/17/2012 **

    I’ve created a new tutorial How-to Install ffmpeg-php PHP 5.4 on Windows 8 / XAMPP 1.8.1 that explains how to install the latest version of ffmpeg-php that now works with PHP 5.4 and XAMPP 1.8+ !
    The download links for the updated ffmpeg-php version are located on that page.

    Video Tutorial

    ffmpeg-php For Windows Download Links

    Here are the links needed to download ffmpeg-php and the requirements to install it. I’ve also added the links to the additional resources used in this tutorial.

    Example/Test ffmpeg-php Code

    About

    I'm a freelance PHP developer spending much of my time deep in WordPress theme and plugin development. My personal info can be found at http://amereservant.com .

    http://myownhomeserver.com

    36 Responses to How to install ffmpeg-php for Windows Apache HTTP Server

    1. Sajith
      January 18, 2016 at 8:22 AM

      Hello MyOwnServer,
      i tried like on that video , but it gives an error like, [an error occurred while processing this directive] .
      can u help me ???

    2. November 3, 2013 at 7:06 AM

      I have php 5.5.1 and xammp 1.8.3 and the compiler is i think vc11 (MSVC11), can i get a build for this version, i think that is the reason my extension is not getting loaded.

    3. kunjbihari
      June 15, 2013 at 6:01 AM

      I am using windows , wamp appche server and install ffmpeg

      exec(‘FFmpeg -i $file -b 300 -s 320×240 -vcodec xvid -ab 32 -ar 24000 -acodec aac $output.mp4’); video extention convert sure but not convert video and don’t play any browser

      Please Help me !

      media gallery if upload video same time convert video .mp4, .webm, .ogv supported HTML5 all browser

      Please suggest me !

      • June 16, 2013 at 5:55 PM

        Hey kunjbihari,
        The first problem I see right up front is that you’re trying to execute ffmpeg on windows without calling ffmpeg.exe. Secondly, you will need to specify the path to ffmpeg.exe relative to where PHP is calling it from. Using an absolute path works best.
        The best way to troubleshoot ffmpeg is to open up your command prompt and run the command from there first since you can see the response in real-time and work towards resolving it from there. I hope that helps.

    4. March 2, 2013 at 2:58 AM

      Hi ,
      I do the same that ur video tutorial is showing but extenstion is not loading or not giving me any error.
      Please help me to resolve this issue. i am using PHP 5.4.4

    5. Erwin
      February 27, 2013 at 3:50 PM

      I’m to trying install php_ffmpeg in ubuntu serv, can you help me with that? i did it many things to install and i can see the module of ffmpeg in “” but i ran this code

      and this dont work :/…
      i ran the same code in console and converted well.

    6. Christos C
      December 18, 2012 at 8:02 AM

      hello,
      can i create a video from images with this module? (like the use of ffmpeg -f image2 -r 1/5 -i img%03d.png -vcodec libx264 out.mp4 etc..)
      thank you btw

    7. Henri
      December 15, 2012 at 9:49 AM

      Hi,

      I want to express my gratitude to you for posting the video on ffmpeg-php. I followed your clear instruction to the letter, and I was able to install, without any problem, the ffmpeg-php. I have a question that is not related to ffmpeg-php. That is, I have been trying to install ffmpeg using the mingw console. However, when I type the first few codes to see if ffmpeg is install in my system, I get this error: “sh: sudo: command not found”. My understanding of this issue is that sudo is most likely not installed in my system. I would like to know what do I need to install in my computer besides the mingw console in order to compile ffmpeg.

      Once again, thank you so much for taking the time to upload such educational videos.

      Henri

      • December 15, 2012 at 6:47 PM

        Hey Henri,
        “su” or “sudo” is not a windows command, it’s for specific distributions of Linux such as Debian-based ones. In Windows, you just need to download a pre-compiled version, which you can find at http://ffmpeg.zeranoe.com/builds/ . Extract the files from the 7zip file (at least that’s what I downloaded), copy the file ffmpeg.exe to where you need it, then call it from the command line.

        For example, I use ffmpeg in C:\ffmpeg\ffmpeg.exe and from the command line, I just execute the command like C:\ffmpeg\ffmpeg.exe …..

        Hope that helps!

    8. guru
      December 14, 2012 at 9:20 AM

      I found the tutorial to be helpful but I am getting following error how can i solve this one, from the (phpinfo.php page )

      Object not found!

      The requested URL was not found on this server. If you entered the URL manually please check your spelling and try again.

      If you think this is a server error, please contact the webmaster.
      Error 404
      localhost
      12/15/2012 7:37:55 PM
      Apache/2.2.12 (Win32) DAV/2 mod_ssl/2.2.12 OpenSSL/0.9.8k mod_autoindex_color PHP/5.3.0 mod_perl/2.0.4 Perl/v5.10.0

    9. karuppu
      October 20, 2012 at 1:55 AM

      thank you very very very much !!!!!!!!!!!!!!!!

    10. August 23, 2012 at 8:06 PM

      I found the tutorial to be helpful and informative but I ran into a problem I cannot resolve. I did everything you said but got none of the ffmpeg information from the phpinfo.php page and continuing on I got an error in the browser that says there was an error loading ffmpeg. Do I have to uninstall everything and start over or is that like waving the cape at the bull?

      • August 25, 2012 at 2:17 AM

        My guess is that you need to double-check your php version since it’ll only work with specific older versions. That was what I ran into when I was not able to get the ffmpeg-php extension to load….

    11. July 23, 2012 at 6:48 PM

      Hello, Myownhomeserver,
      Can you please answer this question: http://www.v7n.com/forums/coding-forum/311926-how-do-i-install-ffmpeg-flvtool2-mp4box-my-server-make-video-tutorial-please.html
      Would you be able to make quick tutorials for the above,
      Thanks so much!

      • July 26, 2012 at 9:52 PM

        Well each component should be pretty simple to install. I know FFMPEG is simply a matter of extracting a ZIP file into a specified directory and it’s ready to go. But you didn’t give any information explaining why you’re needing it or what you’re going to use it for, so just “installing” them is as simple as finding a Windows build of each one and following the instructions.
        It’s pointless to make a video tutorial showing how to install software that’s just a matter of running an install file or extracting files in a specified directory.

        • July 27, 2012 at 12:46 PM

          Hello MyOwnServer,
          Thanks for getting back to me,
          You see I want to set up Clip-bucket on my own server , But I don’t know how to install them… I read the instructions on the other sites but I’m still very confused.
          If you could make a video explaining how to install the components and then install clipbucket I would be very thankful, Plus there are many other members looking for a video like that on the Clipbucket Forums 🙂 You would get many views and many thanks! 🙂

          • July 29, 2012 at 4:50 PM

            Ok,
            I’ve created the first tutorial explaining how to install Clipbucket, http://wp.me/p1Xgia-2f. I’ll be creating another one soon showing how to configure ffmpeg, flvtool2, and mp4box, but I’ll have to figure out how to get past the admin login issue first. Hope that helps!

            • July 29, 2012 at 4:51 PM

              THANK YOU THANK YOU THANK YOU – Can’t wait for the other video showing how to install ffmpeg, flvtool2, and mp4box,:)!!!!

    12. Jagan Ryali
      June 20, 2012 at 5:26 PM

      Hi bro,
      Where did you got those dll’s. Did you compiled ?

      • June 20, 2012 at 8:59 PM

        The links to them are just below the embedded video on the page. Nah, I didn’t compile them, just make sure you read my notes since it will only work with certain version(s) of PHP.

    13. June 6, 2012 at 9:26 PM

      I am trying to upload ffmpeg to my server on godaddy (if possible) . have no idea how to even start it can you help?

      • June 20, 2012 at 9:04 PM

        If you’re on a shared-hosting plan, then it’s probably not possible unless they already have that library installed (highly unlikely). You can check by creating a file named phpinfo.php, then open it with a plain text editor (such as Notepad) and putting the following in it:

        < ?php phpinfo(); ?>

        Save the file and upload it to your server, then visit the URL and see if there’s a heading ffmpeg anywhere. Be sure to delete this file from your server once you’re done for security reasons. If it’s on there, then you’re in luck, if not, then you’ll have to either find hosting with that available or just tinker with it on your local computer.

    14. Constantin
      May 9, 2012 at 2:22 PM

      Great post, helped me a lot.
      Thanks!

    15. March 20, 2012 at 1:21 AM

      Hi,

      This is one great tutorial. I have two questions for you.

      1. What software did you use to make your tutorial?

      2. I am using a windows 2008 R2 Server, with IIS 7.0 and I have PHP 5.2.17 installed and working.

      3. I have also installed xampp version 2.5

      4. I downloaded http://sergey89.ru/files/ffmpeg-php/ ffmpeg

      I don’t think this will work under 5.2.17 am i right? How do i get ffmpeg for PHP 5.2.17?

      If the above will work then;

      I followed your instructions but when I test to see ffmpeg extension is loaded or not its not loading.

      My PHP is installed at c:\PHP

      a) I did copy the dll to windows/systems32
      b) copied ffmpeg dll to c:\php\ext
      c) modified the php.ini

      So far no luck.

      Any advise?

      • March 22, 2012 at 11:16 PM

        Hey Asim,
        Here’s the answers to the best of my knowledge:

        1. Camtasia Studio by TechSmith, great program!
        2. I haven’t even looked into using ffmpeg-php for PHP 5.2 and I’m not sure the ffmpeg-php files I’ve linked to will work with it. There are other sources for the ffmpeg-php.dll files, but the main thing is making sure it’s compiled with the same compiler version.
        3. XAMPP 2.5 won’t work. The newest version that can be used is 1.7.4 due to the version of PHP used in newer releases of XAMPP and ffmpeg-php compatibility.

        Honestly, my recommendation would be to go with a version of PHP that’s compatible with ffmpeg-php. Unless the improvements in more recent versions of PHP are absolutely needed, an earlier version will do just fine. Having the “latest and greatest” version doesn’t always mean you have the best version.

    16. Kevin Lee
      March 9, 2012 at 1:56 PM

      Hi! thanks for the tutorial. I followed the tutorial to install and set up my ffmpeg-php extension, but when I started to restart the Apache server, it warns that “PHP Startup: Unable to load dynamic library ‘C:\xampp\php\ext\php_ffmpeg.dll’ – The specific module could not be found”. It is ridiculous because I can see the file “php-ffmepeg.dll” in the right directory. And I used the link you provided to download the xampp and ffmpeg extension. Why it that? Could you help me with it?

      • March 9, 2012 at 5:11 PM

        Hey Kevin,
        It sounds like you may have your php extension named incorrectly. In your error, it’s saying it cannot load php_ffmpeg.dll, yet you said you can see the file php-ffmpeg.dll, one having an underscore and the other a dash. I’ve wasted hours overlooking typos like that, so just carefully check it since somehow our minds will not catch some typos as easily.

        • Kevin Lee
          March 14, 2012 at 12:30 PM

          Yes, it is! thanks man.

    17. vibol
      March 3, 2012 at 12:01 AM

      Hello Thank you for you really nice But how to covert video using ffmpeg in php ?

      • March 5, 2012 at 2:51 PM

        Well that’s a little different and actually doesn’t have anything to do with ffmpeg-php. Using ffmpeg to convert videos requires use of the exec() command (I believe) and then handling the results. I’ll try to research it and create a tutorial for that soon. ffmpeg-php just allows for accessing the video attributes via PHP, but doesn’t allow for manipulation of the video itself that I’m aware of.

        • tom
          July 1, 2012 at 8:36 AM

          hi thanks for the tutorial. Another vote for the convert tutorial =)

    18. Mauricio Rodrigues
      February 28, 2012 at 1:17 PM

      Hi!
      I’m to try install ffmpeg extension in my server, but the extension not loaded by server. I’m using PHP 5.3.6 VC9. this is the problem?

      Thanks

      • February 28, 2012 at 7:31 PM

        Hey Mauricio,
        Yes, the ffmpeg-php extension was compiled for VC6, which means the highest version of PHP you can use is PHP 5.3.5 since it’s the last one released that was still compiled with VC6. Make sure if you use an earlier version of PHP that you do get the VC6 one since several versions were compiled as both VC6 and VC9.

    19. February 10, 2012 at 6:40 PM

      thank you! I finally managed to install ffmpeg-php! All the best to you!

    Leave a Reply