Possible to rotate video (.MOV/H.264/AVC) losslessly?

10

3

The iPhone (3GS, 4, 4S, etc) often records video upside-down but then includes metadata about the rotation inside the MOV container.

However, many applications (XBMC, VLC, Windows Media Player) do not understand this rotation metadata and so the videos play upside-down.

Is it possible to permanently rotate these videos and remove/ignore the rotation flag?

SofaKng

Posted 2011-12-27T18:46:40.507

Reputation: 1 065

If your concern is to have it done without re-encoding, it's not really possible. If the video was MJPEG, it would, but the way more sophisticated video codecs like h.264 work is quite different. They really depend on the left-to-right and top-to-bottom order of a picture. You might just want to look for a way to display them rotated or re-encode them with a very high quality. – slhck – 2011-12-27T18:54:17.220

VLC allows me to rotate them (during playback), but XBMC does not. How can I re-encode them but keep almost all of the original quality? – SofaKng – 2011-12-27T18:58:14.937

Well, I assume you're on Windows. Here's a related question: How do I rotate video (MOV) file on Windows? — the trick is to just set the highest possible quality settings when exporting, which might result in a bigger file than the original. I'm not 100% sure, but it seems you're in a rather bad situation. FFmpeg also has the -vf rotate=1 option to achieve the same. The output options will need tweaking though, to get decent quality.

– slhck – 2011-12-27T19:04:28.577

Could you maybe provide a short sample clip of such a video? Trying to experiment a bit. – slhck – 2011-12-27T20:17:28.333

Answers

3

I had the same problem.

You will need to use Apples iMovie Editor or Quicktime. on an Apple Quicktimepro is included free.

You can purchase Quicktime Pro for windows - You will get the same lossless experiences for rotating, cutting and re saving to a new lossless HD file.

Using iMovies - It will automatically republish your video in a lossless format, with transitions,cuts,pastes,audio,etc. In the correct orientation without manual rotation.

For Windows or other OS's there is no FREE method to do it and its best to use the Quicktime library at all time.

Using windows.. you will have to re encode it --- I searched and searched. only Quicktime will play it in the correct orientation.. but you cannot tell it to fix the original file. Seems a bit odd.. but that was Steve Jobs philosofy.. It always works like you want on a MAC ;)

Piotr Kula

Posted 2011-12-27T18:46:40.507

Reputation: 3 538

1I don't think you understood the issue. If you're on a Mac, opening such a movie file, the rotation flag will automatically be read. Also in iMovie. There's no need to rotate the file itself, because QuickTime (for example), will correctly interpret it. The reason it doesn't work on Windows is that you have to re-encode, because no player respects the flag. – slhck – 2011-12-27T20:12:10.010

1HI - using iMovie export.. will export it rotated.. on windows.. it does not re flag it.. So 1- Import into iMovie(on a mac) 2-Export to HD-HQ 3-Play on windows(will be rotated to proper aspect) Quicktime on Mac supports proper on the fly transcoding with minimum quality loss) Thats what i meant. – Piotr Kula – 2011-12-28T20:21:28.613

2Ah.. so there's a need to re-encode, right? iMovie will automatically rotate but you have to re-encode? – slhck – 2011-12-28T20:42:29.407

1Yea something like that- you have to save(export) it but the Mac version of iLife uses the full capabilities of quicktime to quickly "re-encode" it.. Quicktime on Windows is limited. I borrowed a buddues mac to do it, resonably quick. But i realised i made a mistake, and re-encoded a 1 and half hour movie on windows..... 2 days... – Piotr Kula – 2011-12-28T22:00:26.100