2014-02-13

Linux: rotating a mp4 video

If you want to rotate a mp4 video file in any direction here is a simple one-liner:

mencoder input.mp4 -o output.mp4 -vf rotate=1 -oac mp3lame -ovc lavc

Where rotate could be:
       rotate[=<0-7>]
              Rotates the image by 90 degrees and optionally flips it.  For values between 4-7 rotation is only done if the movie geometry is portrait and not landscape.

                 0    Rotate by 90 degrees clockwise and flip (default).

                 1    Rotate by 90 degrees clockwise.

                 2    Rotate by 90 degrees counterclockwise.

                 3    Rotate by 90 degrees counterclockwise and flip.

For more information use man mencoder.