video captured from iphone gets rotated when converted to .mp4 using ffmpeg

后端 未结 10 1824
名媛妹妹
名媛妹妹 2020-12-01 02:31

When I try to upload videos captured from my iPhone in my app, the server performs a conversion from .mov to .mp4 so that it can be played in other platforms. However the pr

10条回答
  •  刺人心
    刺人心 (楼主)
    2020-12-01 03:07

    FFMPEG changed the default behavior to auto rotate video sources with rotation metadata in 2015. This was released as v2.7.

    If your ffmpeg version is v2.7 or newer, but your rotation metadata isn't respected, the problem is likely that you are using custom rotation based on metadata. This will cause the same logic to be applied twice, changing or cancelling out the rotation.

    In addition to removing your custom rotation (recommended), there's an option to turn off auto rotation with -noautorotate.

    ffmpeg -noautorotate -i input.mp4...

    This will also work in some older releases.

提交回复
热议问题