After reading about how to convert a video by 90 degrees
I tried these commands:
mencoder old.mp4 -oac lavc -ovc x264 vcodec=mpeg4 -vf flip,mirror -o new.mp4
mencoder old.mp4 -oac lavc -ovc x264 vcodec=mpeg4 -vf rotate=2 -o new.mp4
ffmpeg -i old.mp4 -vf "hflip" -strict -2 new.mp4
but the converted video is still upside down.
Running the video with
mplayer -vf flip,mirror old.mp4
renders it as desired. But anyway, I'd like to convert it.
I'm using
ffmpeg version 2.8.15-0ubuntu0.16.04.1
and
MEncoder 1.2.1 (Debian), built with gcc-5.3.1
Videos from phones often have metadata that tell the player to rotate upon playback (not all players respect this). When re-encoding,
ffmpeg
will automatically rotate the video according to the rotate metadata, so you don't have to do anything special:However, if the rotate metadata is wrong you can simply remove or change it without needing to re-encode:
Alternatively, you could change it such as
-metadata:s:v rotate="180"
.I found the following command line code worked with Ubuntu 20.04LTS using ffmpeg:
It only changes the metadata with no loss in quality.