Can HandBrake flip/rotate a video?

93

24

I'd like to use HandBrake to compress some video that was taken via a camera that was mounted upside down.

I found a reference to a command-line rotate option, but I can't find it in the GUI.

Am I just missing it?

nonot1

Posted 2012-05-01T02:45:46.210

Reputation: 1 489

Answers

93

On the Extra Options under Video tab put , --rotate=4 to rotate clockwise by 90 or , --rotate=7 for 90 counterclockwise.

Note: It will not work without the preceding comma and space.

(As of version 0.10.2.7286)

----Edit: as of 0.10.5.x

90 degrees counterclockwise

, --rotate=8

90 degrees clockwise

, --rotate=3

marche

Posted 2012-05-01T02:45:46.210

Reputation: 1 039

I did try with the latest — Version 0.9.9 x86_64 (2013051800) — GUI and couldn't inject any parameter in the x264 Advanced Options textarea. Plus, the activity panel actually states that an invalid option has been passed (x264 options: Unknown suboption , --rotate). Am I missing something? – Tom Desp – 2014-08-12T13:34:00.657

Just forgot to mention it was on a MacOS HandBreakGUI. – Tom Desp – 2014-08-12T13:44:09.887

Ubuntu 12.04 worked with billynoah's answer below, this didn't work in the GUI for me. – onaclov2000 – 2014-09-06T23:59:34.120

2None of these options appear to work on MAC OS X Yosemite with version 0.9.9, so I just used QuickTime -> Edit to do it. – jjxtra – 2014-10-12T14:02:54.487

1As of Handbrake 0.10.0 this no longer works :-/ – kralyk – 2015-03-16T17:16:35.510

1Still works for me on Handbrake 0.10.2. Pretty sure this is codec dependent, i.e.: it will work on some codecs and it won't on others. – oKtosiTe – 2015-07-05T20:48:55.137

I think you need the following line, "Custom --rotate=[option]", where [option] equals the option of rotation according to the Handrake manual. – pdvries – 2016-01-14T16:53:45.927

Would be nice if the developers remove the need for a leading comma. Which user gets the idea to start an input by a comma?! – Kai Noack – 2016-03-29T10:43:19.570

3worked like a charm :) Maybe the comma works like closing the x264 options and add it to the other one (like SQL injection) – keiki – 2013-12-12T20:03:13.747

2This worked! Needs more upvotes. – dtbarne – 2014-02-06T02:25:11.713

In Linux this doesn't work. – Juan Simón – 2014-04-10T09:18:08.973

8, --rotate=7 rotates 90 degrees anticlockwise for me on Windows 7 – Rob – 2014-05-09T21:09:45.883

10This is probably the best answer. Agreed; it should be upvoted to the top. It works with all the other GUI options. I was able to use , --rotate=3 for a 180 degree rotation. – mkasberg – 2014-05-18T01:10:39.783

3This is actually pretty funny; it works as an injection attack against the HandBrake GUI. The current Windows GUI works by constructing a long query string for the CLI. Since the "extra options" string for video isn't enclosed in quotes, you can close out the "extra options" section and just start putting in whatever command-line parameters you want. That's how this is working. Theoretically you could add whatever CLI parameters you want here. (At least until this is fixed) – RandomEngy – 2014-06-15T18:08:25.493

23

From the Handbrake documentation:

    --rotate            Flips images axes
      <M>               (default 3)

To rotate 90° I used:

HandBrakeCLI -i source -o target.m4v --preset="Universal" --rotate="4"

with success. No luck getting this to work from the GUI.

note: I'm not sure why the above referenced blog post says:

a value of 1 flips on X, 2 flips on Y, and 3 flips on X and Y.

"3" is said to be default and as such should do no rotation at all. I've found this to be true.


info added by sorein:

HandBrake documentation: https://trac.handbrake.fr/wiki/CLIGuide

Sintax:
, --rotate=n
(comma and space needed)
It has to be entered in the tab VIDEO / EXTRA OPTIONS

Behaviour of "n"
The management of the ROTATE option is chaotic. It mixes FLIP and ROTATE!

1 : x flip
2 : y flip
3 : 180 degrees rotate (also the DEFAULT)
4 : 90 degrees rotate (clockwise)
5 : 90 degrees rotate + y flip
6 : 270 degrees rotate + y flip
7 : 270 degrees rotate

billynoah

Posted 2012-05-01T02:45:46.210

Reputation: 379

3Worked in Ubuntu 12.04 for me. (with Handbrake CLI only). the Options in the Video tab in the gui didn't appear to work for me. – onaclov2000 – 2014-09-06T23:58:52.973

I'm in the same boat. --rotate="3" flipped my move 180 degrees, but only if I used the CLI version of the tool. – Tom Purl – 2016-11-12T21:55:39.310

In newer version the argument is --rotate=angle=90 (tested on Mac OSX) – Panayotis – 2017-07-19T15:55:48.813

that works for me on osx – timaschew – 2014-05-15T19:01:29.217

Note, handbrake CLI does not come with handbrake, it is a separate download – deweydb – 2014-05-21T22:24:37.560

14

From a recent post iPhone video rotation (and compression)

HandBrake (or at least the GUI) does not offer a way to rotate video. The HandBrake CLI does have a "rotate" option, however I found it is not a true rotation. Rather, it simply flips on an axis. The documentation is poor, but I found that a value of 1 flips on X, 2 flips on Y, and 3 flips on X and Y. So using a value of 3 is the same as doing a 180° rotation, which is useful for videos that are upside down, but not for videos that are sideways.

mencoder can do proper rotation.

While this refers to a Mac OS-X platform, I guess it should work for you too. Find a mencoder binary for your platform.

nik

Posted 2012-05-01T02:45:46.210

Reputation: 50 788

1I am just asking about flipping the video. Is this option in the handbrake GUI anywhere? – nonot1 – 2012-05-03T02:35:55.430

I couldn't find the rotate option in the GUI either. If you set everything else up and then "Add To Queue" when you "Show Queue" there is an option to create a batch script of the full queue. Do that then edit the batch file and add --rotate to the files that you want rotated. Then just run the bat file. This avoids most of the work of building up the command line – Craig – 2012-12-31T22:29:35.333

2Command line options that are not visible in the GUI can be entered in the text box under the advanced tab. – None – 2013-02-14T11:03:01.013

@Matt That text box seems to be for x264 options, not Handbrake options. – duozmo – 2013-04-14T00:17:29.613

7

Fill disclosure: VidCoder author here.

An alternative might be to use the latest VidCoder beta, which uses the HandBrake engine and has in-GUI support for rotation and reflection (with previews):

VidCoder rotation example

RandomEngy

Posted 2012-05-01T02:45:46.210

Reputation: 432

Wow, VidCoder really fixed my problem to rotate 180 a video. Thanks. – Matt Roy – 2016-11-26T23:54:55.903

2

I've tried putting

-7 --rotate <3>

into the box in the Video tab under Optimise Video: Extra Options box.

It worked and flipped my video on the XY axis (180 degree rotation).

Jason Chin

Posted 2012-05-01T02:45:46.210

Reputation: 29

In Windows (Win 7), it works perfectly for me, thank you. My iOS isn't smart enough to realize how I'm holding my phone when I start recording video - yet, when played back on my phone, it knows to rotate it 180 - so annoying! – MikeTeeVee – 2014-09-01T21:09:55.677

I tried the same with <4> for 90° clockwise rotation but it will still do 180°... – jj_ – 2015-06-18T18:22:43.593

This works, thanks! Much better than having to switch to another tool. – Jörn Zaefferer – 2013-10-09T09:44:46.820

I tried that in the Mac Handbrake, but it didn't work. I noticed that the added options build the "x264 unparse" string, so I tried also in the format separated with colons, e.g. "7:rotate=3" and variations. Does anybody know how to effect this on the Mac? – ttarchala – 2013-11-16T13:35:04.827

1In Linux this doesn't work. – Juan Simón – 2014-04-10T09:18:26.180

1

Note that as of Win x64 version 1.0.7 (and possibly earlier 1.0 versions), there is now a Rotate option under Filters, with the same 0/90/180/270 options that the CLI currently provides.

enter image description here

Dave DuPlantis

Posted 2012-05-01T02:45:46.210

Reputation: 358

1

In Winx64 0.9.9.5530 the syntax is:

rotate=3

No leading or trailing comma, space, etc.

Chris

Posted 2012-05-01T02:45:46.210

Reputation: 21