640x360(360p) Camera resolution - android

In my Android app, I would like to use 16:9 resolution for camera preview & transmit via WebRTC call
Wanted to go with 360p (640x360) since its common & it wont require high bitrate to transmit
I am using Camera2 API. As a best practice, I first identified the list of supported resolution on the device to check if 360p is supported or not. Once verified, I proceed to create cameraCapturesession
But this check is failing in some devices - Real Me 5 Pro, Redmi Note 7S, redmi note 7 (all running android versions >=9)
Though it seems to be a popular resolution, 360p is not available in the list of supported resolutions in these devices
List is fetched via cameraCharacteristics.get(CameraCharacteristics.SCALER_STREAM_CONFIGURATION_MAP).getOutputSizes(SurfaceTexture.class)
It was not available with getOutputSizes(ImageFormat.JPEG) as well
And When I force to create the cameraCaptureSession with 640*360 without verifying supported resolution, It actually worked - it was able to capture 640x360 resolution. Looks like device camera actually supported it, but not available in the list fetched from cameraCharacteristics.
I assume i cannot force this resolution without doing check - as it might not work in some device and will throw exception/crash
I thought of adding a fallback by choosing closest match for 360p - either 16:9 will have to be compromised or 1280x720 will have to be chosen - it ll require higher bitrate to transmit
I think 360p is a std resolution- Any possible reason why it is not listed as supported, but actually worked when forced?
As per my understanding of doc, SCALER_STREAM_CONFIGURATION_MAP should return exhaustive list of resolutions supported by hardware
Am I missing anything? Please suggest solution or workaround

16:9 at 640x360 is not really used much on modern mobile cameras, because it's such a low resolution. 720p is about the lowest size people want to record video at, so that gets reflected in the sizes supported.
However, 640x480 (4:3 VGA) is guaranteed to be supported, so the safe thing is to use that and crop if you want to get 16:9.
Assuming the size will work if it's not listed is very risky - it might, or might be stretched, or it might work but if you add some other output it might fall over. And all of this is going to be device-specific, so you just won't know ahead of time, and some new device may just fail. So I don't recommend it at all.

Related

Does Android support Full-View video recording with wide-angle lens at lower resolutions?

Assuming I have a new Android phone with a wide-angle back lens that can record with its native Camera App at Full-View mode (so we utilize the sensor as much as possible to not miss any visual information). Assume that the phone can even do that at 60FPS (I guess there are such phones but if not, please correct me).
The question is: Do you think that one could achieve the same footage (maybe using the NDK or CameraX) but at lower resolutions? I mean, keep the Full-View (because I do not want to crop the scene), but just lower proportionally the XY resolution. Is this something that is supported? Or are the settings offered by the native Apps the only possible options that a 3rd party developer can have?
If this can be achieved, how can one identify and use the Camera capabilities to set this up? (i.e. Full-View, Max FPS available for that Full-View and a resolution lower than 0.3MP shaped to that Full-View). Code example is more than welcome.

What are the criteria to select the appropriate resolution to build a 2D game?

I'd like to know, how can I select the best resolution to build a 2D game in android?
You can go with 1920*1080 - this will give you a clear output on most current devices - and use FitViewPort or ExtendViewPort as you wish.
I'm rendering my graphics in 2K resolution (i.e. in 3040 x 1,40 - aiming most popular high-end phones of today, i.e. Samsung S10) so it will definitely look well on screens with higher resolution. And then I'm using camera zoom to display it properly on current screen resolution. It does take a bit more space for graphics and it's probably loosing some frame per second but on today's devices it's acceptable loss. My games run smooth even on older devices, so I don't think it's an issue at all.

Capturing a photo from only one lens, in dual-camera phones?

Dual-camera smartphones are relatively new in the market, but I was wondering if a camera app could explicitly choose to use only one lens, or to manually retrieve separate input from each lens.
I couldn't find any Android API documentation that is specifically designed for dual-lens phones, so I guess this is a hardware/OS-level implementation that would be difficult to override or bypass.
Android's Camera HAL documentation page doesn't mention dual-lens devices as well, but it does seem to strengthen that assumption.
I don't have much experience with iOS, but I guess it wouldn't be easier.
So the question is - how, if at all, would such task be possible on either Android or iOS?
Edit: seems that in iOS it is possible, as explained here (thanks to the4kman for pointing this out in the comments). So I guess the question remains for Android only.
Different vendors provide dual cameras for their Android devices in hope to improve the photo quality for average user, more often than not, specifically tuned for special conditions like challenging illumination or distortions of selfie mode. Each vendor uses proprietary technologies to handle dual cameras, and they are not interested to disclose the implementation details. The only public interface they support is a virtual single camera which is more or less compliant with Google specs.
This does not mean that you cannot be lucky chance be able to unlock the camera for some specific device. Playing with photo modes, or scenes, or other parameters, may accidentally give you a picture that only passed one lens of the dual setup.
In some rare cases some documentation is actually present. E.g. HTC let you control stereo vs. mono setting for the circa'2011 Evo 3D device.
Another example: this review implies that for Huawei P9 and P10, you will actually get one-camera result if you choose monochrome mode.
A recent article gives some perspective how different are approaches to dual camera among different manufacturers.

How to improve captured image resolution with Camera2 API android?

I am using this project android-camera2-secret-picture-taker to capture image without open camera view, but the captured images is very bad like this
any help to make this better?
thanks
[Edit]
I tried other phones and it works fine, I take this bad images on Huawei Y6II only and I don't know why? the phone camera is 13 mpx and works fine with native camera app.
Did you issue only a single capture request to the camera device? (No free-running preview or such).
Generally, the auto-exposure, focus, and white-balance routines take a second or so of streaming before they stabilize to good values.
Even if you don't want a preview on screen, you need to request 10-30 frames of data from the camera to start before you save a final image. Or to be more robust, set a repeating request targeting some low-resolution SurfaceTexture, and wait until the CaptureResult CONTROL_AE_STATE / AWB_STATE fields reach CONVERGED, and the AF_STATE field is what you want as well (depends on what AF mode you're using). Then capture your image.
This is a wildly blind guess, but hey, worth a try.
If you used some code snippet from the web which suggests to get a list of supported image sizes and just pick the first one - well this has backfired for me on Huawei devices (more than one model) because Huawei seems to provide the list in the ascending order of resolution (i.e. smallest-first), whereas most other devices I've seen does that in descending order (i.e. largest-first).
So if this is a resolution issue, it might be worth a check.

mp4 Resolution in android

Any one have idea what resolution android support.. what is the idle bit rate and Frame rate for android mp4 video...
There are a plethora of android devices (60+) with different screen resolutions and decoding horsepower. There is not likely to be one right answer for this, the lower you keep your resolution the more devices will be able to play and the faster the experience will be even for the bigger devices esp if you are moving video across the network.
Edit: I think the lowest resolution screen on a production android device is 240×320 in the 2.8" screen on the HTC Tattoo.

Categories

Resources