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?
Super User is a question and answer site for computer enthusiasts and power users. It only takes a minute to sign up.
Sign up to join this communityI'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?
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
, --rotate=3
for a 180 degree rotation.
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
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.
Full 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):
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.
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).
In Winx64 0.9.9.5530 the syntax is:
rotate=3
No leading or trailing comma, space, etc.
The command line options posted above no longer appear to work, but a Rotation dropdown has been added to the GUI.
The first implementation of this option appears to have been buggy, so be sure to:
Once you've done that, you can:
However, Handbrake still has a weird bug/quirk where, if you attempt to set it to 90 or 270, it will clamp both dimensions at the lower value. So, for example, your rotated 1920x1080 video will get exported at 1080x1080 instead of 1080x1920.
To fix that, you can:
After that, your video should be exported with the correct rotation and resolution. That said, be sure to double check the exported video to make sure that it looks correct.
I just used v1.5.1 of HandBrake to rotate a .mov file and output it as an .mp4. In the Dimensions
tab I just used the Rotation
dropdown, in my case changing it from 0 to 270 (other options are 90 and 180).
You can checkout a preview of the rotation on the Summary
tab.