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

后端 未结 10 1797
名媛妹妹
名媛妹妹 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 02:55

    What you can also do is remove the QuickTime specific metadata when rotate the .mov. This will make sure that the video is rotated the same way in VLC and QuickTime

    ffmpeg -i in.mov -vf "transpose=1" -metadata:s:v:0 rotate=0 out.mov
    

    Here's the documentation on the -metadata option (from http://ffmpeg.org/ffmpeg.html):

    -metadata[:metadata_specifier] key=value (output,per-metadata)
    

    Set a metadata key/value pair.

    An optional metadata_specifier may be given to set metadata on streams or chapters. See -map_metadata documentation for details.

    This option overrides metadata set with -map_metadata. It is also possible to delete metadata by using an empty value.

    For example, for setting the title in the output file:

     ffmpeg -i in.avi -metadata title="my title" out.flv 
    

    To set the language of the first audio stream:

     ffmpeg -i INPUT -metadata:s:a:1 language=eng OUTPUT
    

提交回复
热议问题