ehough.com

personal website of Eric Hough

Fix upside-down iPhone 4 videos with mencoder

Accidentally shoot a video upside-down with your iPhone? Don’t worry, it’s easy to create a flipped copy that retains just about all the quality. Here’s how to do it using free tools on Mac OS X, though this should work on any *nix platform.

  1. Use Macports to install mencoder with the H.264 codec. # sudo port -d install mplayer-devel +mencoder_extras
  2. Use mencoder to make a flipped copy of your videomencoder -oac pcm -ovc x264 -vf flip,mirror -of lavf -x264encopts subq=6:partitions=all:me=umh:frameref=5:bframes=3:b_pyramid=1:weight_b:threads=auto input.mov -o output.movOf course, replace input.mov with the path to your input movie.

Ideally we would just flip the video without re-encoding it, but turns out this is impossible. I’m not a video encoding expert, but this will produce a copy of your video that has no noticeable quality degradation. I like H.264′s quality/compression ratio, so I grabbed a few of their recommended high quality settings. One minor issue is that the flipped video has no video stream, only audio, in Quicktime Player 10.0. Oddly, they’ll play normally in a browser with the Quicktime plugin. Plus the videos will upload to Flickr or YouTube just fine.

See the difference for yourself


4 Comments

  1. Thanks for the suggestion, but do you have a non Mac solution?

  2. Assuming you’re on Windows, you can grab a copy of mencoder that should for you here: http://oss.netfarm.it/mplayer-win32.php. I personally haven’t tried any other non-Mac solutions, though I would bet that http://www.virtualdub.org/ can flip your video.

  3. what happened to the original and flipped video samples?

  4. > what happened to the original and flipped video samples?

    Fixed now. Thanks for the heads up!

Leave a Reply