1

I want to get the image stream when I render in glsurfaceview with finger The purpose is record the render form glsurfaceview , I was done it with camera use surfacetexture to encode the .mp4, but I can't get the render from glsurfaceview when I draw.

  • Related: http://stackoverflow.com/a/22461402/295004, note the links at the bottom of answer. – Morrison Chang Dec 29 '16 at 03:23
  • Hi @Morrison Chang Thanks for Related link, same problem that I want to record the screen, and same cause I want to encode the GLsurfaceview content avoid the upper vision, i'm want do in 4.4, even that I know have useful MediaProjection API in 5.0, Thanks your advice again, help my question more specific – Capybara Chan Dec 29 '16 at 05:59

1 Answers1

0
  • Get your GLSurfaceView's EGLContext with EGL14.eglGetCurrentContext()

  • Use the EGLContext above as shared context in a separated thread to create another EGLContext for recording

  • The recording EGLContext will render into a Surface get from MediaCodec.createInputSurface, also it use the same texture from GLSurfaceView

  • Use MediaMuxer to mux your MediaCodec output to mp4

  • Then you can record your GLSurfaceView to mp4

See the example in sample code

alijandro
  • 11,627
  • 2
  • 58
  • 74
  • Hi @Alijandro Thanks your advice, I will try this way, it look can work, I search the Opengl ES2.0 theory in Android recently, I think the EGL interface can help me to solve the problem, Thanks again. – Capybara Chan Jan 04 '17 at 03:16
  • I use the other way to record the glsurface by binding the Multiple texture not your way, but thanks again – Capybara Chan Jan 11 '17 at 09:27
  • @CapybaraChan congratulations! Could you share some information of your solution? If you don't mind, other people get here will find more valuable information. We encourage people share their knowledge here, if you don't mind, you can post your solution as an answer and flag it as the best answer. – alijandro Jan 11 '17 at 09:56
  • @CapybaraChan I am looking into this as well, if you don't mind sharing the solution. Thanks. – TatiOverflow Mar 21 '18 at 05:35