ffmpeg-php does not work

Asked

Viewed 324 times

0

I am trying to generate a thumbnail with ffmpeg-php, but no command of it works, always gives an error saying that the class was not found, example: Fatal error: Class 'ffmpeg_movie' not found.

Using the command if(!extension_loaded("ffmpeg")) exit("Extensão não carregada"); it always says that the extension was not loaded but wamp shows the extension when I go in PHP>PHP Extensions.

I don’t know if it could be a problem with the DLL, but I got it on this site: http://ukphpdeveloper.blogspot.com.br/2012/08/how-to-install-ffmpeg-in-xampp.html

  • and in the phpinfo();?

  • Nothing appears on the ffmpeg in the phpinfo().

  • Then you must have installed but not enabled, in Wampserver menu see if you have the signal "check" , if you are not clicking and then click "Restart" (in the same menu)

  • It is already as the sign of "check".

  • Toni now tries Restart, it might be some Wampserver bug

  • Like he already has since before I ask the question, I’ve even restarted the pc.

  • Toni what folder is this DLL in? And what is the full name of the DLL?

  • C: wamp64 bin php php5.6.31 ext; the dll name is "php_ffmpeg.dll".

Show 3 more comments

1 answer

2


Go on the php.ini open it with an editor like Notepad++ or Sublimetext and look for a place where it is written:

; Windows Extensions

And add this line:

extension=php_ffmpeg.dll

If the line already exists it must be like this:

;extension=php_ffmpeg.dll

Then point and comma and after restart Wampserver

If there’s still nothing on phpinfo(); is because you downloaded the wrong version of DLL, you have to download the version for the same architecture that PHP has been compiled, if you don’t have the compatible dll and you can’t compile by yourself then you won’t be able to use this extension, however there is an alternative.

Alternative in PHP

From the same creator there is a "port" written purely in PHP https://github.com/char0n/ffmpeg-php, download the latest version on:

Then install "the program" (I’m not talking about the DLL) ffmpeg or ffprobe:

  • Couldn’t you just download the correct version of dll instead of using this "port"? If there’s any way I could talk about where I bass or the version I should download?

  • @Toniotti if you don’t have the architecture version that was "compiled" on the site, there’s no way, unless you understand a little C++ and know how to compile and then download the correct version of Msvisualstudio and download the source from the DLL and Compile yourself, then it’ll work, otherwise it won’t. dll and . exe are compiled things, and compilation is based on the type of compiler (Mingw, GCC, VS, etc.) and processor architecture (x86, x64, ARM, etc.), not just any file, is "part of a program" compiled in "machine code", there’s no way a different dll works in two places

  • Aside from the fact that installing FFMPEG-PHP on a contracted server would be virtually impossible, unless the hosting does this for you or you have administrative control over such hosting.

  • Well I don’t know anything about C++ so I’ll try to use this "port" anyway, but thanks for the help.

  • @Toniotti yes is the way, nor is it a matter of C++, but rather how it was compiled, PHP itself and Apache within Wampserver are "compiled", in your case probably compiled in MSVC, but I don’t know which version of MSVC and for x64 architecture. If the author/owner of Dlls does not have a DLL compatible with your PHP/Apache/architecture then it is impossible to make anything work. That’s why the PHP port is easier, because it is just a series of PHP scripts, which will also make it easier to install on the server.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.