做項(xiàng)目是需要獲取視頻信息的寬高尸变,在iPhone上使用原相機(jī)錄得橫豎屏視頻岸霹,app相冊選擇視頻棺滞,通過ffmpeg獲取到的寬高始終都是1280*720拄显,下面是詳細(xì)信息
原相機(jī)豎屏
flutter: {refs: 1, avg_frame_rate: 60600/2021, codec_tag_string: avc1, level: 31, side_data_list: [{displaymatrix:
flutter: 00000000: 0 65536 0
flutter: 00000001: -65536 0 0
flutter: 00000002: 47185920 0 1073741824
flutter: , rotation: -90, side_data_type: Display Matrix}], color_space: bt709, profile: 100, bit_rate: 2809828, duration: 3.368333, codec_type: video, coded_width: 1280, index: 1, pix_fmt: yuv420p, codec_tag: 0x31637661, codec_long_name: unknown, codec_name: h264, nal_length_size: 4, nb_frames: 101, height: 720, color_primaries: bt709, color_range: tv, disposition: {timed_thumbnails: 0, default: 1, original: 0, attached_pic: 0, comment: 0, forced: 0, karaoke: 0, dub: 0, visual_impaired: 0, hearing_impaired: 0, lyrics: 0, clean_effects: 0}, is_avc: true, chroma_location: left, tags: {language: und, encoder: H.264, creation_time: 2021-03-23T02:14:55.000000Z, rotate: 90, handler_name: Core Media Video}, color_transfer: bt709, r_frame_rate: 30000/1001, start_time: 0.000000, has_b_frames: 1, coded_height: 720, bits_per_raw_sample: 8, time_base: 1/600, duration_ts: 2021, codec_time_base: 2021/121200, width: 1280, start_pts: 0}
app 豎屏
{refs: 1, avg_frame_rate: 9800/327, codec_tag_string: avc1, level: 31, color_space: smpte170m, profile: 100, bit_rate: 6628824, duration: 1.621667, codec_type: video, coded_width: 720, index: 1, pix_fmt: yuvj420p, codec_tag: 0x31637661, codec_long_name: unknown, codec_name: h264, nal_length_size: 4, nb_frames: 49, height: 1280, color_primaries: bt709, color_range: pc, disposition: {timed_thumbnails: 0, default: 1, original: 0, attached_pic: 0, comment: 0, forced: 0, karaoke: 0, dub: 0, visual_impaired: 0, hearing_impaired: 0, lyrics: 0, clean_effects: 0}, is_avc: true, chroma_location: left, tags: {language: und, creation_time: 2021-03-23T02:15:54.000000Z, encoder: H.264, handler_name: Core Media Video}, color_transfer: bt709, r_frame_rate: 30000/1001, start_time: 0.000000, has_b_frames: 1, coded_height: 1280, bits_per_raw_sample: 8, time_base: 1/600, duration_ts: 973, codec_time_base: 327/19600, width: 720, start_pts: 0}
原相機(jī)橫屏
{refs: 1, avg_frame_rate: 11000/367, codec_tag_string: avc1, level: 31, color_space: bt709, profile: 100, bit_rate: 2580878, duration: 3.670000, codec_type: video, coded_width: 1280, index: 1, pix_fmt: yuv420p, codec_tag: 0x31637661, codec_long_name: unknown, codec_name: h264, nal_length_size: 4, nb_frames: 110, height: 720, color_primaries: bt709, color_range: tv, disposition: {timed_thumbnails: 0, default: 1, original: 0, attached_pic: 0, comment: 0, forced: 0, karaoke: 0, dub: 0, visual_impaired: 0, hearing_impaired: 0, lyrics: 0, clean_effects: 0}, is_avc: true, chroma_location: left, tags: {language: und, creation_time: 2021-03-23T02:16:25.000000Z, encoder: H.264, handler_name: Core Media Video}, color_transfer: bt709, r_frame_rate: 30000/1001, start_time: 0.000000, has_b_frames: 1, coded_height: 720, bits_per_raw_sample: 8, time_base: 1/600, duration_ts: 2202, codec_time_base: 367/22000, width: 1280, start_pts: 0}
app 橫屏
{refs: 1, avg_frame_rate: 34200/1141, codec_tag_string: avc1, level: 31, color_space: smpte170m, profile: 100, bit_rate: 6722923, duration: 1.901667, codec_type: video, coded_width: 720, index: 1, pix_fmt: yuvj420p, codec_tag: 0x31637661, codec_long_name: unknown, codec_name: h264, nal_length_size: 4, nb_frames: 57, height: 1280, color_primaries: bt709, color_range: pc, disposition: {timed_thumbnails: 0, default: 1, original: 0, attached_pic: 0, comment: 0, forced: 0, karaoke: 0, dub: 0, visual_impaired: 0, hearing_impaired: 0, lyrics: 0, clean_effects: 0}, is_avc: true, chroma_location: left, tags: {language: und, creation_time: 2021-03-23T02:16:56.000000Z, encoder: H.264, handler_name: Core Media Video}, color_transfer: bt709, r_frame_rate: 30000/1001, start_time: 0.016667, has_b_frames: 1, coded_height: 1280, bits_per_raw_sample: 8, time_base: 1/600, duration_ts: 1141, codec_time_base: 1141/68400, width: 720, start_pts: 10}
安卓通過寬高去做橫豎屏播放就會出錯(cuò)苟径,改為先轉(zhuǎn)碼為MP4,在去獲取視頻的寬高躬审,得到正確的結(jié)果