Android手机(以三星S7 Edge为例)竖屏时相机应用拍摄出来的MP4会有90度的旋转,对应了FFmpeg AVStream.metadata属性的rotate字段,其中displaymatrix: rotation of -90.00 degrees进一步表示这是逆时针旋转90度,对于顺时针为360-rotate(90) = 270,视频相关信息示例如下。
Input #0, mov,mp4,m4a,3gp,3g2,mj2, from '20170507_140002.mp4':
Metadata:
major_brand : mp42
minor_version : 0
compatible_brands: isommp42
creation_time : 2017-05-07T06:00:07.000000Z
com.android.version: 7.0
Duration: 00:00:03.87, start: 0.000000, bitrate: 17313 kb/s
Stream #0:0(eng): Video: h264 (High) (avc1 / 0x31637661), yuv420p(tv, bt709), 1920x1080, 17038 kb/s, SAR 1:1 DAR 16:9, 29.98 fps, 30 tbr, 90k tbn, 180k tbc (default)
Metadata:
rotate : 90
creation_time : 2017-05-07T06:00:07.000000Z
handler_name : VideoHandle
Side data:
displaymatrix: rotation of -90.00 degrees
Stream #0:1(eng): Audio: aac (LC) (mp4a / 0x6134706D), 48000 Hz, stereo, fltp, 256 kb/s (default)
Metadata:
creation_time : 2017-05-07T06:00:07.000000Z
handler_name : SoundHandle
QuickTime、VLC都会将视频旋转到正常的角度,而MPlayerX则不会,因此它播放时图像是横屏的。
网友评论