Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Question about scaling issue on old device #1782

Open
mrtndat opened this issue Mar 28, 2025 · 4 comments
Open

Question about scaling issue on old device #1782

mrtndat opened this issue Mar 28, 2025 · 4 comments

Comments

@mrtndat
Copy link

mrtndat commented Mar 28, 2025

Hello,
I notice on old devices which has Camera levelSupported is CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL_LEGACY. The width and height must be in the supported list.
When I pass a width and height of 960x540 on that device, but the prepare() function return false. I have to make a workaround that find the nearest support camera resolution, in the above device, the nearest one is 800x480.
This time, the camera functions are working fine. However, the image is scale. I have tried the setAspectRatioMode(AspectRatioMode.Fill) but it does not work. See the below video.

re_scale_issue.mp4

Is there a way to output the 960x540 video on device that does not support this resolution?
Thanks

@pedroSG94
Copy link
Owner

Hello,

It is not supported because that devices use a wrapper of camera1 API which can't open any resolution.
I can try find a way to do it with Camera2Source but only if the device support a resolution with the same aspect ratio and higher than the selected resolution

@mrtndat
Copy link
Author

mrtndat commented Mar 28, 2025

Can we open the camera with supported camera resolution on those device (800x480), but keep the encoder use the input resolution (960x540)?

btw, I have updated my workaround to find the nearest support resolution with the same ratio.
This time, the camera is opening with no scale issue.
Thanks

@pedroSG94
Copy link
Owner

Hello,

Can we open the camera with supported camera resolution on those device (800x480), but keep the encoder use the input resolution (960x540)?

This has no sense according with my previous explanation of aspect ratio. That resolutions have different aspect ratio

@mrtndat
Copy link
Author

mrtndat commented Mar 31, 2025

Got it, then I will stick with my workaround on those devices.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants