Reading Input-frames from PreviewHighSpeedCamera callback method onCaptureCompleted() using Camera2

578 Views Asked by At

Reading Input-frames from PreviewHighSpeedCamera callback method onCaptureCompleted() using Camera2

We are trying to set camera preview for more than 120fps i.e PreviewSessionHighSpeed using Camera2 API, below is the code snippet

private void updatePreview() {

    if (null == mCameraDevice) {
        return;
    }

    try {

        setUpCaptureRequestBuilder(mPreviewRequestBuilder);
        HandlerThread thread = new HandlerThread("CameraPreview");
        thread.start();
        List<CaptureRequest> mPreviewBuilderBurst = mPreviewHighSpeedCamera.createHighSpeedRequestList(mPreviewRequestBuilder.build());

        mPreviewHighSpeedCamera.setRepeatingBurst( mPreviewBuilderBurst, new CameraCaptureSession.CaptureCallback(){
            @Override
            public void onCaptureCompleted(CameraCaptureSession session, CaptureRequest request, TotalCaptureResult result) {

                super.onCaptureCompleted(session, request, result);

                // We want to read the captured image buffer here
                // We tried to use ImageReader but highSpeedCameraSession doesnnot support ImageReader surface
                // HighSpeedcameraSession only supports preview or recording surface
            }

        }, mBackgroundHandler);

    } catch (Exception e) {

        e.printStackTrace();

    }
}

We are able to set camera preview frame for PreviewSessionHighSpeed , but not able to get frame buffer after OnCaptureComplete().

Any one know how to get frame buffer after OnCaptureCompete() ?

Thanks in advance

1

There are 1 best solutions below

0
Eddy Talvala On

The constrained high speed recording session is very constrained (thus the name); there's no support for application access to the high-frame-rate data - it can only be sent to the video encoder.

The preview is also only 30fps, so a SurfaceTexture cannot be used here either to get high-speed data.

Only devices that list high frame rates in their regular target FPS ranges support more flexible outputs; as of today, I'm not aware of any such devices. High speed recording is very much at the edge of mobile phone capabilities today.