Overlay masking help. Video peaking behind overlay

wolfkin

New Member
So I'm working on a TV scene. Conceptually it's very simple. It's a TV with masked center and I put a video behind it.
ohbg3qy.png


The problem is the videos aren't all necessarily the same size or aspect ratio so I'm trying to find a way to get them to fit no matter what. The bounding box does an excellent job of resizing the content so it always fits and fills the window the way I want it to

jFobH09.png


The problem as you've no doubt already seen is with wide videos the VLC capture can extend too far. The scene itself it just two sources. A picture of the TV green screened out and a Window Capture of VLC
m6RAYfk.png

So I'm trying to find a way to mask out that extra portion. I could introduce a middle mask image but I'd have to cut out a window and the TV is already scaled up (native 960x480) so I wouldn't know exactly how big to make it
1656000456039.png


But i'm concerned that would sort of limit my ability to put the TV on different backgrounds because I'd have to find a way to cut a hole in every background. I could crop the video but that only works on the current resolution and when I load a different video the crop won't work. I'm comfortable enough in GIMP to make what I need I just don't know what I need. I'm open to ideas.
 

koala

Active Member
It's not recommended for a static mask to use the green color and the chroma key or color key filter, you can create a mask with transparency in the first place, if you save this in an image format that is capable of transparency, for example *.png.
In your case, you have these components:
- video source (should go inside the TV)
- TV source (static image)
- background source (should go outside the TV, you mentioned it in your post)

It's all about masks and correct stacking of sources in the sources widget of OBS.
I created 2 images from your TV frame.
The first is a rough mask to separate the background from what's inside the TV frame (colored black and white)
screen mask bw2.png


2nd image is the TV frame:
mask tv.png

Please notice I replaced the green with transparent. Everything that previously was green, is now transparent (this is what the green screen filter does, but you don't need the green screen filter here).

Add your sources to OBS:
1656073902729.png

Bottom ("video") should be your VLC media source, I used some static image just for demonstration.

Next is the background. That's some image with the "Image Mask/Blend" filter applied, with the "screen mask bw2.png" image.
With this we punch a hole through the background.
1656074028318.png


The top image is the TV frame that covers the hard border between the hole and the background:
1656074104108.png


And the video shows up through the remains of the hole in the middle of the TV frame, and it's always masked regardless of the actual size of the video source:
1656074161805.png
 

FerretBomb

Active Member
Method 1.
Use the bounding box you already have. Change the bounding box type. You may end up with letterboxing/columnboxing for videos that do not match the aspect ratio of your window.

Method 2.
Create a new Scene. Put the TV in it, with chromakey (or better, convert to PNG so the chroma is unneeded). Place the video under it as you have now, with the bounding box as you have now. Add a Crop filter to the Scene itself, and crop the scene down to the size of the TV. Add the scene to your other scenes.
 

wolfkin

New Member
Thank you for the detailed response. Apologies for the late reply. I'll be looking into trying this out tomorrow on day off. Will report back.

Use the bounding box you already have. Change the bounding box type. You may end up with letterboxing/columnboxing for videos that do not match the aspect ratio of your window.

For the record I'm perfectly willing to accept black bars in either direction. The goal in this case isn't to have a watchable screen per se. Just enough to see what's going on.
 
Top