BitmapSource with transparent background
Hi. I am using:
- vMix Server.
- SRT Protocol
- Library Version: 2.5.9
- Using
GenericStreamandBitmapSource.
I want to stream a bitmap to the server (PNG image, with transparent background, is SRT 2028 source as in the image below). But the server receives a black background (Image 2). How can I stream the bitmap to get the same background result as in Image 1 (image added from vMix server) ?
Image 1:
Image 2:
Hello,
The background is black because opengl clean the screen in each frame using a color. I'm not sure if your case is possible. You can try clear using transparent color here: https://github.com/pedroSG94/RootEncoder/blob/master/encoder/src/main/java/com/pedro/encoder/input/gl/render/CameraRender.java#L105 And here: https://github.com/pedroSG94/RootEncoder/blob/master/encoder/src/main/java/com/pedro/encoder/input/gl/render/ScreenRender.java#L138 Set the last value to 0f which means totally transparent. If it is not working, I think it is not possible
Hi. Can you create a commit so I can implement it? My Android Studio often fails when downloading a lib to use it as a module :-(
Try with this gradle:
implementation 'com.github.pedroSG94.RootEncoder:library:7be5f8b871'
//Optional, allow use CameraXSource and CameraUvcSource
implementation 'com.github.pedroSG94.RootEncoder:extra-sources:7be5f8b871'
Hi.
I tried that commit but still got the same black background.
In addition, I am customizing OpenGlView (MyOpenGlView) to add some features (like zoom on pinch, ...).
In version 2.5.9, I still extend the OpenGlView class normally. But with that commit (and in the master branch), you have changed OpenGlView to final type so I can't extend it anymore.
Can you change it back to open class OpenGlView : SurfaceView, GlInterface... ?
Hello,
OpenGlView is open again.
About the background. I was reading a bit more about the transparency/alpha in a stream and it is not possible. Transparency with H264, H265 and AV1 is not allowed at all (you can find fews possible implementations but it is not a standard).