There are two ways to "rotate" a video. You can re-encode with the transpose filter, which actually rewrites the pixels, or you can flip an orientation flag in the metadata, which is instant and lossless but relies on the player honoring it. Both have their place.
Key takeaways
transpose=1rotates 90° clockwise;2is 90° counter-clockwise.- Rotate 180° by chaining two transposes or using
hflip,vflip. hflipmirrors horizontally;vflipvertically.- A metadata
rotatetag rotates losslessly, but support varies by player.
Rotate 90° (clockwise / counter-clockwise)
# 90° clockwise ffmpeg -i in.mp4 -vf "transpose=1" -c:a copy out.mp4 # 90° counter-clockwise ffmpeg -i in.mp4 -vf "transpose=2" -c:a copy out.mp4
The values: 0 = 90° CCW + vertical flip, 1 = 90° CW, 2 = 90° CCW, 3 = 90° CW + vertical flip.
Rotate 180°
ffmpeg -i in.mp4 -vf "transpose=2,transpose=2" -c:a copy out.mp4 # equivalent, often faster: ffmpeg -i in.mp4 -vf "hflip,vflip" -c:a copy out.mp4
Mirror (flip) a video
# horizontal mirror (selfie-style) ffmpeg -i in.mp4 -vf "hflip" -c:a copy out.mp4 # vertical flip (upside down) ffmpeg -i in.mp4 -vf "vflip" -c:a copy out.mp4
Fix sideways phone video losslessly
Phones often record sideways and set a rotation flag. To re-tag without re-encoding the pixels — instant and lossless — set the orientation metadata instead:
ffmpeg -i in.mp4 -metadata:s:v rotate=90 -c copy out.mp4
If a player ignores the flag, fall back to a real transpose re-encode above.
Rotate visually instead
FFmpegLab rotates and flips with a click and writes the matching transpose/hflip command, so you can fix orientation without remembering filter values — running fully offline. Then compress or convert for delivery.