I have an oddly difficult task to perform. I thought it would be easy, but all my efforts have been fruitless.
I\'m converting videos uploaded to a php script from
I'm not familiar with PHP, but I wrote a utility to work with ffmpeg in C# several months ago. I used regular expressions to do this. There are some regular expressions which may help you from there:
// this is for version detection
"FFmpeg version (?(\w|\d|\.|-)+)"
// this is for duration parsing
"Duration: (?\d{1,3}):(?\d{2}):(?\d{2})(.(?\d{1,3}))?"
// these are connected:
// 0) this is base for getting stream info
"Stream #(?\d+?\.\d+?)(\((?\w+)\))?: (?.+): (?.+)"
// 1) if the type is audio:
"(?\w+), (?[\d]+) (?[MK]?Hz), (?\w+), (?\w+)(, (?\d+) (?[\w/]+))?"
// 2) if the type is video:
"(?\w+), (?\w+), (?\d+)x(?\d+), (?\d+(\.\d+)?) (?[\w\(\)]+)"
So getting width and height you can calculate an aspect ratio.
Note: I know that in some cases there expressions may fail.