How can I rotate a video?

You can also use ffmpeg and the commandline (taken from Rotating videos with FFmpeg):

Rotate 90 clockwise:

ffmpeg -i in.mov -vf "transpose=1" out.mov

For the transpose parameter you can pass:

0 = 90CounterCLockwise and Vertical Flip (default) 
1 = 90Clockwise 
2 = 90CounterClockwise 
3 = 90Clockwise and Vertical Flip

And to flip it horizontally (ffmpeg documentation):

Flip the input video horizontally.

For example to horizontally flip the video in input with `ffmpeg':

ffmpeg -i in.avi -vf "hflip" out.avi

Nota bene 1

Older versions of Ubuntu supplied avconv instead of ffmpeg. In this case just change ffmpeg to avconv:

avconv -i in.mov -vf "transpose=1" out.mov

Nota bene 2

If the output is a .mp4 video you has to add strict -2 before the output file to avoid error message :

ffmpeg -i in.mp4 -vf "transpose=1" -strict -2 out.mp4

If you are asking for rotate a video 90º or 180º, you should use avidemux.

sudo apt-get update
sudo apt-get install avidemux
  1. open the video in avidemux
  2. select a new video format and don't choose copy
  3. Under "Video" click on Filters
    1. Choose "Transform" and scroll down until you see rotate.
    2. Add it
    3. select the right angle
    4. select preview
    5. ok.
  4. Go to file
  5. save
  6. save video

And you're done.


Do you mean rotation on playback or converting it to a rotated version?

As a commandline-user I normally use mplayer:

Playback: mplayer -vf rotate=1 videofile.mp4 (rotate can have values from 0 to 7, 1 rotates 90deg clockwise)

Convert (requires transcoding): mencoder -vf rotate=1 videofile.mp4 -oac copy -of lavf -lavfopts format=mp4 -ovc lavc -lavcopts vcodec=mpeg4 -o newfilename.mp4 (you can use other video codecs as well, this is just an example)

And here is a graphical tool to do the latter: kdenlive (a kde application from the universe)

  • import your video as a clip
  • draw the clip into the timeline
  • rightclick onto the video chunk in timeline
  • select "Add Effect" -> "Crop and Transform" -> "Rotate (Keyframable)"
  • The effect can be configured in the upper central section of the window, set X to 900 (thats 90 deg clockwise)
  • Render your project (Project -> Render in the main menu)
  • Be careful to choose a video resolution for the resulting portrait format
  • select any video codec you like, i recommend x264 or vp8 (webm)