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

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.

Leave a Comment