美文网首页
flutter ffmpeg 获取mov视频信息问题

flutter ffmpeg 获取mov视频信息问题

作者: _风雨 | 来源:发表于2021-03-23 11:04 被阅读0次

做项目是需要获取视频信息的宽高,在iPhone上使用原相机录得横竖屏视频,app相册选择视频,通过ffmpeg获取到的宽高始终都是1280*720,下面是详细信息

原相机竖屏
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}

原相机横屏
{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}

安卓通过宽高去做横竖屏播放就会出错,改为先转码为MP4,在去获取视频的宽高,得到正确的结果

相关文章

网友评论

      本文标题:flutter ffmpeg 获取mov视频信息问题

      本文链接:https://www.haomeiwen.com/subject/pnzxhltx.html