Maximum playable video resolution on Android

白昼怎懂夜的黑 提交于 2019-12-02 00:50:00
Florian

Okay,

on Android Lollipop

you can use this,

MediaCodecInfo.VideoCapabilities.areSizeAndRateSupported(int width, int height, double frameRate)

which returns whether a given video size (width and height) and frameRate combination is supported.

On Android < Lollipop

you can just check which AVC codec levels are supported, so you could derive the maximum supported resolution, which unfortunately is not correct for most of the devices. For example, on the Nexus 5, Android will return AVC profile level 4 which would mean that you can playback 1920x1080 videos. However, the Nexus 5 is capable of playing higher resolution videos already, so it is not reliable.

Only workaround on Android < 5 so far: Try to play the video and check for any errors. That's what HTC or other devices do as well. As a result it can happen that on some devices you will get about 1 frame each 2 seconds or so.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!