Open happyHou opened 3 years ago
i found /etc/media_codecs.xml record current device support size。
we can first check size value!!
for (MediaCodecInfo codecInfo : new MediaCodecList(MediaCodecList.ALL_CODECS).getCodecInfos()) {
if (!codecInfo.isEncoder())
continue;
String[] types = codecInfo.getSupportedTypes();
for (int j = 0; j < types.length; j++) {
if ("video/avc".equalsIgnoreCase(types[j])) {
MediaCodecInfo.CodecCapabilities codecCaps = codecInfo.getCapabilitiesForType("video/avc");
MediaCodecInfo.VideoCapabilities vidCaps = codecCaps.getVideoCapabilities();
Range<Integer> framerates = vidCaps.getSupportedFrameRates();
Range<Integer> widths = vidCaps.getSupportedWidths();
Range<Integer> heights = vidCaps.getSupportedHeights();
Log.d("H.264Encoder", "Found encoder with\n" + widths.toString()
+ " x " + heights.toString() + " @ " + framerates.toString() + " fps aligned to " + vidCaps.getWidthAlignment());
}
}
}
thanks author,you are great. when i user size() function set exact value,this lib not working.so how can i select output size?