Categories
How-To

How To: Rotate a Video

Have you ever taken a video with a digital camcorder, phone or camera only to have it come out sideways? I am sure we’ve all done this! If you are running linux you can easily rotate these videos using a free tool called FFMPEG.

Ruby Falls sideways video example.  This video needs rotation.
A good example of a video that needs rotation. This was shot with a Nikon D7100 digital camera. Many smartphones can automatically rotate videos that have been shot, but when storing the videos or uploading them to YouTube, you’ll want to make sure they are saved in the correct orientation.

Open your terminal program and obtain the program if you do not already have it installed. If you have it installed this command will just exit.

$ sudo apt install ffmpeg 

After installing ffmpeg, change to the directory that contains the video file you wish to rotate and enter the following command that will actually rotate the video.

$ ffmpeg -i <video to rotate> -vf "transpose=1" -c copy <rotated video file>

The in the two placeholders (<video to rotate> and <rotated video file>) enter the full file name of the video you wish to rotate, and what you’d like the output file to be called.

Ruby falls, rotated video
The final video, rotated.

Transpose can have several different values.

  • “transpose=1”
    Rotate clockwise 90 degrees.
  • “transpose=2”
  • Rotate counterclockwise 90 degrees.

Transpose can also be used to rotate and flip the image. Use values of 0 (clockwise) and 3 (counterclockwise) respectively.

In some cases you may have to omit the “-c copy” argument. Including this significantly speeds up the process, but sometimes a re-encode is required and ffmpeg may indicate that you should omit this.

Check out more of our How-To’s for additional great tips like this one.

Leave a Reply