There are three questions to how to output a camera video stream to a specified surface, the first scenario is that it doesn't match the original aspect ratio but the resolution is in the output list, the second scenario is that it matches the original aspect ratio but the resolution isn't in the output resolution list, and the third scenario is that it neither matches the aspect ratio nor is it in the output resolution list anymore.
Assuming that my camera's Raw/Active sensor has an Aspect of 4:3, and it has 1920x1080 in the list of output resolutions, how do I request a 1920x1080 surface output?
Assuming that my camera's Raw/Active sensor's Aspect is 4:3 and its output resolution list does not contain 1920x1440, how do I request a 1920x1440 surface output?
Assuming that my camera's Raw/Active sensor's Aspect is 4:3, and its list of output resolutions does not include 1440x900, how do I request a 1440x900 surface output?
I mean, how to construct the CaptureRequest, like whether it is required or not, and how to set CaptureRequest.SCALER_CROP_REGION. Is the crop region related to the raw sensor size? Assuming I've set my Surface to the required size (it comes from the right target size surfaceTexture)
Assuming that my camera's Raw/Active sensor has an Aspect of 4:3, and it has 1920x1080 in the list of output resolutions, how do I request a 1920x1080 surface output?
If 1920x1080 is a supported size, you can simply configure the Surface to be 1920x1080. The camera will output a 16:9 crop of the 4:3 full sensor.
How to configure the Surface depends on where you're getting it from - SurfaceTexture.setDefaultBufferSize()
, MediaRecoder.setVideoSize()
, and so on.
Assuming that my camera's Raw/Active sensor's Aspect is 4:3 and its output resolution list does not contain 1920x1440, how do I request a 1920x1440 surface output?
You cannot, directly from the camera. Only the listed sizes are supported; if you need to rescale an output, you'd need to do that on a GPU or a CPU resize pass yourself.
Assuming that my camera's Raw/Active sensor's Aspect is 4:3, and its list of output resolutions does not include 1440x900, how do I request a 1440x900 surface output?
As above, if it's not in the supported list, the camera will not produce that size.