Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to get supported video camera resolutions in android?

I am writing an app where I am allowing the user to capture video using the phones camera. I am using my own code to record the video as opposed to Androids built in camera app.

Everything is working OK except I need to be able to access the list of supported camera resolutions so I can choose at runtime which one to use. I am looking for something like getSupportedPictureSizes() but for video. Android 3.0 has this functionality but I am looking for something for 2.2.

As of right now I am using CamcorderProfile.QUALITY_HIGH / QUALITY_LOW, but this only gives me two options and on the phones I have been testing on, the file sizes are at each extreme.(QUALITY_LOW is 216 kb/s and QUALITY_HIGH is > 3 MB/s)

Any help would be greatly appreciated, Thank You!

like image 760
jln646v Avatar asked May 09 '11 09:05

jln646v


1 Answers

Did you try to use the getSupportedVideoSizes() method from Camera.Parameters class?

public List<Camera.Size> getSupportedVideoSizes()

This method returns a list of Size objects. It will return null if the camera does not have separate preview and video output. The answer here indicates that when this returns null you may use the getSupportedPreviewSizes() list.

like image 159
alxscms Avatar answered Sep 21 '22 13:09

alxscms