0

Is there any way to get the MediaCodec video encoding supported resolutions under Jelly Bean MR2?

For lollipop we can use the new getVideoCapabilities() method to find out all the supported video resolutions. But for lower API levels couldn't find a way in the MediaCodec API.

I'm aware of the CamcorderProfile class available since API 8 which can give some hints of what the hardware might support, but to use the camcorder profiles to resolve the encoder video resolutions seems to be a guess game without consistency which could fail easily on many devices.

PerracoLabs
  • 16,449
  • 15
  • 74
  • 127

1 Answers1

0

If it's listed in the CDD then you can assume it. If not, you have to try and see if it works.

The screenrecord tool uses a retry-on-error scheme to deal with cases where the video encoder can't record at the display resolution, because there was no way to query for it back then.

Community
  • 1
  • 1
fadden
  • 51,356
  • 5
  • 116
  • 166
  • screenrecord , Where is this the source code? I need it very much! I use mediacodec to record video but the video color is not right on some devices. – dragonfly Sep 25 '15 at 15:33
  • I don't think it will be all that useful, but it's here: https://android.googlesource.com/platform/frameworks/av/+/lollipop-mr1-release/cmds/screenrecord/ – fadden Sep 25 '15 at 15:53
  • I have fix the video color issue, I changed the video encoding size to 720*1280(previous size:320*568), the color turned right. But I wonder that Do all phones above api-level 18 have the camera preview size 1280*720 or above? – dragonfly Sep 26 '15 at 03:43
  • "try and see if it works" ? Isn't there any way to find which resolutions are supported? – android developer Mar 16 '22 at 18:39