Rotate a MP4 file, while preserving codec and quality attributes

14

5

I need to rotate a MP4 video by 90 degrees. There is software like Free Video Flip and Rotate available that does this but produces an AVI file.

Do you have any suggestions for a software to produce a MP4 that is in the same quality (and file size) as the original, just 90 degrees rotated? Does not have to be free software ;-)

thegate

Posted 2009-12-11T22:30:56.227

Reputation: 143

That utility wouldn't open an mp4 for me. – user15507 – 2013-12-01T13:41:56.760

Answers

2

There's no way to rotate a video without re-encoding it. So you can only appoximate the size and quality.

I recommend VirtualDub to do the rotation. It's free and fast.

fretje

Posted 2009-12-11T22:30:56.227

Reputation: 10 524

6VirtualDub does not seem to support MP4, but Avidemux does. – sschuberth – 2013-01-10T22:00:37.757

7

This is actually not true. The MP4 format supports a rotate flag, which informs the player to rotate the video prior to displaying it. The flag can be edited using f.ex. the MP4Box command-line multiplexer.

– Witiko – 2013-06-30T17:02:00.990

9

  1. Open Avidemux (free video editing software)
  2. Open your mp4 file.
  3. Choose a "Video Output" other than "Copy" [I chose "Mpeg4 ASP (ff)"]
  4. Choose Video > Filters (or in Windows, press Ctrl+Alt+F)
  5. Double-click "Rotate" to add that filter
  6. Choose 90 degrees
  7. Press "Close" to exit "Video Filter Manager"
  8. Save

(Thanks to @secret for getting me started, but his/her list of steps weren't complete.)

Ryan

Posted 2009-12-11T22:30:56.227

Reputation: 959

I used this once in the past, I don´t know what I did, avidemux looks like detected video was rotated automatically, and rotated video by itself :/... now I have another clean installation and does not work that way anymore, and when I select video outputs (tried all possible combinations) it never ends with same file size than the first time... I would love to have a way to say... "format same than origin" and rotate only – Yogurtu – 2019-06-21T22:44:58.720

7

I used Avidemux, a free video editor.

This software allows you to rotate any movie.

In a drop-down list you can select the desired output format (e.g. MP4, AVI, FLV, etc.).

If using the MPEG-4 ASP setting in the video drop-down list, you will have to fiddle around with Quantizer setting (A higher number means reduced file size and less quality).

This tool is great when you capture a movie on your cell phone and want to send the movie to friends!

mathijsuitmegen

Posted 2009-12-11T22:30:56.227

Reputation: 243

7

  1. Open Avidemux
  2. Press Ctrl+Alt+F (for Windows)
  3. Select Rotate
  4. Save

secret

Posted 2009-12-11T22:30:56.227

Reputation: 87

Easiest method so far! – TimothyP – 2013-03-06T06:17:17.250

When I save, I end up with a file of the same size which doesn't actually play. This didn't work until I changed "Video Output" from copy to something like Mpeg4 ASP (ff) – Sterno – 2013-09-24T17:36:14.797

1-1 because although the program suggested is helpful, the steps are incomplete. – JYelton – 2013-10-23T19:21:30.907

See Ryan's solution for complete steps. – Anton – 2014-05-28T18:50:31.333

3

If you actually recorded video in landscape mode, but phone erroneously saved in metadata that it is 90 degrees rotated (it happen to me today during helicopter flight) just download ffmpeg and use this command (completely lossless as it just writes new header - metadata):

ffmpeg -i input.mp4 -c copy -metadata:s:v:0 rotate=0 output.mp4

Nenad Bulatovic

Posted 2009-12-11T22:30:56.227

Reputation: 528

I just tested this approach, seems not to lose quality, file size is 0.001% bigger tough, not sure why if this is a header-metadata change only. – Yogurtu – 2019-06-21T22:42:40.003

I experience a 1.3MB decrease in size but the command ran in a couple of seconds, not nearly long enough to transcode anything 3 minutes long. All I can guess is that GoPro has a bunch of extra room in the file that is not actually used. Maybe space pre-allocated for event tags and such. – boatcoder – 2020-02-16T17:29:20.230

2

You can rotate an MP4 video using VLC and some awesome nice guy wrote a detailed set of instructions with screenshots here: http://www.wintips.org/how-to-rotate-and-save-a-video-using-vlc-media-player/ (Disclaimer: This post isn't spam, I have no connection at all to the site or the dude who wrote the instructions. I merely used the instructions to rotate a video of my baby daughter and so I'm just really grateful for it.)

Grateful Dood

Posted 2009-12-11T22:30:56.227

Reputation: 21

I think my version of VLC is broken because VLC won't rotate anything, even for viewing, let alone saving the rotated file..... – boatcoder – 2020-02-16T17:21:28.110

1

The easiest method I've seen is with QuickTime (Pro), open Movie Properties, click Video Track, then go to Visual Settings and use the arrows to rotate as needed. Then close the Movie Properties, then do a File Save As.

Syclone0044

Posted 2009-12-11T22:30:56.227

Reputation: 1 222

0

I had many .mov files that needed rotation. I used Square 5 Streamclip and did not loose any quality. Super easy to save as in many file formats: http://www.squared5.com/svideo/mpeg-streamclip-win.html

larry

Posted 2009-12-11T22:30:56.227

Reputation: 1

Your answer sounds suspiciously like an advertisement. Please read the FAQ on these types of posts as answers. If you're going to provide a link to your product at least take the time to show how you would do this in it. At least your answer would have more merit than just a link.

– slm – 2013-04-12T17:00:01.980

I tried it. First the "stable" version 1.2 - it does not have the Rotate option. The beta 1.2.1b6 does have the option, but it didn't work for me on 1st try and I didn't pursue any further. At least there's nothing to install - just unzip an executable - and it doesn't seem to hae strings (i.e. crapware) attached. It does require a certain version of Quicktime Alternativeto be installed. A link to that is on their site – Cristi Diaconescu – 2013-05-05T21:31:40.417