Rotate videos using HandBrake

handbrake_compRecently I recorded a video with my mobile inverted. When searching for a tool to undo the rotation I found that HandBrake can do what I wanted. HandBrake is a very popular and powerful multiplatform transcoder that gives fantastic output video and audio qualities at a smaller size if the right parameters are used. It has both GUI and CLI modes. There are many powerful switches in the CLI mode. For example to rotate a video by 90° clockwise, try the following command:

$ HandBrakeCLI -i input.mp4 -o output.mkv --preset=Custom --rotate=4

where Custom is one of the presets you saved in the GUI mode.

You can do the same from the GUI as well, add the following to Video ▸ Extra options (available only for x264 on Linux):

Custom --rotate=4

13 thoughts on “Rotate videos using HandBrake”

  1. I tried adding the following to the Video tab/Extra Options box on the HandBrake GUI, but none succeeded (on Win XP):
    rotate=4
    -rotate=4
    –rotate=4
    Custom –rotate=4
    Custom –rotate=4
    –preset=Custom –rotate=4

    If you check the Video/Use The Advanced Tab box in the HandBrake GUI (XP), and then add the following to the x264 Encoder Options text box, the rotate parameter works great!:
    –preset=Custom –rotate=4

    The following does work great in DOS at the command line however:

    HandBrakeCLI.exe -i input.mov -o output.mp4 –preset=Custom –rotate=4

    I guess I need to run it 3 times to rotate 270 degrees.

    1. I’ve tried these on XP and it worked:

      , –rotate=3 ROTATE 180 DEGREES
      , –rotate=4 ROTATE CLOCKWISE
      , –rotate=7 ROTATE ANTI-CLOCKWISE

  2. Thank you for this! I used the CLI options and could successfully rotate. Doing so in the GUI failed for all reported options here, as well as elsewhere online. Seems to plain not work in the GUI (in Ubuntu 16.04).

Leave a Reply

Your email address will not be published. Required fields are marked *