MP4 and MOV files can carry a display matrix that tells players which way up to show the picture. Changing it rewrites a few bytes in the file’s header and copies the video stream untouched, so it takes seconds and costs nothing in quality.
ffmpeg -display_rotation:v:0 -90 -i input.mp4 -c copy output.mp4
-display_rotation is an input option, so it goes before -i, and it counts anticlockwise: -90 shows the video turned 90° clockwise, 90 turns it anticlockwise and 180 turns it upside down. It replaces any rotation already in the file rather than adding to it, so for a phone clip that already carries a flag, give the final orientation you want; 0 clears the flag.
The option arrived in FFmpeg 6. On current builds the older -metadata:s:v:0 rotate=90 trick only writes a text tag that players ignore, which we confirmed on 7.1. There is also -display_hflip to flag a mirror image, but fewer players honour it, so use hflip for anything you’re going to share.
Browsers, VLC, QuickTime and phone galleries all respect the flag. Some older TVs, hardware players and editing apps ignore it and show the stored orientation, so re-encode with transpose for those. Rotating without losing quality explains the trade-off in more detail.