array('pipe', 'r'), 1=>array('pipe', 'w'), 2=>array('pipe', 'w')), $pipes); fwrite($pipes[0], "");fclose($pipes[0]); $stdout = ""; $fin = 0; $informProgress = 10; if (is_resource($proc)) { while ($s = fgets($pipes[2])) { print_r($s); preg_match('/Duration: ([0-9]{2}):([0-9]{2}):([^ ,])+/', $s, $matches); if(isset($matches[0])){ print_r($matches); $time = str_replace("Duration: ", "", $matches[0]); $time_breakdown = explode(":", $time); $total_seconds = round(($time_breakdown[0]*60*60) + ($time_breakdown[1]*60) + $time_breakdown[2]); shell_exec('"C:\xampp\htdocs\ffmpeg\bin\ffmpeg.exe" -y -i '.$path." -f mjpeg -vframes 1 -ss " . ($total_seconds / 2) . " -s {$w}x{$h} screan.jpg"); } //$stdout = $stdout.$s; flush(); //ob_flush(); } } $stdout.=stream_get_contents($pipes[1]);fclose($pipes[1]); $stderr=stream_get_contents($pipes[2]);fclose($pipes[2]); $rtn=proc_close($proc); return array('fin'=>$fin, 'stdout'=>$stdout, 'stderr'=>$stderr, 'return'=>$rtn ); } $file_name_with_full_path2 = 'C:\xampp\htdocs\2.mp4'; $output = my_ff_exec('"C:\xampp\htdocs\ffmpeg\bin\ffmpeg.exe" -i '.$file_name_with_full_path2 ,$file_name_with_full_path2); print_r($output);