How Can I Draw On A Video While Recording It In Android, And Save The Video And The Drawing?
I am trying to develop an app that allows me to draw on a video while recording it, and to then save both the recording and the video in one mp4 file for later use. Also, I want to
Solution 1:
Here's a rough outline that should work, but it's quite a bit of work:
- Set up a android.media.MediaRecorder for recording the video and audio
- Get a Surface from MediaRecorder and set up an EGLImage from it (https://developer.android.com/reference/android/opengl/EGL14.html#eglCreateWindowSurface(android.opengl.EGLDisplay, android.opengl.EGLConfig, java.lang.Object, int[], int) ); you'll need a whole OpenGL context and setup for this. Then you'll need to set that EGLImage as your render target.
- Create a SurfaceTexture within that GL context.
- Configure camera to send data to that SurfaceTexture
- Start the MediaRecorder
- On each frame received from camera, convert the drawing done by the user to a GL texture, and composite the camera texture and the user drawing.
- Finally, call glSwapBuffers to send the composited frame to the video recorder
Post a Comment for "How Can I Draw On A Video While Recording It In Android, And Save The Video And The Drawing?"