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:

ffmpeg -i input.mp4 -c:a copy output.mp4

However, if the rotate metadata is wrong you can simply remove or change it without needing to re-encode:

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

Alternatively, you could change it such as -metadata:s:v rotate="180".

  • 1
    The last one rotate="180" worked for me. Thanks. – Würgspaß Sep 8 '18 at 10:50
  • Thank you for explaining specifics of videos from phones! – HEKTO Jan 20 '20 at 0:07

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.