videokit-ai / videokit

Low-code, cross-platform media SDK for Unity Engine. Register at https://videokit.ai
https://videokit.ai
Apache License 2.0
107 stars 14 forks source link

FPS drop to 3-4 in Android device on starting VideoKitCameraManager with AI capability #70

Closed thesanketkale closed 1 year ago

thesanketkale commented 1 year ago

I see a huge FPS drop after starting the camera using VideoKitCameraManager with AI capabilities in Unity editor and Android devices. I am trying to make a QR code scanner where I need to access the camera frame texture to decode QR codes at 30 fps. It used to work quite well as per the requirements back with Natcam API, but since upgrading to VideoKit, I am seeing very low FPS once the camera feed starts.

I am using VideoKit version 0.0.15 on Unity editor version 2023.1.15f1 with Android build target platform.

My VideoKitCameraManager component looks pretty standard: image

The camera feed is rendered on a RawImage with standard settings: image

olokobayusuf commented 1 year ago

Hey @thesanketkale , you're setting the preview resolution to Highest, which is likely going to be very very high. Try reducing it to 1920x1080 and see how the performance is like.

Enabling the AI capability will cause the camera image processing to run on the CPU instead of the GPU, so that AI and computer vision algorithms can access the pixel buffers to do their processing. There is a cost to this as the resolution increases.