Friday, November 17, 2017

How to rotate a video without re-encoding

Summary: A few tips on video rotation.
If your phone messes up the rotation metadata flag in a video file, download ffmpeg and run the following command:
ffmpeg -i input.mp4 -c copy -metadata:s:v:0 rotate=0 output.mp4
This should fix the problem without re-encoding the video. If it does not, try setting the rotate switch to a different number, such as 90, 180, or 270. For additional information about video orientation MP4 and other video files, check the See also section.

See also:
iPhone recorded videos getting rotated on Windows systems
Rotate a MP4 file, while preserving codec and quality attributes
Rotate mp4 videos without re-encoding
Rotating videos with FFmpeg
How to rotate a video 180° with FFmpeg?

2 comments:

Unknown said...

I was trying in vane for more than an hour with OpenShot, Avidemux, VLC until I came across your blog. With this ffmpeg command I succeeded at once.
I didn't think, that the solution could be so easy.

With many thanks,
Friedhelm

Alek Davis said...

Sweet.