我们系统中用户上传到视频多数是客户用手机拍摄的,现在存在一个问题,就是PC浏览器上播放的时候,这个视频是横着的。
大家明白我的意思吗? 实际事物是: 1,但是视频看起来就是: 一 。
现在我想把视频变成是跟实际事物一直的状态。
七牛返回的视频元信息中有rotate:90这样的参数,还有高度和宽度。
我的想法:
1、判断高度和宽度,全部转为高>宽
2、我对rotate这个参数不太理解,这个能代表实际和视频的角度差吗? (百度上出来的全部是imagerotate(),没有视频方面的。ffmpeg也没有提到这个,只是说了一些截图之类的问题。)
考虑到有些视频就是手机横着拍摄的,强制转了不是又出现了偏差?
求助有什么办法可以解决这个问题
我提供一个视频的元信息,大家帮我看看咯,谢谢
streams[1].tags.rotate "rotate": "90",
{
"streams": [
{
"index": 0,
"codec_name": "aac",
"codec_long_name": "AAC (Advanced Audio Coding)",
"profile": "LC",
"codec_type": "audio",
"codec_time_base": "1/44100",
"codec_tag_string": "mp4a",
"codec_tag": "0x6134706d",
"sample_fmt": "fltp",
"sample_rate": "44100",
"channels": 1,
"channel_layout": "mono",
"bits_per_sample": 0,
"r_frame_rate": "0/0",
"avg_frame_rate": "0/0",
"time_base": "1/44100",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 2408448,
"duration": "54.613333",
"bit_rate": "89406",
"nb_frames": "2352",
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0
},
"tags": {
"creation_time": "2015-11-08 14:36:49",
"language": "und",
"handler_name": "Core Media Audio"
}
},
{
"index": 1,
"codec_name": "h264",
"codec_long_name": "H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10",
"profile": "Main",
"codec_type": "video",
"codec_time_base": "1/1200",
"codec_tag_string": "avc1",
"codec_tag": "0x31637661",
"width": 480,
"height": 272,
"has_b_frames": 0,
"sample_aspect_ratio": "0:1",
"display_aspect_ratio": "0:1",
"pix_fmt": "yuv420p",
"level": 21,
"color_range": "tv",
"color_space": "bt709",
"color_transfer": "bt709",
"color_primaries": "bt709",
"chroma_location": "left",
"is_avc": "1",
"nal_length_size": "4",
"r_frame_rate": "30000/1001",
"avg_frame_rate": "490800/16369",
"time_base": "1/600",
"start_pts": 0,
"start_time": "0.000000",
"duration_ts": 32738,
"duration": "54.563333",
"bit_rate": "710127",
"bits_per_raw_sample": "8",
"nb_frames": "1636",
"disposition": {
"default": 1,
"dub": 0,
"original": 0,
"comment": 0,
"lyrics": 0,
"karaoke": 0,
"forced": 0,
"hearing_impaired": 0,
"visual_impaired": 0,
"clean_effects": 0,
"attached_pic": 0
},
"tags": {
"rotate": "90",
"creation_time": "2015-11-08 14:36:49",
"language": "und",
"handler_name": "Core Media Video"
}
}
],
"format": {
"nb_streams": 2,
"nb_programs": 0,
"format_name": "mov,mp4,m4a,3gp,3g2,mj2",
"format_long_name": "QuickTime / MOV",
"start_time": "0.000000",
"duration": "54.563333",
"size": "5488167",
"bit_rate": "804667",
"probe_score": 100,
"tags": {
"major_brand": "mp42",
"minor_version": "1",
"compatible_brands": "mp41mp42isom",
"creation_time": "2015-11-08 14:36:49"
}
}
}
你需要使用七牛的转码方式将 rotate 参数为 0
文档视频转码