2

I've noticed that some videos I take are rotated 180 degrees or 90 degrees. When I play them back in Windows (using any number of video players) or a Bluray player with USB input, they are rotated, making them hard to view. Unlike photo viewing software, video players don't seem to have a simple integrated rotate function.

Most of the files are mp4 files, and some are avi.

What software (Windows or Android) will rotate a video 90 (or 180) degrees and save the rotated video without losing any quality?

2

On windows, or Mac/Linux, you can use ffmpeg or avconv with the video filter option -vf "transpose=1" (you many need to either use a different number or use it more than once to get the results that you need).

Both are free (libre & FOSS) utilities/libraries that, as well as being able to convert between 100s of video storage formats, allow a large number of other operations to be performed on the files including transposing the video.

The amount of quality loss depends largely on the codec used in the input, (and output), file(s). You can also control the quality by changing the bit rate, changing the resolution, etc., so as to reduce the file size. One example is to create HD, Std & Mobile versions of the same video but you will never really get a higher resolution or quality than your input file(s).

While ffmpeg and its later fork avconv are primarily Linux utilities there are ports for both Windows & Mac-OS/X (plus others).

Since this is command line stuff there are no exciting screen shots but I recently used:

avconv -i 00001.mpeg -ss 00:00:10 -vf "transpose=1" FirstDance.mpeg

To do exactly what you are asking for on a video of a wedding reception party that needed to be rotated 90° and that I needed to skip the first 10 seconds. A tip for you - first use the tool to extract a 10 second section of your video into a new file called short.mp4 then play with the options using that file - saves a lot of waiting to see if you got the right settings.

There are also a number of front end GUIs that expose (some of) the functionality of the command line tool.

The web sites for downloads & documentation are avconv & ffmpeg.

A word of caution - you are not supposed to use either of these in some jurisdictions due to questions about software patents of the video codecs.

  • Thank you so much for your answer. You mention "the amount of quality loss..."; is it possible to accomplish this in a lossless manner? – RockPaperLizard Nov 11 '14 at 20:46
  • MP4 and most other video codecs are lossy - to avoid excessive size they have to be - and sometimes the way the maths works out a lossy 800x600 has different losses to a 600x800 - once something is lost you can never get it back - you might recreate what it might have been but it is still not back. – Steve Barnes Nov 11 '14 at 22:51
  • 1
    Thanks, Steve. I think my comment was too brief to be clear. What I meant to ask you was if it is possible to perform the rotation in a lossless manner? IOW, the videos will be lossy due to being compressed with MP4, but I don't want to lose any quality during the rotation. For example, with a JPEG static image, you can rotate it without any change in the actual pixels (100% lossless rotation). Is there some way to do that with video files (and MP4 video files in particular)? – RockPaperLizard Nov 12 '14 at 6:21
  • 1
    You can remove or set the rotation flag in ffmpeg with -metadata:s:v:0 rotate=0 or -metadata:s:v:0 rotate=1, respectively. Rotation flags do not work for MPEG files as shown in your answer, but work for MP4/MOV as the OP needs. More info here: superuser.com/q/564233/48078 (cc @RockPaperLizard) – slhck Nov 13 '14 at 11:08
  • 1
    @Suncatcher - the reason that the metadata solution, (when it works), is so much quicker by a lot is that it doesn't actually rotate the the frames in the video it just sets a flag to tell the player software to rotate it on display - it is entirely possible that the player software that you are using does not honor that instruction. – Steve Barnes Aug 10 '18 at 4:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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