60FPS does not work with PreviewView

155 views
Skip to first unread message

Tomáš Válek

unread,
Nov 6, 2020, 6:12:36 PM11/6/20
to Android CameraX Discussion Group
Goal is create preview with 60 FPS.

I tried it via Camera2Interop:

val previewBuilder = Preview.Builder()
val camera2InterOp = Camera2Interop.Extender(previewBuilder)
camera2InterOp.setCaptureRequestOption(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE, Range(60, 60))
previewUseCase = previewBuilder.build()

Results:
Xiaomi Redmi Note 8T = 60 FPS.
Google Pixel 2 = 30 FPS = does not work.
Samsung A40 = black screen = does not work.
(All devices know 60FPS preview.)

Tried lower resolution (1280x720), higher res. (1920x1080).
When I tried add: camera2InterOp.setCaptureRequestOption(CaptureRequest.CONTROL_AE_MODE, CaptureRequest.CONTROL_AE_MODE_OFF)
PreviewView is black only on Pixel 2, Xiaomi Redmi Note 8T, Samsung A40.

Call bindToLifecycle with only one UseCase (previewUseCase).

Gradle dependencies:
androidx.camera:camera-core:1.0.0-beta11
androidx.camera:camera-camera2:1.0.0-beta11
androidx.camera:camera-lifecycle:1.0.0-beta11
androidx.camera:camera-view:1.0.0-alpha18
androidx.camera:camera-extensions:1.0.0-alpha18

Does anyone know how to solve this? Thank you.

teddy boy

unread,
Nov 6, 2020, 9:11:48 PM11/6/20
to Android CameraX Discussion Group, Tomáš Válek
As I know, all producers limited camera2 API too much and 60fps usually doesn't work fine (glitch preview) on many devices. 
You can try using Range(120, 120) or 240fps then retry. Some flagships can supported camera2 API better with camera level at hardware and higher. But all highspeed camera still be limited the video resolution maxium is 1080p on all devices.

Tomáš Válek

unread,
Nov 7, 2020, 2:13:42 PM11/7/20
to Android CameraX Discussion Group, teddy...@gmail.com, Tomáš Válek
If the 60 FPS doesn't work, then 120 or 240 FPS will be?
Tried it, and doesn't work on any device.

Dne sobota 7. listopadu 2020 v 3:11:48 UTC+1 uživatel teddy...@gmail.com napsal:

teddy boy

unread,
Nov 8, 2020, 9:35:12 AM11/8/20
to Android CameraX Discussion Group, Tomáš Válek, teddy boy
I tested with my S10+ Android 10, 120fps and 240fps worked fine. 60 fps wasn't good.

teddy boy

unread,
Nov 8, 2020, 9:36:46 AM11/8/20
to Android CameraX Discussion Group, teddy boy, Tomáš Válek
More info: But I didn't use the CameraX library.

Scott Nien

unread,
Nov 8, 2020, 9:26:13 PM11/8/20
to Tomáš Válek, Android CameraX Discussion Group
> Google Pixel 2 = 30 FPS = does not work.
looks like Pixel 2 does not honor the FPS range.  

> Samsung A40 = black screen = does not work.
Does CameraCharacteristics.CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES on A40 contain 60 fps ?


--
You received this message because you are subscribed to the Google Groups "Android CameraX Discussion Group" group.
To unsubscribe from this group and stop receiving emails from it, send an email to camerax-develop...@android.com.
To view this discussion on the web visit https://groups.google.com/a/android.com/d/msgid/camerax-developers/4ed5a86d-0793-415f-9c95-e459d08c55e0n%40android.com.

Scott Nien

unread,
Nov 8, 2020, 10:58:08 PM11/8/20
to Tomáš Válek, Android CameraX Discussion Group
> Google Pixel 2 = 30 FPS = does not work.
After checking internally, 
having 60fps listed in CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES does not mean you can achieve 60 fps with any resolutions. It just means you can achieve 60fps using some resolutions. 
Please check getOutputMinFrameDuration.   You can use that API to query the min frame duration for each resolution and to achieve 60fps , frame duration must be lower than 16.666666 ms (1/60s) 

In general, video resolutions are more likely to run at 60fps, and full-resolution still captures are less likely to be able to.
I can achieve 60 fps on Pixel2 using 1920X1080 resolution.    

Please note that when setting target resolution for use cases,  the order of width / height aligns with the target rotation (Which is display orientation by default). 
This means if your device is a natural portrait device (mostly mobile phones are)  ,  then you have to call setTargetResolution(1080, 1920)  when the device is in portrait mode. 
and call setTargetResolution(1920, 1080) if it is in landscape mode.   

Scott


Reply all
Reply to author
Forward
0 new messages