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.

Anonymous

iDealshare VideoGo also helps to rotate videos.

Vincent

I use Avdshare Video Converter to rotate videos.
It has both Mac and Windows version.
Step 1: Add video to Avdshare Video Converter
Step 2: "Effect" button to open the 'Video Effect' window;
Then click '90 Clockwise button' to rotate video file 90 degrees, 180 degrees, 270 degrees; or click 'Flip Horizontal' button
Step 3: Click Convert button to finish rotating videos.

blesshealth

I use iDealshare VideoGo to rotate video files: Step 1: Add video to iDealshare VideoGo; Step 2: Click Effect button to find the rotate option; Step 3: Click Convert button to finish rotating.

Marcel Kofler

I think FFmpeg is not friendly for beginners like me. I am not tech-savvy and I don't understand how to rotate a video with FFmpeg even with a tutorial. I am personally using an easy alternative - Joyoshare Media Cutter, an all-in-one video editor. With it, I just need to drag my video to it - choose Encoding mode and output format - click Edit and select Adjust - touch Start to export. Very easy.

Your email will never ever be published.

Previous:
Fastest way to uniquify a list in Python >=3.6 December 23, 2017 Python
Next:
Whatsdeployed facelift January 5, 2018 Python, Web development, Mozilla, Docker
Related by category:
fnm is much faster than nvm. December 28, 2023 macOS
set -ex - The most useful bash trick of the year August 31, 2014 Linux
Be careful with Date.toLocaleDateString() in JavaScript May 8, 2023 macOS
brotli_static in Nginx November 8, 2024 Linux
Related by keyword:
Fastest way to take screencaps out of videos December 19, 2014 Linux, Web development, Mozilla
Screenshot-sharing performance comparison November 13, 2015 Web development, macOS
How I back up all my photos on S3 via Dropbox August 28, 2014 Photos
logrotating all my Zope event logs February 6, 2008 Zope, Linux