Try to use QuickLook instead QuickTime Player to rotate movies: select the movie in Finder, hit the space bar and at the top use the 90° CCW icon. Also Right-click > Quick Actions > Rotate Left does the same.
Cameras always take images and movies in landscape mode and the image data is rotated by software when needed. But some apps might improperly read rotation tags so some app displays it as portrait and another app as landscape and the same app might use a different rotation for the preview which is even more confusing.
In QuickTime movies (.mov, .mp4, .m4v) Rotation is derived from the rotation angle of the MatrixStructure, which the arctangent of the first 2 elements in the unit matrix.
https://exiftool.org/forum/index.php?topic=16306.msg87688#msg87688
https://exiftool.org/forum/index.php?topic=15240.msg82077#msg82077
For example iPhone 13 Pro portrait movie:
exiftool -a -G1 -s -ImageWidth -ImageHeight -MatrixStructure -Rotation movie.mov
[Track1] ImageWidth : 3840
[Track1] ImageHeight : 2160
[Track1] MatrixStructure : 0 1 0 -1 0 0 2160 0 1
[Composite] Rotation : 90
I use QuickLook to rotate movies because it is lossless while QuickTime Player does some rotations lossy which is much slower. So the previous movie rotated in QuickLook 90° CCW to landscape is:
exiftool -a -G1 -s -ImageWidth -ImageHeight -MatrixStructure -Rotation movie.mov
[Track1] ImageWidth : 3840
[Track1] ImageHeight : 2160
[Track1] MatrixStructure : 1 0 0 0 1 0 0 0 1
[Composite] Rotation : 0
And back to original portrait mode 270° CCW:
exiftool -a -G1 -s -ImageWidth -ImageHeight -MatrixStructure -Rotation movie.mov
[Track1] ImageWidth : 3840
[Track1] ImageHeight : 2160
[Track1] MatrixStructure : 0 1 0 -1 0 0 2160 0 1
[Composite] Rotation : 90
On the other hand, QuickTime Player sometimes re-encodes the rotated movie which takes time and might very well be lossy. Some rotations are fast but, for example 180° CCW rotation does not just update the rotation metadata tags but rotates the whole movie so 3840x2160 is saved as 2160x3840 instead:
exiftool -a -G1 -s -ImageWidth -ImageHeight -MatrixStructure -Rotation qt_player_180°ccw.mov
[Track2] ImageWidth : 2160
[Track2] ImageHeight : 3840
[Track1] MatrixStructure : 1 0 0 0 1 0 0 0 1
[Composite] Rotation : 0
...
p.s the new iOS 18 .heic images have some new features (so High Sierra no longer supports them).
In images rotation metadata tags QuickTime:Rotation and EXIF:Orientation have changed somewhat in newer iOS 18 .heic. For example, portrait .heic rotated in the iPhone 16 Pro introduced a new sort of duplicate QuickTime:Rotation tag that old software might not handle properly.
Even in macOS Sequoia 15.7.1 QuickLook or Quick Actions > Rotate Left are still very flaky when rotating such new iPhone 16 Pro .heic so the edited orientation very often fails to really stick. In older .heic and .jpg and movies they work OK.
On the other hand, Preview.app and apps like GraphicConverter rotate also the new .heic flavor by rotating the image data itself so ImageWidth and ImageHeight change places after 90° rotations and Rotation & Orientation metadata is then always set to Horizontal (normal) no matter what the rotation might be visually.
For example iPhone 16 Pro portrait .heic image:
exiftool -a -G1 -s -ImageWidth -ImageHeight -MatrixStructure -Rotation image.heic
[File] ImageWidth : 5712
[File] ImageHeight : 4284
[QuickTime] Rotation : Rotate 90 CW
[QuickTime] Rotation : Horizontal (normal)
...rotated 90° CCW in QuickLook:
exiftool -a -G1 -s -ImageWidth -ImageHeight -MatrixStructure -Rotation image.heic
[File] ImageWidth : 5712
[File] ImageHeight : 4284
[QuickTime] Rotation : Horizontal (normal)
...but in Sequoia rotating that 270° back to original portrait often/always fails to stick because QuickLook has failed to update rotation metadata tags. A workaround is to rotate 90° CW with Preview.app or GraphicConverter which rotate the whole image:
exiftool -a -G1 -s -ImageWidth -ImageHeight -MatrixStructure -Rotation image_preview_90°cw.heic
[File] ImageWidth : 4284
[File] ImageHeight : 5712
[QuickTime] Rotation : Horizontal (normal)
https://exiftool.org/forum/index.php?topic=17169.msg91974#msg91974