title: FFMPEG rotates images
body: <p>I am trying to mass-resize images using FFMPEG, and I successfully did it using bash, but I noticed that some of the portrait images got rotated to landscape.  <a href="https://drive.google.com/file/d/0B_2oZpIgJdtgcURHQWhpYjlZUWs/view?usp=sharing" rel="noreferrer">Here is the original image</a>, but as you see below, it gets rotated.</p>
  
  <p><a href="https://i.stack.imgur.com/MoBFD.jpg" rel="noreferrer"><img src="https://i.stack.imgur.com/MoBFD.jpg" alt="Rotated image"></a></p>
  
  <p>As you see above, the image is rotated.  At first, I thought this was due to the <code>-vf scale</code> flag that I was using to resize the images, but I tried the following command and it still rotated the image.</p>
  
  <pre><code>ffmpeg -i input.jpg output.jpg
  </code></pre>
  
  <p>This doesn't happen with every image, and even not all the portrait images.  Also, some images rotate clockwise, while some rotate counter-clockwise.  And this isn't a random occurrence, all the images that originally rotated still rotate no matter how many times I run the command.</p>
  
  <p><strong>Console Output</strong></p>
  
  <pre><code>ffmpeg version N-79942-gdc34fa6-tessus Copyright (c) 2000-2016 the FFmpeg developers
    built with Apple LLVM version 6.0 (clang-600.0.57) (based on LLVM 3.5svn)
    configuration: --cc=/usr/bin/clang --prefix=/opt/ffmpeg --as=yasm --extra-version=tessus --enable-avisynth --enable-fontconfig --enable-gpl --enable-libass --enable-libbluray --enable-libfreetype --enable-libgsm --enable-libmodplug --enable-libmp3lame --enable-libopencore-amrnb --enable-libopencore-amrwb --enable-libopus --enable-libschroedinger --enable-libsnappy --enable-libsoxr --enable-libspeex --enable-libtheora --enable-libvidstab --enable-libvo-amrwbenc --enable-libvorbis --enable-libvpx --enable-libwavpack --enable-libx264 --enable-libx265 --enable-libxavs --enable-libxvid --enable-libzmq --enable-version3 --disable-ffplay --disable-indev=qtkit --disable-indev=x11grab_xcb
    libavutil      55. 23.100 / 55. 23.100
    libavcodec     57. 38.100 / 57. 38.100
    libavformat    57. 35.100 / 57. 35.100
    libavdevice    57.  0.101 / 57.  0.101
    libavfilter     6. 44.100 /  6. 44.100
    libswscale      4.  1.100 /  4.  1.100
    libswresample   2.  0.101 /  2.  0.101
    libpostproc    54.  0.100 / 54.  0.100
  Input #0, image2, from '/Users/jaketr00/Desktop/IMG_1902.JPG':
    Duration: 00:00:00.04, start: 0.000000, bitrate: 1025494 kb/s
      Stream #0:0: Video: mjpeg, yuvj422p(pc, bt470bg/unknown/unknown), 5184x3456, 25 tbr, 25 tbn
  [image2 @ 0x7ff751803e00] Using AVStream.codec to pass codec parameters to muxers is deprecated, use AVStream.codecpar instead.
  Output #0, image2, to '/Users/jaketr00/Desktop/IMG_19022.JPG':
    Metadata:
      encoder         : Lavf57.35.100
      Stream #0:0: Video: mjpeg, yuvj422p(pc), 5184x3456, q=2-31, 200 kb/s, 25 fps, 25 tbn
      Metadata:
        encoder         : Lavc57.38.100 mjpeg
      Side data:
        cpb: bitrate max/min/avg: 0/0/200000 buffer size: 0 vbv_delay: -1
  Stream mapping:
    Stream #0:0 -&gt; #0:0 (mjpeg (native) -&gt; mjpeg (native))
  Press [q] to stop, [?] for help
  frame=    1 fps=0.0 q=8.2 size=N/A time=00:00:00.04 bitrate=N/A speed=0.0753x   frame=    1 fps=0.0 q=8.2 Lsize=N/A time=00:00:00.04 bitrate=N/A speed=0.0752x    
  video:554kB audio:0kB subtitle:0kB other streams:0kB global headers:0kB muxing overhead: unknown
  </code></pre>
  
  <p>Is there any way to stop this from happening?</p>