0

Does simple ffmpeg package also work fine when we execute its command from PHP via exec? Or we have some different ffmpeg package for that purpose? Please help me solving it.

marekful
  • 14,986
  • 6
  • 37
  • 59
Ali faizan
  • 93
  • 2
  • 2
  • 6

2 Answers2

0

Yes simple ffmpeg does work through PHP exec if you have necessary permissions.

Sample command

<?php

     /*** convert video to flash ***/
     exec("ffmpeg -i video.avi -ar 22050 -ab 32 -f flv -s 320x240 video.flv");

?>

Source

marekful
  • 14,986
  • 6
  • 37
  • 59
Shankar Narayana Damodaran
  • 68,075
  • 43
  • 96
  • 126
0

PHP's ffmpeg and the vanilla ffmpeg are independent packages. The php5-ffmpeg package comes with the ffmpeg binary as a dynamic library. This means that you can install only php5-ffmeg without installing the command line ffmpeg package or vice versa or you can have both of them installed.

Therefore, the answer is yes, PHP will work with the command line ffmpeg given it is installed.

I usually prefer using the command line ffmpeg in PHP via exec. This allows for testing certain operations on the command line and once the result is as desired, the command can be used in PHP's exec. On the other hand, in some situations, it may be preferable to use the php5-ffmpeg package because it gives you the ability to use object oriented coding style when dealing with videos, conversion, etc.

marekful
  • 14,986
  • 6
  • 37
  • 59
  • my php exec script for ffmpeg is working fine but now i also want to run this php script for ffmpeg in browser. does that also works with simple ffmpeg package?? – Ali faizan Sep 04 '13 at 12:00
  • If it works in a command line, it should work in PHP `exec` as well. One hint is to use full path to ffmpeg (use the output of `which ffmpeg`). Another hint if it doesn't work in exec is to examine the output and the return value from `exec` by passing the 2nd and 3rd optional parameters to it. – marekful Sep 04 '13 at 12:02