How to rotate a video on OSX with ffmpeg

03 January 2018   1 comment   Linux, MacOSX

Every now and then, I take a video with my iPhone and even though I hold the camera in landscape mode, the video gets recorded in portrait mode. Probably because it somehow started in portrait and didn't notice that I rotated the phone.

So I'm stuck with a 90° video. Here's how I rotate it:

ffmpeg -i thatvideo.mov -vf "transpose=2" ~/Desktop/thatvideo.mov

then I check that ~/Desktop/thatvideo.mov looks like it should.

I can't remember where I got this command originally but I've been relying on my bash history for a looong time so it's best to write this down.
The "transpose=2" means 90° counter clockwise. "transpose=1" means 90° clockwise.

What is ffmpeg??

If you're here because you Googled it and you don't know what ffmpeg is, it's a command line program where you can "programmatically" do almost anything to videos such as conversion between formats, put text in, chop and trim videos. To install it, install Homebrew then type:

brew install ffmpeg

Comments

Dong

This is a great tip and I was so excited to see it work from ffmpeg but unfortunately, on QuickTime 10.4 you can no longer open the MOV after performing the transformation. I haven't found a way to work around this yet. Amazing how difficult it is to rotate a movie - I guess the difficulty is modifying something post-compression but in the case of these tools -decoding/re-encoding should be an obvious available option. If anyone knows of a solution - I would be eternally grateful.

Your email will never ever be published


Related posts

Previous:
Fastest way to uniquify a list in Python >=3.6 23 December 2017
Next:
Whatsdeployed facelift 05 January 2018
Related by Keyword:
Screenshot-sharing performance comparison 13 November 2015
Fastest way to take screencaps out of videos 19 December 2014
How I back up all my photos on S3 via Dropbox 28 August 2014
logrotating all my Zope event logs 06 February 2008
Related by Text:
jQuery and Highslide JS 08 January 2008
I'm back! Peterbe.com has been renewed 05 June 2005
Anti-McCain propaganda videos 12 August 2008
Ever wondered how much $87 Billion is? 04 November 2003
Guake, not Yakuake or Yeahconsole 23 January 2010