Rotate a MP4 file, while preserving codec and quality attributes
Solution 1
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.
Solution 2
- Open Avidemux (free video editing software)
- Open your mp4 file.
- Choose a "Video Output" other than "Copy" [I chose "Mpeg4 ASP (ff)"]
- Choose Video > Filters (or in Windows, press Ctrl+Alt+F)
- Double-click "Rotate" to add that filter
- Choose 90 degrees
- Press "Close" to exit "Video Filter Manager"
- Save
(Thanks to @secret for getting me started, but his/her list of steps weren't complete.)
Solution 3
- Open Avidemux
- Press Ctrl+Alt+F (for Windows)
- Select Rotate
- Save
Solution 4
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
Solution 5
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!
thegate
Updated on September 17, 2022Comments
-
thegate almost 2 years
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 ;-)
-
user15507 over 10 yearsThat utility wouldn't open an mp4 for me.
-
Aldor over 3 yearsThis very similar question has a better answer than the below: use
exiftool
: superuser.com/a/1310590/127024
-
-
TimothyP over 11 yearsEasiest method so far!
-
slm about 11 yearsYour 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.
-
George D about 11 yearsI 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 Alternative
to be installed. A link to that is on their site -
Witiko almost 11 yearsThis 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. -
Sterno almost 11 yearsWhen 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 likeMpeg4 ASP (ff)
-
JYelton over 10 years-1 because although the program suggested is helpful, the steps are incomplete.
-
annejode about 10 yearsSee Ryan's solution for complete steps.
-
Yogurtu about 5 yearsI 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 about 5 yearsI 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
-
Momshad Dinuri Alvee over 4 yearsI think my version of VLC is broken because VLC won't rotate anything, even for viewing, let alone saving the rotated file.....
-
Momshad Dinuri Alvee over 4 yearsI 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.
-
Metal450 about 4 yearsThis is NOT necessarily lossless - if the source video has any other streams (i.e. subtitles, etc) they won't be copied. For that you need -map 0. And even with -map 0 & -copy_unknown, it can still screw up some streams it doesn't recognize, i.e. telemetry recorded by GoPros.
-
Joao Coelho over 2 yearsThis wasn't working for me, but found this page with a similar solution that worked:
ffmpeg -i input.mp4 -map_metadata 0 -metadata:s:v rotate="90" -codec copy output.mp4