Once I upload videos to my server I'm creating a screencap using FFMPEG. Problem is, if the user takes a video in portrait mode the screencap is rotated 90º. The ridiculous things is that PhoneGap and FFMEG-php and FFMPEG don't seem to offer a mechanism for reading the video rotation/orientation value.
I found another library called mediainfo that will provide the info, but not in an easy to read/digest manner and I'm trying to avoid having to use another library.
Am I wrong about PhoneGap/FFMPEG? Is there a direct way to determine video orienation?
Here's my solution as a PHP function:
function get_video_orientation($video_path) {
    $cmd = FFMPEG_PATH . "ffprobe " . $video_path . " -show_streams 2>/dev/null";
    $result = shell_exec($cmd);
    $orientation = 0;
    if(strpos($result, 'TAG:rotate') !== FALSE) {
        $result = explode("\n", $result);
        foreach($result as $line) {
            if(strpos($line, 'TAG:rotate') !== FALSE) {
                $stream_info = explode("=", $line);
                $orientation = $stream_info[1];
            }
        }
    }
    return $orientation;
}
 
    