10
exerceo
158d

I am sick of misrotated videos.

Sometimes, the phone camera software saves a video vertically because the user hits "record" before the software has detected that the user is holding the smartphone horizontally, because the software stupidly launches in vertical orientation by default.

So the software wants the user to wait until it has finally detected horizontal orientation, which causes the user to miss out on a moment.

How about the camera software actually saves the video in the orientation it was recorded in for the most time, rather than only the beginning of the video?

If I can think of this idea, billion-dollar companies surely can.

In the meantime, misrotated videos can be fixed using this ffmpeg command on Linux or Windows:

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

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

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.

Comments
  • 1
    it's also not like the camera sensor configuration changes aswell. Best you can do is to just disable screen rotation entirely.
  • 7
    @thebiochemic With disabled orientation, the default is vertical. The camera software has its internal rotation system too.

    If poorly implemented, the system rotation and the camera software internal rotation interfere with each other. This happened in the Galaxy S6 to S8 era (2015-2017).
  • 8
    I remember someone here suggesting to add this to the camera UI:

    "You are holding your phone vertically. Rotate it, you idiot!"

    😄
  • 3
    @Lensflare Whoever suggested it, that is a nice idea!

    The problem is that a camera application might save the video vertically even if the phone was held horizontally since the beginning.

    Detecting the rotation duration would fix it, regardless of how the phone was held in the beginning of the recording.
  • 2
    @exerceo You can change resolutions mid-stream for most containers, you could just... flip the video in real-time based on gyro sensors? It'll look weird on desktops, but it would probably work. I know VLC will also honor EXIF data and rotate the video as needed, so that may also be of use.
  • 2
    Or, a message saying "you filmed most of your video vertically, want us to make it that way for the whole video? Yes / No, thanks / No, don't remind me again", and let the user decide.
  • 1
    @c3r38r170 that sounds like the best idea!
  • 4
    @c3r38r170 If it can change the metadata of the video without having to rewrite the entire video file to storage, then sure.

    If it has to rewrite the entire video file, it temporarily needs as much free space as the video file is in size, and needlessly wears down the flash storage chip. For a quarter-hour 2160p 4K video, that's several gigabytes already.
  • 1
    @c3r38r170 I think they realized most smartphone users will not even understand what that message means and press Yes by default
  • 1
    @gitstashio Then do it by default when it's >90% 😈
Add Comment