简体   繁体   中英

How to limit preview fps range in android for camera?

是否有可能限制android相机中的fps范围。尝试更改.setPreviewFpsRange()中的值...但帧速率未更改..它连续每秒30帧

You can use public List<int[]> getSupportedPreviewFpsRange () to check what FPS range supported by your device. Here is mine:

preview-fps-range-values=(10000,10000),(15000,15000),(15000,30000),(30000,30000);

so if I want to change the fps to 15, I can setPreviewFpsRange(15000,15000) .

I set the preview frame rate to the lowest rate possible with this code, but you could set it to the highest rate possible by using l_last instead of l_first in the List index ( mCamera is a member variable that references the Camera and is set elsewhere in the code).

Camera.Parameters l_params = mCamera.getParameters();

List<int[]> frameRates = l_params.getSupportedPreviewFpsRange();
int l_first = 0;
int l_last = frameRates.size() - 1;
int minFps = (frameRates.get(l_first))[Camera.Parameters.PREVIEW_FPS_MIN_INDEX];
int maxFps = (frameRates.get(l_first))[Camera.Parameters.PREVIEW_FPS_MAX_INDEX];
l_params.setPreviewFpsRange(minFps, maxFps);

mCamera.setParameters(l_params);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM