Search code examples
phpffmpeg-php

php_ffmpeg not working


i've installed the php_ffmpeg extension on my xampp under c:/xampp/php/ext/php_ffmpeg.dll - according to phpinfo() it seems to be properly installed. however - when trying to create a thumbnail from a video it is executing without errors, but i'm not getting any image .. the apache error log is showing: command "ffmpeg" is either mis-spelled or couldn't be found. my code is:

$cmd = "ffmpeg  -i myvideo.flv -f mjpeg -vframes 1 -s 150x150 -an thumbnail.jpg";
exec($cmd);

any ideas what's wrong?


Solution

  • You're executing a shell command (ffmpeg -i ...) outside PHP, without using the PHP extension ffmpeg-php. That extension provides some functions to PHP, see ffmpeg-php API documentation.

    If you insist on using the ffmpeg command-line program, take a look at the ffmpeg project. Windows binaries can be downloaded here. The documentation for the commandline application ffmpeg can be reached from here. If necessary, use the full path to the ffmpeg binary:

    $ffmpeg = "C:\\Program Files\ffmpeg\ffmpeg.exe";
    $cmd = "$ffmpeg  -i myvideo.flv -f mjpeg -vframes 1 -s 150x150 -an thumbnail.jpg";
    exec($cmd);