letmaik / pyvirtualcam

🎥 Send frames to a virtual camera from Python
GNU General Public License v2.0
452 stars 49 forks source link

Sending ARGB Frames #46

Closed graphemecluster closed 3 years ago

graphemecluster commented 3 years ago

I am sorry to open an issue here but I am trying to send ARGB data (with shape (h,w,4)) to OBS but it seems that neither the shape is correct nor the OBS Virtual Camera support ARGB data. I've asked a question on StackOverflow but I think no one would be able to answer my question, so I decided to ask here. Any help would be much appreciated.

letmaik commented 3 years ago

Out of curiosity, where are you getting your ARGB frames from? In any case, you can easily convert ARGB to RGB with frame[:,:,1:], or frame[:,:,:-1] for RGBA.

graphemecluster commented 3 years ago

I am trying to send image data with alpha data such that chroma key is not needed. I know how to blend an ARGB image with a background and output RGB. But I would like to send, something like a semi-transparent video, to OBS directly. In this case chroma key won’t work for intermediate opacity. The frames are generated programatically.

letmaik commented 3 years ago

(Virtual) webcams generally don't support transparency, as far as I know. The native format of the OBS virtual camera on Windows is NV12 and UVYV on macOS, both of which don't have an alpha channel.

graphemecluster commented 3 years ago

Oh I see. I just think it’s possible. OBS has an option setting the format to ARGB for other applications’ virtual camera, though, and it does show up a camera capture with alpha channel when I use it.

letmaik commented 3 years ago

I'm not too knowledgeable on OBS itself, but the virtual camera device itself really doesn't support alpha.

graphemecluster commented 3 years ago

OK, I’ll find others for help or try another way then. Thank you for your replies!