Closed troypesola closed 3 years ago
my major hurdle so far is allocating new memory for the obs_source_frame *frame
output.
a lot of the problem (and resources) is colorspace conversion, if I can allocate new memory and put the RGBA in there, and set the frame->format = VIDEO_FORMAT_RGBA
, then this feature is trivial.
but so far i couldn't get the mem allocation down. i need to do some more research
but you're welcome to try it..
I'll take a look when I have some time. I just wanted to check if you had looked at it. Good to know that the color space conversion is the challenge.
Feel free to close this one out.
Hi @royshil. First thanks for building this plugin, it works really well!
As @troypesola suggested, I'm too trying to create an alpha output directly from obs-backgroundremoval plugin. Using it together with Chroma Key creates a "color border" effect when I try to make smooth edges.
I already have a working development setup and made some modifications to filter_render
in order to create a BGRA image.
I'm new to obs plugin development (actually only a few hours) and tried a few combinations of video formats on video_scaler_create
in a hope to output a BGRA frame, but so far I have no success.
If you have time, can you point the modifications necessary to make it work from a obs-plugin perspective? By this time I'm not concerned about memory issues, as you point out in a previous comment. But I'll take it in consideration if I submit a PR.
Best regards! Bruno
@brunodoamaral I think the new built in scalers can do this very easily. The mem allocation is trivial. I can make an effort to implement this in the next couple days... It's also needed for the "feather" feature that I just rolled out in the last version.
@royshil thanks for your fast response.
I added a new feature for mask offset (it uses morphological operation to dilate or erode the mask). Combined with the feather feature, it create a nice fade affect. But it didn't work well with Chroma Key. That's why I'm looking for some "native" alpha implementation. I'll spend a few more time on it and came back if I found a solution. Anyway, I'll keep an eye on the progress from your side by subscribing to changes on github.
@troypesola @brunodoamaral You can get a transparent background out of this plugin by placing video source in it's own scene, adding the plugin as a filter, then placing that scene in your scene and filtering that with the ChromaKey filter.
Hi, @royshil ! First of all, thank you for the wonderful plugin!
Do you still have plans of implementing the alpha channel? That would be an awesome feature because it would allow smoother contours with transparent backgrounds. Currently when using a chroma key filter that's not possible because the contour would get tinted with the color used for the chroma key.
@mhcerri I'm working on the alpha channel right now as well as a 27.1.3 (latest) OBS version
Did you test out adding transparency with an alpha channel instead of setting the color?
There is an Alpha YUV format. So it seems like it wouldn't be too hard to add a parameter for transparency, convert to an AYUV, apply the mask, then convert back to the proper output format.
Thoughts? I can fork and give it a shot, but wanted to see if you had tried going direct to transparent already.