anandnet / flutter_video_info

A flutter plugin to get basic metadatainfo of a video file.
https://pub.dev/packages/flutter_video_info
MIT License
9 stars 25 forks source link

It always returning bigger value as width and smaller value as height. #11

Closed shofizone closed 3 years ago

shofizone commented 3 years ago

It always giving bigger value as width and smaller value as height. eg. I have a video with the resolution of 1080 x 1920 (width x height). But this plugin giving me 1920 x 1080 (width x height). In this case width and height got swapped. Or is there any other way to get correct height and width, pleas let me know. (Tested on Android 8.1 & Flutter 2.0.1)

anandnet commented 3 years ago

@shofizone Sorry, for long delay in reply, This plugin uses Native Android's class MediaMetadataRetriever to extract the height and width of the video. I also tested what you are saying and got the same. So, I googled and found this. https://stackoverflow.com/questions/45879813/android-mediametadataretriever-wrong-video-height-and-width

According to this solution you need to check orientation also.
if video orientation is 90 or 270 need to swap the value of height and width.

I hope, this will be helpful and solve your problem. for now, I am closing this. thanks.