Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

how can i select output size? #91

Open
happyHou opened this issue Dec 19, 2020 · 2 comments
Open

how can i select output size? #91

happyHou opened this issue Dec 19, 2020 · 2 comments

Comments

@happyHou
Copy link

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
Copy link
Author

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

@happyHou
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant