Can I set rotation field for a video stream with FFmpeg?

两盒软妹~` 提交于 2019-11-28 03:34:57
slhck

This works with recent FFmpeg:

ffmpeg -i input.mp4 -c copy -metadata:s:v:0 rotate=90 output.mp4

This will stream copy the bitstreams, so no encoding is performed. Only the metadata of the first video stream (v:0) is changed here and the player will show the video in a rotated way. (Not all players will support this.)

Additional notes:

  • If you want to "physically" rotate the video, you have to use the transpose filter. Filtering will require re-encoding, so you will have to remove -c copy.

  • If you omit -c copy, and want to encode instead of only re-muxing, then ffmpeg will automatically rotate the video if there is any existing rotate metadata. You can disable this behavior with -noautorotate.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!