• How-to Install ffmpeg-php PHP 5.4 on Windows 8 / XAMPP 1.8.1

    by  • December 17, 2012 • Apache, PHP, Tutorials, XAMPP • 21 Comments

    php ffmpeg logo

    I’m stoked to be able to bring you this tutorial!  In my previous tutorial, How to install ffmpeg-php for Windows Apache HTTP Server, I mentioned the limitation that all newer versions of PHP were compiled using VC9 and there wasn’t a compatible version of ffmpeg-php, but that has since changed!  Special thanks to Sergey Fedotov, I now have a PHP 5.4 VC9 version of ffmpeg-php!

    Prerequisites

    You’ll need PHP 5.4 already installed in order to install ffmpeg-php extension for Windows.  You can either use http://pastebin.com/r8JDpxnL (or higher) or you can download and install PHP 5.4.  If you’re wanting to test the installation (as done in this tutorial), then you’ll also need a video file.

    If you are using XAMPP for this tutorial, you can ffmpeg-php+ from their website.

    If you’re using a manual installation of PHP 5.4, you can download version 5.4+ on their Archives page.

    Video Tutorial

    ffmpeg-php For PHP 5.4 Windows Downloads

    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.

    • ffmpeg-php for PHP 5.4 Windows – 32-bit VC9 (Recommended) – 
      ffmpeg-php for Windows PHP 5.4 x32. VC9 compiled

      ffmpeg-php for Windows PHP 5.4 x32. VC9 compiled. Special thanks to Sergey Fedotov for these!

    • ffmpeg-php for PHP 5.4 Windows – 64-bit VC9 – 
      ffmpeg-php for Windows PHP 5.4 x64. VC9 compiled

      ffmpeg-php for Windows PHP 5.4 x64.  VC9 compiled.  Special thanks to Sergey Fedotov for these!

    • Example/Test ffmpeg-php script (Shown below)ffmpeg-php example code

    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

    21 Responses to How-to Install ffmpeg-php PHP 5.4 on Windows 8 / XAMPP 1.8.1

    1. March 19, 2016 at 4:31 PM

      Hello,

      Is there a way to use the php-ffmpeg for a php 7 version? I have tried using the file on my IIS server with php 7 and having zero luck.. Or is there a way to edit the dll so it can be modified to work with php 7?

      Thanks

      • March 29, 2016 at 3:28 PM

        Hey Mike,
        I don’t know. I no longer have a copy of IIS and don’t care to try supporting it since it’s a commercial product. Maybe someone who knows the answer can reply.

    2. March 6, 2016 at 3:41 AM

      Hi
      I am trying to install as per above in 2008 R2 PHP 5.4 in . Can this work without XAMPP.

      I don’t see ffmpeg in phpinfo().

      can you please let me know is this possible without XAMPP.

      Thanks
      Venu

      • March 16, 2016 at 5:39 PM

        It should work with almost any Apache server. If you’re running IIS, then that may be a completely different story. I no longer test IIS since it’s proprietary/commercial, so I’m sorry I can’t be of any more help.

    3. Harjatin Singh
      February 14, 2016 at 9:26 PM

      Hi. Thanks for the tutorial. Much appreciated. Although this script is running perfectly and i have been able to install ffmpeg successfully, i still am not able to run ffmpeg commands from php script.
      e.g. echo shell_exec(“ffmpeg -i name.mp4 output_audio.wav”); does not do anything nor does it produce any output. Can you hep me with this ?

      • February 16, 2016 at 9:37 PM

        Have a look at the PHP documentation for that function: http://php.net/manual/en/function.shell-exec.php
        It’s most likely due to your php.ini file settings, which the location of that file will vary depending on what OS your server is running.
        Have a read of the notes on that PHP documentation page and you will likely find your answer.

    4. Noni
      November 14, 2013 at 10:48 PM

      hi, I’ve try every single step you explained in this video and there’s no error, but I can’t find any ffmpeg when I load the phpinfo.

      I also try running code like:
      $ffmpeg = trim(shell_exec(‘which ffmpeg’));
      $ffmpeg = trim(shell_exec(‘type -P ffmpeg’));

      but I don’t get any output.

      can you give me some clues? I use a 64-bit version of Windows and PHP version 5.4.7

      thanks

    5. September 24, 2013 at 11:42 AM

      I was trying to install the ffmpeg module on WINDOWS 8 with XAMPP 1.8 and PHP 5.4 and got the error “avcodec-52.dll” is missing. The solution I got after googling is that

      “If you use a 64-bit version of Windows, you should also place avcodec-52.dll in C:\Windows\SysWOW64\”

      Hope this will of some help…:)

    6. erin
      June 27, 2013 at 9:21 AM

      Hi your tutorial was great! I had an error though, when I would start apache it would say that avcodec-52.dll could not be found on my computer. I saw on another forum that you have to add those System 32 dlls to the SysWOW64 folder as well if you are running a 64 bit system. I did and it worked for me!

    7. Ville
      May 19, 2013 at 3:39 PM

      Hello and thank you for this tutorial!
      I did everything as in the video, but I keep getting this error when I start Apache;
      “httpd.exe – System error: avcodec-52.dll is missing from computer…”

      I use;
      ‘ffmpeg6-php54-win32-vc9-all.rar’ -file
      Windows 7
      XAMPP Control Panel v3.1.0 3.1.0
      PHP Version 5.4.7

      The ‘avcodec-52.dll’ -file and all other files are in ‘System32’ -folder. I did download .rar again and overwrite .dll -files, but I still get the same error…

      Any idea what is the problem?

      • July 5, 2013 at 5:39 AM

        Nice post I must say considering I have been looking for how to get ffmpeg to work on my local jomsocial installation. However, I must also iterate that I also got the same error Ville clearly points out here.

        This said, is there any solution(s) to this ‘cos quite franky, it is frustrating…

    8. Martin
      April 3, 2013 at 5:06 AM

      Took some Googling to come across this but THANK YOU. My problem was that my php is x64 and I needed the x64 ffmpeg dll. Also, restarting apache didn’t work for me. I had to completely exit WAMP (I’m using wamp not xampp) and then load it again.

    9. amir
      March 1, 2013 at 3:14 AM

      Hi,
      I downloaded “ffmpeg6-php54-win32-vc9-all.zip” and tried all steps as you explained but on windows 7(64-bit).

      but got an error saying:

      PHP Startup: Unable to load dynamic library ‘C:\xampp\php\ext\php_ffmpeg.dll’ – %1 is not a valid Win32 application.

      Could you please help me to resolve the case.

      many thanks

      • silver
        May 15, 2013 at 10:57 AM

        I have the same error, could you fix it?

      • May 18, 2013 at 8:09 PM

        Yes, notice what the error is saying … “not a valid Win32 application”. You’re running a 32-bit version of Apache and therefore you need the 32-bit ffmpeg-php extension, not the 64-bit one. Just because the OS is 64-bit doesn’t always mean the software is too.

    10. February 16, 2013 at 4:48 PM

      Friend you are the best of the best, now it works on Ampps !
      i have bookmarked you
      thank you man !

    11. Tom
      January 9, 2013 at 11:40 AM

      hi i tried as you explained, but i’m getting an error: Class ‘ffmpeg_movie’ not found
      ffmpeg doesn’t show up in my phpinfo, although there’s no error in my php logs ..
      any ideas what could be wrong?
      i’m running IIS+php
      thanks
      ps: would you set it up on our server for little cash? thanks

      • January 9, 2013 at 3:28 PM

        Hey Tom,
        That’s strange that you’re getting that error because you should get the error on line 9 in the above code,

        if the extension wasn’t loaded, unless you’ve removed that line.
        Otherwise, the class ffmpeg_movie should be available.

        As far as setting it up goes, I can try and if successful, you can pay me for it. However, I must ask up front what exactly you are implying by “setting it up”…

        • Tom Gugger
          January 9, 2013 at 6:03 PM

          hi, thanks for your reply.
          by setting it up i meant getting the php-ffmpeg component on my IIS to work.
          The server runs on x64 and i also tried the x64 ffmpeg component but got an error that it’s not a valid win32 application, so i assume php can actually see the w32 extension but is just missing some path/info.
          i’d be happy if you could give it a try – please contact me via email if you’re interested.
          thanks in advance
          tom

    12. Pingback: How To Run / Execute FFmpeg with PHP on Windows PC | My Own Home Server

    13. Pingback: How to install ffmpeg-php for Windows Apache HTTP Server | My Own Home Server

    Leave a Reply