Fetch Raw frames from capturing video Android Camera - android

I do not know much about Camera API, though i need to use frames from a capturing video with more then 30fps with a good quality camera(S9).
Can anybody suggest code for the same.
I tried to find fit code for this but i am failed.
Thanks in Advance
Mohit

You are lucky, since not so long ago a component of android JetPack was released, called CameraX. Sadly it is still in alpha stage, meaning that you should avoid using it in production since it might have breaking changes in the future. This component was built on top of Camera 2 API, witch is a low level API for working with camera.
If you plan to use your app in production I highly recommend to use Camera 2 API, it is low level, however you have the full control over the camera.
Here is an example to get you started.

Related

Real time processing of high speed video session

I'm looking for a way to process video images (without recording) at 120fps - on Android.
Going over all relevant SO questions, I couldn't find an answer to my question.
The docs says one must use CameraConstrainedHighSpeedCaptureSession to work with high speed video sessions.
For regular capture session I am using an ImageReader and process the images in C++.
But for high speed sessions I can't use it.
Is there a way to solve this issue using Camera2 API?
If not, is there a c++/opengl way to do it?
Important - my goal is to NOT record the video.
I've looked at Grafika & bigflake but they use the old Camera API.
Any help is much appreciated.
Thank you.

How to use zero shutter lag in Android Camera API 2?

As in title. How to make ZSL still picture with Camera 2 API? Should I only use TEMPLATE_ZERO_SHUTTER_LAG? Should I also add CONTROL_ENABLE_ZSL in CaptureRequest? Should I do precapture sequence before taking still? Currently I do not have any particular code, just thinking how do it.
There is IMHO good example of using Camera 2 API by Android Open Source Project:
https://android.googlesource.com/platform/packages/apps/Camera2/+/9c94ab3/src/com/android/camera/one/v2/OneCameraZslImpl.java
It uses TEMPLATE_ZERO_SHUTTER_LAG but does not use CONTROL_ENABLE_ZSL.

Unable to create a surfaceview camera app that supports android 4.0 and above.

I'm planning to make a camera app that you can take a photo with a background image.
I guess there will be a need to use a Surfaceview? But the main problem is since the Camera is deprecated
there might be a need to use camera2 for android. I want to make a camera app in portrait mode but are there any
samples or tip? I googled but wasn't able to find a decent one. I would love to hear from you.
If you want to start with Camera2 API, this link will help you understand basics.
android-Camera2Basic(Github)
It is not necessary to use SurfaceView as you will see from code
that TextureView can also fulfill your requirement
The HdrViewfinder sample app uses SurfaceView with camera2, though it doesn't lock itself into portrait mode. But that's a relatively simple change.
Of course, camera2 was only added in Android 5.0, so if you need to support 4.0, you need to use the old camera API.

Burst mode camera in Android which can take multiple pictures

I was trying to implement a burst mode camera in my app, which can take multiple pictures at the rate of 5-10(or more) snaps per second.
FYI I already saw the previous questions here, here and here - tried and failed with speed. Also the questions are old and there are no comprehensive answers addressing all the concerns like how to manage heap etc.
I would really appreciate if someone can help with useful pointers, best practice or maybe an SSCCE.
Update :
Tried successfully with pulling preview frames # 15+snaps/sec, but the
problem is preview size is limited. On nexus 5 I can get only
1920x1080 which is ~2mp, whereas the full resolution pic possible on
n5 is 8mp :-(
I think a big part of the problem is the question: How does burst mode work in current phones? A couple of blogs point out that Google has confirmed that they will be adding a burst mode API.
I suspect current implementations work by setting exposure time to minimum and calling takePicture in a loop or using Camera.PreviewCallback
I played around with the latter for some computer vision projects and happened to look into writing a burst mode camera using this API. You could store the buffers you receive from Camera.PreviewCallback in memory and process them on a background thread.
If I remember correctly, the resolution was lower than the actual camera resolution, so this may not ideal.
Short of device-specific APIs offered by their manufacturers, the only way you can get a "burst mode" that has a shot of working across devices will be to use the preview frames as the images. takePicture() has no guarantees of when you will be able to call takePicture() again.

android support better method than glreadpixels?

I'm making android game.(using andengine)
I need to record game play screen .
This is not for making promotion video, It is for game players to review their game play.
My app should record video by itself.
So I can't solve this problem using available recording app in market.
I already checked below code.
http://code.google.com/p/andengineexamples/source/browse/src/org/anddev/andengine/examples/ScreenCaptureExample.java?spec=svn66d3057f672175a8a21f9d06e7a045942331f65c&r=66d3057f672175a8a21f9d06e7a045942331f65c
It works very well..
But I want to record game play video, not a one screenshot.
At least I need 24fps for smooth replay, But If I use glreadpixels , I can get 5 fps at my xoom device.
I searched various websites to solve this optimization problem.
most people saying glreadplxels is too slow to record video.
http://www.gamedev.net/topic/473794-glreadpixel-takes-tooooo-much-time/
they recommend glcopyteximage2d instead of glreadpixels.
because glcopyteximage2d is much more faster than glreadpixels.
but I can't find how to use glcopyteximage2d in andengine.
even someone say that android opengl ES do not support glcopyteximage2d.
Maybe Another method exists to record smooth video.
It is read framebuffer of android device.
most of recording app in market using this method. but these app needs root permission to grab framebuffer.
I've read some news that android will be support capture screen from suface_flinger after gingerbread.
But I can't find out how to use framebuffer without root permission. T_T
These are my guessing solution.
use another opengl API which has better speed than glreadpixels.
find some android API can get framebuffer without root permission.
(Maybe I can access to android SURFACE_FLINGER ??)
draw another offscreen texture to record video.
But I don't know how to implement these methods.
Which approach is correct?
Do you have a example code to record video for android?
please help me to solve this problem.
If you know any other method, That will be helpful.
any help will be appreciated
Does the GPU vendor of your device support es3.0, if it does you can try to use PBO.
Here is a topic I you can refer to :Low readback performance with PBO , help !!!!!

Categories

Resources