Get the video frame buffer from CameraService


I have created custom system service. Now i need to get the video frames from CameraService during video recording. Can anyone suggest me how to start since i am beginner.


What kind of camera did you connected ?

If your camera is well integrated in your Android system (driver, HAL…) then you should follow the AOSP documentation:

Hi Loic

Actually i don’t want to render the data into any surface. I need to collect the data as byte[] and need to use it for face detection.

If I’m not wrong you can use SurfaceTexture without having to display it, but you do not have to display it. There are several examples on the web depending your Android version: (camerav2) (old API)

Hi Loic

can i refer the below service to fetch the frames during the scenarios like - when user is recording a video ?

I suppose yes, if recording is managed by your app, else I’m not sure two different apps can open camera stream on Android. But it is worth to try.

Sure Loic, i will try it.
Thanks you so much.

hi Loic,

I am able to get CAMERA_MSG_PREVIEW_FRAME, CAMERA_MSG_RAW_IMAGE and all. But not getting CAMERA_MSG_VIDEO_FRAME. Trying to trace from HAL. But couldn’t able to connect to java layer. Any idea?