iPhone recorded videos getting rotated on Windows systems
You can't change the way the iOS camera records video. It sets a rotation flag, and if you want the video to be shown correctly in both OS X and Windows (and other players), you'll have to:
- Remove the rotation flag. Now your video is landscape, but still showing wrong.
- Re-encode the video, rotating it.
Download ffmpeg (a static build for your OS is fine).
You then need the transpose
filter, e.g.
ffmpeg -i portrait.mov \
-c:v libx264 -filter:v "transpose=1" \
-c:a copy \
-metadata:s:v:0 rotate=0 out.mp4
A few remarks:
Here,
transpose=1
will rotate by 90°. If your video is upside down, you need to combine the options. You can either use-filter:v "transpose=2,transpose=2"
or others. See here: How to flip a video 180° (vertical/upside down) with FFmpeg?The
-metadata:s:v:0 rotate=0
option ensures that the rotation metadata in the first video stream is set to 0 again (it was on 90 before), so your video now shows fine on both OS X and other OSes.Naturally, transposing will re-encode the video and you'll lose quality. Add the
-crf
option after-c:v libx264
to set the Constant Rate Factor, which controls the quality. Use lower values to get better quality. 23 is actually the default, so you don't need to specify it at all, but you might want choose something as low as 18 if the video ends up looking bad otherwise, e.g.,-c:v libx264 -crf 18
.In some cases you might just want to remove the rotation flag but keep the original video bitstream intact. To do so, replace
-c:v libx264 -filter:v "transpose=1"
with-c:v copy
.Check out the x264 encoding guide for more.