Mp4Composer-android icon indicating copy to clipboard operation
Mp4Composer-android copied to clipboard

how can i select output size?

Open happyHou opened this issue 3 years ago • 2 comments

thanks author,you are great. when i user size() function set exact value,this lib not working.so how can i select output size?

happyHou avatar Dec 19 '20 15:12 happyHou

i found /etc/media_codecs.xml record current device support size。

happyHou avatar Dec 19 '20 15:12 happyHou

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());
                }
            }
        }

happyHou avatar Dec 19 '20 17:12 happyHou