I am a newbie in OpenGL.
I want to record video and audio from a GLSurfaceView and export it to .mp4 (or other formats).
I have a GlsurfaceView
that implement Renderer
I've tried using fadden examples's in bigflake.com like EncodeAndMuxTest.java
,or RecordFBOActivity.java
in google/grafika but without success because I don't know how to implement it.
Is there any example or "How-to" for recording a GLSurfaceView?
You can try to use INDE Media for Mobile: https://software.intel.com/en-us/articles/intel-inde-media-pack-for-android-tutorials GLCapturer class, it allows to make opengl capturing in a few lines of code, samples are here:
https://github.com/INDExOS/media-for-mobile/blob/master/samples/src/main/java/org/m4m/samples/GameRenderer.java
synchronized (videoCapture) {
if (videoCapture.beginCaptureFrame()) {
...
renderScene();
videoCapture.endCaptureFrame();
}
}
You can give the Android Breakout patch a try. It adds game recording to Android Breakout.
The main difference when working with GLSurfaceView, rather than SurfaceView, is that GLSurfaceView wants to manage its own EGL context. This requires you to create a second context that shares data with GLSurfaceView's context. It's a bit awkward to manage, but is doable.
You may want to consider switching from GLSurfaceView to SurfaceView. This requires you to do your own EGL setup and thread handling, but you can find examples of both in Grafika. It's a bit more work to get things set up, but it makes fancy stuff like video recording easier. Of course, if you're using a game or graphics engine that requires GLSurfaceView, that won't be an option.
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