Skip to content
July 6, 2011 / Chris Merck

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 -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

And voila!

Unfortunately there is significant quality loss, which would likely be less drastic if transpose could do the whole 180-degree rotation in one shot.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: