Reputation: 144
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;
}
Upvotes: 0
Views: 3911
Reputation: 11
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/
Upvotes: 0
Reputation: 144
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;
Upvotes: 0
Reputation: 535
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:
Upvotes: 0