I am capturing frames from camera and rendering them in real time via OpenGL ES 2.0. Now I want to record them to a movie file along with audio. On iPhone, I had AVAssetWriter that would take care of the recording, giving me 30fps. What are my options on android? I tried search but couldn't find any.
UPDATE: For those wondering what I am trying to do, see this app: https://play.google.com/store/apps/details?id=com.androidillusion.videocamillusion&hl=en
This is the only app i found that could perform 30FPS video rendering/recording. My goal is to try to figure out how it is done.
Android includes support for high performance 2D and 3D graphics with the Open Graphics Library (OpenGL®), specifically, the OpenGL ES API. OpenGL is a cross-platform graphics API that specifies a standard software interface for 3D graphics processing hardware.
OpenGL in Android is a graphics library that is used for 2D and 3D graphics development in Android applications. OpenGL provides cross-platform APIs. It processes high-performance data transfer between CPU and GPU. OpenGL supports the android native development kit(NDK) for graphics features development.
OpenGL ES 3.1. Supported by Windows, Linux, Android (since version 5.0) on devices with appropriate hardware and drivers, including: Adreno 400 series.
The OpenGL drivers on Android are not user upgradable. Newer versions are only issued by the vendor (ARM, Qualcomm, Vivante) to their partners (Samsung, LG, Lenovo, Xiaomi, Oppo etc) which then customise and integrate them into their device Android firmware image.
Once you capture frames from camera and render them with OpenGL i assume that you already have those frames in your memory and you don't need to use OpenGL to read-back the rendered images.
You can use FFmpeg or libtheora libraries to interleave your audio/video streams into a file. Both can be compiled for Android and are NDK-friendly.
There are a lot of tutorials for both libraries.
In case of Theora, you can convert you frames to YUV-color using GLES 2 shaders.
P.S. If you need to read something back from OpenGL ES - just use glReadPixels()
and proceed with these video encoding libraries.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With