Rotate 90 degrees with transpose=1
Rotate video 90 degrees clockwise in FFmpeg 7.1 with transpose=1, and use 2 for counter-clockwise or two filters for a half turn.
transpose rotates by 90 degrees and swaps the width and height. The value picks the direction.
ffmpeg -i landscape.mp4 -vf "transpose=1" -c:v libx264 -crf 22 -c:a copy portrait.mp4
ffprobe -v error -select_streams v:0 -show_entries stream=width,height -of csv=p=0 portrait.mp41080,1920Value 1 is 90 degrees clockwise, and 2 is 90 degrees counter-clockwise. The other two, 0 and 3, rotate and also flip vertically. For 180 degrees, chain it twice as transpose=1,transpose=1, or use hflip,vflip, which avoids a size swap. The full list is in the transpose filter documentation.
The filter decodes and re-encodes the picture, so it costs quality and time, unlike the rotation metadata in the display rotation row. FFmpeg also applies a phone's rotation flag by itself while transcoding, so check whether the source carries one first: transposing a file that is already flagged can give you the wrong result twice over. For an arbitrary angle there is the rotate filter.