opentok / opentok-android-sdk-samples

Sample applications illustrating best practices using OpenTok Android SDK.
https://tokbox.com/developer/sdks/android/
MIT License
211 stars 169 forks source link

Sending a transparent RGBA frame to Remote Device #199

Closed afsaredrisy closed 4 years ago

afsaredrisy commented 5 years ago

I am trying to send ARGB frame that contains ALPHA Channel value but when I am rendering on GLSurfaceview on remote device its background is coming black. ALPHA value is being lost somewhere during I420 encoding. So is there any way to send ARGB frame so that Transparency may preserve.

Other thing is in Custom video driver you provide shader code that is converting YUV to RGB and setting ALPHA value to 1.0 (i.e opaque) is there any way to calculate ALPHA value from YUV itself in shader code.? Thankyou

robjperez commented 4 years ago

hi @afsaredrisy

Actually this is a very interesting question. There is no way of direclty sending an alpha channel using our sdk, since we convert the ARGB frames to YUV in order to encode them and there is no transparency information in YUV as you mentioned.

However, you may be able to use alpha information doing some kind of image processing. You could use a background color (typically green) that will be mapped to a specific Chroma Key, and then remove that specific color in the opengl shader.

You can search for chromakey and yuv.

I'm going to close this since it is not technically an issue nor the samples neither the sdk.