How does one go about getting specific pieces of information, like the \'duration\' from the output of ffmpeg -i /var/thismovie.avi
?
I need frame heigh
$output = `ffmpeg -i /var/thismovie.avi`; //note that back quote is like exec
preg_match('/Duration: (.*?),.*?Video:.*?0x.*?([0-9]+)x([[0-9]+).*?([0-9]+) fps/i'
,$output , $result);
output of $result array should be like this:
Array
(
[0] => Duration: 00:00:10.76, start: 0.000000, bitrate: 5180 kb/s Stream #0:0: Video: h264 (High) (H264 / 0x34363248), yuv420p, 1280x720 [SAR 1:1 DAR 16:9], 25 fps
[1] => 00:00:10.76
[2] => 1280
[3] => 720
[4] => 25
)
UPDATE
The actual output is multi line, so please update the pattern into
/Duration: (.*?),.*?([0-9]+)x([0-9]+) \[.*?([0-9]+) fps/is