0

i'm using this command for retrieve video information in ubuntu terminal:

ffprobe -show_streams sample.mp4

this command show all information about video in terminal, but when i use this command in php and use exec function to retrieve result , return

string(0) ""
{}

how i can retrieve result in php ?

my code:

    public function information($ffmpeg,$file)
    {
      $info = exec("$ffmpeg -show_streams $file");
      return $info;
    }

3 Answers3

0

You should've read manual on exec first to see that you need to specify a third parameter in order to obtain results. However there's some second parameter in the way so it would be much easier to use shell_exec()

Manual shall be your friend:

http://php.net/exec

paranoid
  • 535
  • 2
  • 11
0

i'm use exec function to run my command with three argument and return value with second argument:

$info = exec("$ffmpeg -show_streams $file",$output,$result);
return $output;
0

First time find complete path: command:

whereis ffmpeg

my result: /usr/bin/ffprobe

echo exec('/usr/bin/ffprobe -show_format YOURINPUT ', $output, $result);    
var_dump($output);

$result= 1 or 0..........[ 1 error occurs or 0 Input is ok.]

or use command ffmpeg
Please check http://www.stoimen.com/blog/2011/04/12/an-ffmpeg-question-why-phps-exec-doesnt-return-the-command-output/

legoscia
  • 39,593
  • 22
  • 116
  • 167