Rotate & Flip Video Files in Ubuntu (Linux)

Rotate Video Files

Rotate Video Files

The first thing that might pop-up in the reader’s mind is that why would anyone ever want to rotate a video? Well this need arose when I recorded videos using iPad (which always auto rotate the screen according to the user orientation). But when I transferred those to my PC, I realized that some needed to be rotated 90 degrees and some 180 or vertically flipped.

Ubuntu always has the answers to my questions. In a previous post in which I shared the commands on how to record screencasts in Ubuntu, I mentioned about avconv tool and how to install it with codecs. The same nice tool can be used to flip and rotate videos also.

To vertically flip a video:

avconv -i input_video.mov -c:v libx264 -c:a copy -vf "vflip" output_video.mov

To horizontally flip a video:

avconv -i input_video.mov -c:v libx264 -c:a copy -vf "hflip" output_video.mov

To rotate it 90 degree clock-wise:

avconv -i input_video.mov -c:v libx264 -c:a copy -vf "transpose=1" output_video.mov

The copy parameter means to keep the same audio encoding.

For further reading visit the official documentation: http://libav.org/libavfilter.html

Advertisements

5 thoughts on “Rotate & Flip Video Files in Ubuntu (Linux)

  1. Your methods don’t work in all cases. A better way to do it would be like this (for the 90 degree rotation for example):

    $ avconv -i INPUT.MP4 -r **.*** -vf transpose=1 -b:v ****k OUTPUT.MP4

    where the -r frames per second and -b:v video bitrate are obtained from a CLI program such as mediainfo.

  2. Pingback: Minor Video editting wit batch posiblities. | Kingston MakerLabs

  3. If you are asking for rotate a video 90º or 180º, you should use avidemux.
    sudo apt-get install avidemux
    them, open the video, select a new video format, don’t choose copy, then click on Filters, scroll down until you see rotate. Add it, slecet the right angle, and finally, select preview, and ok.
    Finally, file, save, save video, and your are done.

  4. Pingback: Rewriting history | Super Spread Sheet S³

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s