title: video orientation detection in bash
body: <p>I need to detect whether videos are recorded in portrait or landscape mode, then transpose those into the correct orientation, in a scripted fashion.</p>
  
  <pre><code>if [ "$v_orient" ==  "landscape" ]
    then
      ffmpeg -i file.mp4 -vf "transpose=1" file.ogv
    else 
      ffmpeg -i file.mp4 file.ogv
  fi
  </code></pre>
  
  <p>I've looked in ffmpeg online documentation and googled around,</p>
  
  <p>I've attempted <a href="https://stackoverflow.com/questions/11000107/detect-orientation-of-video-and-auto-rotate-if-needed">exiftool</a>  </p>
  
  <pre><code>exiftool -Rotation -Rotate file.mp4
  </code></pre>
  
  <p>However, this outputs Rotate: 90 for both landscape &amp; portrait videos I have.</p>
  
  <hr>
  
  <p>How can I detect the video orientation in bash?  </p>