Rotating Video from iPhone
Yesterday I had a video from my iPhone that played upside-down. I’m going to call this a bug on Apple’s part, even if there is some sort of meta-data in the file that indicates the “orientation” (If so, that’s B.S., Apple, just rotate the video on the phone!) I tried the mencoder-based technique described here, but it was only a modification of the ffmpeg-based technique I learned about here that actually worked for me.
Anyhow, so I’ll assume you’re stuck with a video that plays upside-down. You can fix it using two applications of ffmpeg‘s transpose filter:
ffmpeg -i upside-down.mov -vf transpose=2 -vcodec libx264 -crf 22 -threads -0 -acodec copy output.mp4 ffmpeg -i output.mp4 -vf transpose=2 -vcodec libx264 -crf 22 -threads -0 -acodec copy right-side-up.mp4
Unfortunately there is significant quality loss, which would likely be less drastic if transpose could do the whole 180-degree rotation in one shot.