简体   繁体   English

如何限制Android相机的预览fps范围?

[英]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. 您可以使用public List<int[]> getSupportedPreviewFpsRange ()来检查设备支持的FPS范围。 Here is mine: 这是我的:

preview-fps-range-values=(10000,10000),(15000,15000),(15000,30000),(30000,30000); 预览fps范围值=(10000,10000),(15000,15000),(15000,30000),(30000,30000);

so if I want to change the fps to 15, I can setPreviewFpsRange(15000,15000) . 因此,如果我想将fps更改为15,则可以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). 我使用此代码将预览帧速率设置为可能的最低速率,但是可以通过使用l_last而不是List索引中的l_first将其设置为最高速率( mCamera是引用Camera的成员变量,并且在代码)。

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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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