solution for the misrotated video problem

Search This thread

Hendrix7

New member
Nov 18, 2023
1
0
On many smartphones, the camera software is launched in vertical orientation. If you hit the "record" button too soon after launching while holding horizontally or too soon after physically rotating horizontally, it might end up saving the video as vertical video, even if the user filmed horizontally for most of the time.

This post goes out to the developers of camera software, especially at major smartphone vendors.

this insanity needs to stop - a proposal to eliminate the problem of misrotated videos.png


The camera software should disregard the rotation of the device at the point of when the recording was started. Instead, the orientation in which the user recorded for the longest time should be regarded for the resulting video file.

For example, if the user recorded vertically for the first second of a two-minute video but recorded the other 1 minute and 58 seconds horizontally, should the video be saved as a horizontal misrotated vertical video?

(Note: Vertical video should be avoided altogether. Perhaps users should receive a notification instructing to record horizontally, but that's out of scope for this post.)

Here is what it looks like:

resulting output file horizontal.png


If someone insignificant like myself can think of this idea, billion-dollar companies surely can.



In the meantime, one way to fix misrotated videos is using this ffmpeg command on Linux or Windows:

Code:
ffmpeg -i input_file.mp4 -metadata:s:v rotate="" -c copy output_file.mp4

And if the phone was held with the home button to the left side:

Code:
ffmpeg -i input_file.mp4 -metadata:s:v rotate="180" -c copy output_file.mp4

This solution is superior compared to using -vf (video filters) because it only touches the metadata of the video. No re-encoding. This means no quality loss and no CPU/GPU power needed to process the video again. It just passes through.