Search code examples
androidcameraresolutiontabletpreview

Record at 720p on Lenovo Tab4 8


I have a running video app that is solidly recording videos in 1280x720 for many android tablets running 7.0 and higher except for the Lenovo Tab4 8.

Using the Camera2 API I setup the capturing by querying the supported preview sizes. The Lenovo Tab4 8 suprisingly only returns these Preview Sizes:

1040x780, 864x480, 640x640, 800x480, 720x480, 768x432, 640x480, 480x640, 576x432, 640x360, 480x360, 480x320, 384x288, 352x288, 320x240, 240x320, 240x160, 176x144, 144x176, 160x120

But the built in camera supports 1280x720 even 1920x1080. Simply trying to set the resolution or the preview size to 1280x720 ends up with an error. android.hardware.camera2.CameraAccessException: CAMERA_ERROR (3): submitRequestList - must configure device with valid surfaces before submitting requests

How come other camera apps can handle it? I downloaded "Open Camera" from the playstore. It has the option to capture at 1280x720 (but not 1040x780?!).


Solution

  • I have found out whats causing this. This Lenovo tablet has a "legacy camera", meaning the Camera was created to serve the Camera API but not the Camera2 API.

    Camera2 API in this case is just a wrapper of the Camera API but it cannot expose every functionality and is therefore missing support for certain resolutions.

    With the following calls I can now find out, whether my device inhabits a legacy camera:

    Xamarin.Android:

    CameraCharacteristics characteristics = camManager.GetCameraCharacteristics(cameraId);
    var hardwareLevel = characteristics.Get(CameraCharacteristics.InfoSupportedHardwareLevel);
    
    //hardwareLevel.ToString() would spit out one of the following numbers:
    //LEGACY - 2 -> Legacy Cameras might not support 1280x720 resolution
    //LIMITED - 0
    //FULL - 1
    //LEVEL_3 - 3