Get the video frame buffer from CameraService


#1

Hi,

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.

Thanks


#2

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:


#3

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.


#4

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:

https://github.com/botyourbusiness/android-camera2-secret-picture-taker (camerav2)
http://cell0907.blogspot.fr/2014/01/android-camera-capture-without.html (old API)
https://bigflake.com/mediacodec/CameraToMpegTest.java.txt


#5

Hi Loic

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


#6

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.


#7

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


#8

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?

Thanks