voc / voctomix

Full-HD Software Live-Video-Mixer in python
https://c3voc.de/
MIT License
575 stars 104 forks source link

Support alpha channel using color key #226

Closed rbuehlma closed 2 years ago

rbuehlma commented 6 years ago

With this change, it is possible to enable color keying using [source.*] alpha_method = green

Adding videoconvert to the pipe is only done when this feature is used. This is required to prevent a performance hit for other cases.

This somewhat solves https://github.com/voc/voctomix/issues/158 but it does not yet integrate nicely in the UI. The feature makes currently only sense if the streams are both fullscreen and the color keyed video is A while the other one is B. I expect the UI could be improved together with https://github.com/voc/voctomix/issues/142

This is my first contribution to this project. Please let me know if something is wrong.

rbuehlma commented 6 years ago

I have included your feedback, fixed the pep8 checks and improved the behaviour somewhat. sourceB will now only be enabled if sourceA has alpha enabled.

You are right, there might be other cases where this feature can be used as long as the videos are overlapping. My usecase (currently it is more artificial) is to display some kind of overlay. Maybe there will be a real usecase in the future.

MaZderMind commented 5 years ago

My usecase (currently it is more artificial) is to display some kind of overlay. Like a lower third or some kind of always-on-top overlay?

In this case I would still merge this PR because it seems useful on its own, but I'd suggest to open a new one which would provide add a facility to add multiple dedicated Video-Inputs (like we have for the StreamBlanker-Soucres) that

This could be used for a lot of useful applications. Would you be interested in working on this?

MaZderMind commented 5 years ago

PR looks fine now code wise. Need to think about a (physical, with a camera and green fabric) Test-Setup tough ;)

rbuehlma commented 5 years ago

Like a lower third or some kind of always-on-top overlay?

Yes exactly something like this. In my opinion this is a must have for video mixing :)

I thought about an extension of this as well. Directly accepting RGBA would probably be cool but I currently do not know of a real source of such an RGBA stream. Multiple fixed layers are also on the list of my ideas. Templates for the streams would also be cool to switch between templates for different scenarios.

This PR mainly was to get a bit used to voctomix and its code. If we can use it in a project, there will most probably be coming more PRs :)

MaZderMind commented 5 years ago

Directly accepting RGBA would probably be cool but I currently do not know of a real source of such an RGBA stream.

We usually feed our Streams in via ffmpeg, but you're right, the source of that overlay might very well be an external device connected via HDMI or such (in our Case it would probably be some kind of InfoBeamer RasPi), so color-keying might still be necessary.

Thank you anyway for your contribution – it is much appreciated :)