wysaid / android-gpuimage-plus

Android Image & Camera Filters Based on OpenGL.
MIT License
1.78k stars 473 forks source link

VideoRenderer.I420Frame get preview from these frames #104

Open cubatertech opened 7 years ago

cubatertech commented 7 years ago

Hi, I want to generate preview from VideoRenderer.I420Frame in webRTC stream using some filters. Is it possible to we use GPUImage plus lib for this purpose please give me some tips for this. Because if we generate a bitmaps from the stream & apply filters or perform any other processing on stream then it will not sync with Audio. Feel much delay in frames. Thanks

wysaid commented 7 years ago

Sure, you should generate a OpenGL texture from VideoRenderer.I420Frame, And draw to the CGEFrameRenderer every frame. Follow the steps:

  1. Create a TextureDrawer(org.wysaid.common.TextureDrawer), and keep it.
  2. Create a texture with Common.genBlankTextureID(frameWidth, frameHeight), and keep it.
  3. Call glTexSubImage2D with your VideoRenderer.I420Frame data(or buffer), to update the content of the texure. (There may be other functions, just make VideoRenderer.I420Frame as a texture.
  4. Just call CGEFrameRenderer(instance).bindImageFBO(), set glViewport, and then use the drawer to draw the texture.
  5. Apply filters...
cubatertech commented 7 years ago

Thank you very much dear for your quick response.

I'll check & send back ACK to you. Thanks

cubatertech commented 7 years ago

Dear have you any example of this process...

wysaid commented 7 years ago

Maybe later

cubatertech commented 7 years ago

Thank you.

cubatertech commented 7 years ago

I really Stuck in problem last two days ago. & not getting any success.

wysaid commented 7 years ago

Hi @cubatertech Do you still get stuck there? I'm thinking to add a new camera demo with data preview.