Forcing the camera in Android to deliver 30 FPS

2019-05-31 15:53发布

问题:

I'm trying to use the camera for video processing that needs a high constant frame rate around 30 FPS.

I'm using the Camera class and setPreviewCallbackWithBuffer to receive the video frames. I have noticed that most camera does not support a FPS range of 30000 - 30000. However, when recording movies I assume the camera on those devices still delivers a frame rate around 30. Is there some other way to achieve a higher frame rates than with my current method?

回答1:

Note that non-top devices with cheap cameras, especially front ones, don't support reliably fps you've requested. If you request 30, device can reply ok (will start capture, no crash, etc) but in real it will deliver frames with fps in range say... [4-30] depending on lighting conditions (less light needs longer exposition time) and may be something else too. Example of such camera is front camera on galaxy S3 mini



回答2:

If you don't want to use static fps rate for all the devices, you can use getSupportedPreviewFpsRange () method to determine the available fps range for that particular device. This method will return minimum and maximum supported fps rate.

Now after getting the maximum supported fps rate, you can use your current method to set the fps rate.

Hope this will give you some hint about setting fps to its maxmimum.