Rotate or flip a video
A video shot with the phone held the wrong way shows up sideways or upside down. ffmpeg can rotate it a quarter turn, a half turn, or flip it as a mirror image.
Updated on
The lower the number, the better the picture and the larger the file.
How to use it
- Install ffmpeg if you haven't already.
- Open a terminal in the folder containing your file.
- Copy the generated command, adjust the file names if needed, then run it.
- Open the resulting file to check the result.
The filters used
The transpose filter rotates the picture a quarter turn: 1 clockwise, 2 counterclockwise. Two quarter turns make a half turn. The hflip and vflip filters flip the picture as a mirror image, horizontally or vertically, for example to fix a front-camera video.
Rotate, or convert to vertical?
For a horizontal video meant for TikTok or Reels, converting to 9:16 is often a better fit than rotating.
Convert a video to vertical 9:16 format
Frequently asked questions
The video rotates twice or stays sideways. Why?
Phones often store the orientation in a metadata tag, which ffmpeg applies automatically during playback. If the result is oriented wrong, try the other rotation direction: the command corrects what you see in your player.
Can I rotate without re-encoding?
Yes, by changing only the orientation metadata (the -display_rotation option in ffmpeg 6 and later), but not all players respect it. The re-encoding offered here gives a result that plays everywhere.
Is the audio changed?
No: it's copied as is, and only the picture is transformed.