Search code examples
androidvideoopengl-esandroid-mediacodec

How to embed text while recording video in Android?


My goal is to record the video in Android with stopwatch embedded in it while recording.

I followed the samples of Grafika Project, CameraCaptureActivity.java where they use OpenGL 2.0 to record a small block along with recording video. They are using following code to draw block in OpenGL 2.0

private static void drawExtra()
{
      GLES20.glClearColor(1.0f, 1.0f, 1.0f, 1.0f);
      GLES20.glEnable(GLES20.GL_SCISSOR_TEST);
      GLES20.glScissor(0, 0, width / 3, height / 3);
      GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT);
      GLES20.glDisable(GLES20.GL_SCISSOR_TEST); 
}

The above code draw white block at the bottom left side of the video while recording and saving.

What I want is to draw text over that white box using OpenGL 2.0, so that it will also record along with video.

I dont have knowledge of OpenGL 2.0. Need help to just draw text over same surface where video is recording, so that it will get embedded into it just like that white box.


Solution

  • You can try Intel INDE on https://software.intel.com/en-us/intel-inde and Media Pack for Android which is a part of INDE, tutorials on https://software.intel.com/en-us/articles/intel-inde-media-pack-for-android-tutorials. It has a sample effect called TextOverlayEffect to put text on a video