Hi there,
You're right, the Recording object doesn't currently provide the actual frame rate used for video capture.
The target frame rate you set using setTargetFrameRate() can sometimes be overridden by CameraX to ensure optimal performance and compatibility with other active use cases and the device's capabilities.
For now, the most reliable way to obtain the actual frame rate is through the Camera2Interop API. Here's how you can access the CONTROL_AE_TARGET_FPS_RANGE from the capture results:
val recorderBuilder = Recorder.Builder()
val recorder = recorderBuilder.build()
val videoCaptureBuilder = VideoCapture.Builder(recorder)
Camera2Interop.Extender(videoCaptureBuilder)
.setSessionCaptureCallback(
object : CameraCaptureSession.CaptureCallback() {
override fun onCaptureCompleted(
session: CameraCaptureSession,
request: CaptureRequest,
result: TotalCaptureResult,
) {
val fpsRange = result.get(CaptureResult.CONTROL_AE_TARGET_FPS_RANGE)
if (fpsRange != null) {
logger.atInfo().log("fps range: %s", fpsRange)
} else {
logger.atInfo().log("fps range is null")
}
}
}
)
videoCapture = videoCaptureBuilder.build()
```
We appreciate your feedback and are considering adding a getter API in the future to make this information more easily accessible.