What determines video orientation (landscape or portrait) during playback?
If the video is meant to be played in a different orientation than its stored representation, then a rotation flag is set in the stream metadata. A compliant player uses that tag and rotates the video during playback.

A tool like Mediainfo will display that data (if specified) like here:



A tool like ffmpeg can reset the tag. Of course, you'll also want to rotate the video stream as currently stored so it plays in the correct orientation after the tag has been reset. ffmpeg's transpose filter can do that.