I am trying to install FFMPEG-PHP for backend video conversion and to capture a thumbnail of the videos users of my website upload. However i am having problem and I am not sure what is it exactly.
Environment: Ubuntu Server 12.04 PHP5 and Apache2 (Did not use LAMP package. Installed separately.)
To install ffmpeg I followed this tutorial, http://ffmpeg.org/trac/ffmpeg/wiki/UbuntuCompilationGuide.
Works on command line: When I tried to convert from the command line, it works.
avconv -i test.mp4 test.flv
- works
ffmpeg -i test.mp4 test.flv
- works, says that use avconv
Folder permission has been changed to R 777.
PhpInfo():
- ffmpeg-php version: 0.6.0-svn
- ffmpeg-php built on: Feb 25 2012 17:59:17
- ffmpeg-php gd support: enabled
- ffmpeg libavcodec version: Lavc53.34.0
- ffmpeg libavformat version: Lavf53.20.0
- ffmpeg swscaler version SwS2.1.0
I read somewhere to try the following code,
extension_loaded('ffmpeg') or die('Error in loading ffmpeg');
The above code should not give any output if the extension loaded successfully. And mine did not show any errors.
Code in PHP that is not working,
exec("ffmpeg -i test2.mp4 test2.flv", $command_output, $result);
if ($result !== 0) {
echo 'Command failed!<br>';
print_r($command_output);
die();
}
echo 'success!';
print_r($command_output);
It prints Command failed with as empty array, Array ( ).
Hope someone can help to guide me in this.