phpffmpegffprobe

retriving video details with ffprobe in php


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;
    }

Solution

  • 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;