I borrowed some PHP code that uses ffmpeg to get the video info. Here it is:
$command = ‘/usr/bin/ffmpeg’ . ‘ -i ‘ . $video . ‘ -vstats 2>&1’;
$output = shell_exec ( $command );
$result = ereg ( ‘[0-9]?[0-9][0-9][0-9]x[0-9][0-9][0-9][0-9]?’, $output, $regs );
if (isset ( $regs [0] )) {
$vals = (explode ( ‘x’, $regs [0] ));
$width = $vals [0] ? $vals [0] : null;
$height = $vals [1] ? $vals [1] : null;
}
echo $width . ” x ” . $height;
I don’t see anything wrong with this. I think it’s actually ffmpeg that is assuming the larger value is the width. How do I correct this? Any ideas? Thanks.