Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

Is there a way to change the rotation angle of a video file?

I have a couple of videos in the wrong direction so all I wanted is to correct it.

share|improve this question
    
I am not sure what your problem is. What do you mean with position? The directory the video file is stored in? Just select the files, right-click and select "cut" - then - in the correct folder right-click again and select paste. This is one way to move files. –  Michael K Nov 29 '11 at 11:40
    
no I meant to rotate it... thanks anyway –  maniat1k Nov 29 '11 at 16:57
    
I think vlc can do it –  Tachyons Oct 26 '12 at 16:16
    
please answer the question . what software do I use to rotate a video in Ubuntu 12.10. ? –  Bennett Oct 26 '12 at 16:31

5 Answers 5

up vote 39 down vote accepted

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

sudo apt-get update
sudo apt-get install avidemux

Then open the video, select a new video format and don't choose copy. Click on Filters, scroll down until you see rotate. Add it, select the right angle and finally select preview, and then ok.

Go to file, save, save video, and your are done.

share|improve this answer
1  
Not sure what video format i should choose? Can i keep original video format? –  Dziamid Dec 4 '12 at 9:47
1  
I have rotated videos (.MOV) in Windows XP, using Apple Quicktime Pro ("QTP"). If done correctly the file remains rotated for other Windows machines and on my wife's iMac, but appears unrotated in Dragon Player ("DP") using Kubuntu 12.04.1. DP doesn't claim to be more than a "Simple" player, but I suspect that the problem is that QTP rotates files in a way that is accessible only in QT. Does Avidemux do better? –  WGCman Dec 9 '12 at 12:14
    
I'm trying to find out how this can be achieved using avidemux2_cli so that I can perform this simply from the context menu via nautilus-script. –  Sadi Sep 23 '13 at 17:06
    
What does "select a new video format and don't choose copy" mean, exactly? –  Jeff Trull Jul 6 at 4:57

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 rotate 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

Maybe your distro uses avconv instead of ffmpeg (for example avconv is the default package for Ubuntu — in libav-tools Install libav-tools). In this case just change ffmpeg to avconv:

avconv -i in.mov -vf "transpose=1" out.mov
share|improve this answer
3  
-sameq doesn't mean 'same quality', it is actually a very limited option that is almost never practically useful, and has been removed from recent versions of ffmpeg precisely because its name causes confusion. –  evilsoup Sep 16 '13 at 9:14
    
@evilsoup thank you for the comment. I've rolled back the changes. However, a better link to provide is this: trac.ffmpeg.org/wiki/…;, which is from the ffmpeg site itself. –  Alaa Ali Sep 17 '13 at 4:29
1  
N.B. that ffmpeg is now deprecated in favour of avconf "*** THIS PROGRAM IS DEPRECATED *** This program is only provided for compatibility and will be removed in a future release. Please use avconv instead." See a the answer for avconv: askubuntu.com/questions/269429/… –  Sparhawk Feb 10 at 6:50
    
@Sparhawk You are right --- but it seems that ffmpeg has a chance of doing a comeback. lwn.net/Articles/607591 ;-) –  Rmano Sep 8 at 9:37

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)
share|improve this answer
    
convert to a rotated form. –  Bennett Oct 26 '12 at 16:46
    
Out of curiosity: did you use mencoder in the end or kdenlive? There is a lot of documentation available online for tweaking mencoder options btw. Also some recommendations for "the perfect mencoder command line"(TM), most of them good. –  Paul Hänsch Oct 27 '12 at 13:01

As of Totem 3.1.4 (in Raring 13.04 and beyond), there is a "rotation plugin" which you can turn on (edit/plugins), and then rotate e.g. via ctrl-r.

I think proper rotation should be automatic when there is rotation metadata, and I commented on a relevant Totem bug here: Bug 701950 – Iphone Movies

There are also ways to do this in mplayer (and to convert to a rotated movie with mencoder), e.g.

 mplayer -vf rotate file.mov

or

 mencoder file.mov -oac lavc -ovc x264 -vf rotate=1 -o file-rotated.mov
share|improve this answer

The best option (in my opinion!) is OpenShot, you simply follow these easy steps:

  1. Start OpenShot
  2. On the File Tab, Import the video file you need to rotate
  3. Drag the imported video to the timeline field at the bottom (either one will do!).
  4. Once the videoclip is in the timeline field, right click on it and choose rotate to the desired angle
  5. Then on the File Tab choose Export video and set the prefered format and location to it!
  6. And presto!! That's it
share|improve this answer
    
You don't really explain how to acutally rotate it. Please edit your answer and add that information. –  MadMike Nov 13 '13 at 7:20

protected by Community Sep 10 at 13:38

Thank you for your interest in this question. Because it has attracted low-quality answers, posting an answer now requires 10 reputation on this site.

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.