HandBrakeCLI video rotation

A few weeks ago I captured a video on my phone of an echidna running along the ground. When I reviewed the video on my computer it was apparent that it was rotated 90° anti-clockwise from the intended orientation. This is probably my fault for starting recording with the phone held sideways.

This is a still image from the original video.

So I needed to rotate the video 90° clockwise.

I used HandBrake on my Macintosh computer for this task. HandBrake is a free and open source video transcoder software. There is a graphical interface and a command line interface. I mostly use the graphical interface, but for some operations (including rotation) the command line is essential.

You’ll need to name the input file input.mp4 and put it in the same directory as the HandBrakeCLI executable (or modify the command accordingly). Open up a Terminal window and change to the directory containing the HandBrakeCLI executable and the input.mp4 file. The following command will create output.mp4, a render of input.mp4 rotated 90° clockwise.

./HandBrakeCLI -i input.mp4 -o output.mp4 --preset=Normal --rotate=4

The output video is the correct orientation.

You can read the documentation for HandBrakeCLI with the following command. It can do everything the graphical interface can do, plus much more.

./HandBrakeCLI --help