Play two videos at the same time, but in different layers

key4427

New Member
For visual aid of what I want, here is a small sketch of the goal I'm looking for.
obs yeah.png

I will have a program running in which a virtual avatar will be displayed inside a green screen. What I want is to put two different videos, one in front of the avatar (which will also be in a green screen) and another video behind the avatar with animated background art. I want both videos to play simultaneously because both videos will basically function as a music video with subtitles. The animation has to follow the music, and the subtitles have to follow the music too.

With a little bit of brainstorming, I came up with two possible solutions:
obs yeah 2.png

In one option, I have two mp4 files (one is the subs and the other is the animated background) that will be put in different layers but will somehow play simultaneously, which I don't know how to accomplish. And the other option is to merge both videos into one single, horizontally or vertically long mp4, and make a duplicate of the video layer and simply arrange each half of the video so that with one click, both layers start to play since they are the same video.

Which process is less intensive for the machine? Which would be the better option? Is there a better way to accomplish what I am looking for?

Thanks very much for the help!
 

AaronD

Active Member
If I were doing this, I'd greatly prefer the single large-frame video. But try to have it in a single player that then gets its picture copied and cropped differently. I think it would be easy to have it in two simultaneous players by accident, which goes back to the risk of them getting out of sync somehow.

If performance is a problem either way with this, you're too close to the edge, and you'll have more problems than just that anyway.

---

If you're choosing between extra-wide or extra-tall, I don't think it matters here. For 3D video, that's how you get simultaneous display (side-by-side, SBS, or extra-wide), or alternating display (over-under, OU, or extra-tall), because the transmission medium (wire, antenna, etc.) gives you one pixel at a time, all the way across the entire combined frame before starting the next line. The receiver figures out that it's getting two standard-sized frames that share a border (or might be explicitly made or set for that), and crops the two 3D views out from that single large frame.

But if there's a frame buffer involved, like pretty much any processing tool has internally, including OBS, and you get the entire frame at once, it doesn't make any difference at all in timing. It's always technically simultaneous, until it goes out a wire in one format or the other.

I don't think there's any requirement at all that the two 3D views have to be related to each other. So you might look at 3D video tools, and hijack them to do what you want here. Maybe OBS has something like that already, under that terminology?
 
Last edited:

key4427

New Member
If I were doing this, I'd greatly prefer the single large-frame video. But try to have it in a single player that then gets its picture copied and cropped differently. I think it would be easy to have it in two simultaneous players by accident, which goes back to the risk of them getting out of sync somehow.

...

As a proof of concept, using only pngs and stuff, this is the experiment I made:
1696880621045.png
Scene 2 is the main scene. Scene 1 has only the extra long PNG with both a background and the subtitle green screen. Scene 3, however, has Scene 1 inside, as to not make the call to Scene 1 twice and losing the ability to add filters to only the background and have them not apply to the subtitles as well. If I had two Scene 1 in my sources, the filters would sync, so putting another scene in between and adding the filters to it instead.

Or well, if the explanation is too crazy because I fucked up the Scene naming, here is another great visual guide:
yesy.png

So far, using only PNGs, the experiment has worked. I will be doing some other experiments in the future with video files to see if this works as I intend, and will update my progress once I do. Any thoughts about my solution? Will the 'scene-in-a-scene' trick be intensive for my pc's resources? I'm in a laptop right now, and the fans are spinning, but this thing cries if I have two windows of Firefox open, so maybe it's not gonna be an issue in my proper gaming rig.

Thank you for the help, though!
 

AaronD

Active Member
Looks good so far!

I'm in a laptop right now, and the fans are spinning, but this thing cries if I have two windows of Firefox open, so maybe it's not gonna be an issue in my proper gaming rig.
Yeah, laptops generally aren't so good for media production. They tend to be so far optimized for portability, that they overheat easily and throttle way back. The idea there is to load something quickly, and then sit and do nothing but cool off while the user looks at it, and to slide nicely into a backpack.

There is a class of laptop that works: Mobile Workstation. I have one that I use regularly, with two simultaneous instances of OBS each doing 1920x1080p30, with automation all over it, and audio processing in a different app that is not trivial either.
It's also thick and heavy, even compared to what there was in 2015 when it was new. That's for a cooling system that actually works.
 
Top