设置Android Camera2的fps值

声明全局变量存储相机的FPS范围

private static Range[] fpsRanges;

setUpCameraOutputs中获取相机的FPS范围

//获取相机帧数范围
fpsRanges = characteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES);
Log.d("FPS", "SYNC_MAX_LATENCY_PER_FRAME_CONTROL: " + Arrays.toString(fpsRanges));

//例如:输出“SYNC_MAX_LATENCY_PER_FRAME_CONTROL: [7 ,15][]15, 30][15, 120]选择合适的范围”

createCameraPreviewSession中设置预览画面的帧率

// 设置预览画面的帧率 视实际情况而定选择一个帧率范围
mPreviewRequestBuilder.set(CaptureRequest.CONTROL_AE_TARGET_FPS_RANGE, fpsRanges[0]);

 

你可能感兴趣的:(Android)