Syncing video playback across 2 OBS running on 2 separate computers

markkuo

New Member
Hello, new OBS developer here.

I have a specific need to sync video playback (ffmpeg or VLC source) across 2 OBS instances running on 2 separate computers, under the same local area network. It doesn't have to have strict frame-to-frame sync but both need to play close enough. By close enough, 0.5second isn't good enough. I need something better than "hit play button" at the same time.

My first thought is to implement a simple mechanism like that of mplayer netsync, using UDP sending master OBS video player's timestamp. The master OBS video playback doesn't get changed at all. The slave OBS receives the timestamp and syncs video playback to that timestamp. Audio doesn't matter on slave OBS.

I first experiment with ffmpeg source and do this:
- master: send out mp_media_t's next_pts_ns
- slave: find the difference of next_pts_ns from master's. Add the delta to mp_media_t's next_ns so in the decoding thread mp_media_sleep() will skip the sleep or sleep longer based on the difference

This doesn't work. I then realised there is an additional layer of cache in obs-source.c and async playback on the obs core level where the video frame actually gets rendered. My next thought is I probably need to sync the actual frame rendering timestamp on the obs-source.c, instead of from the VLC or ffmpeg source.

I appreciate any input and how this can be done (or can't be done). Thank you.
 

markkuo

New Member
The problem is the receiver (or the slave on a master/slave setup). How do I adjust to the target timestamp when rendering each frame. Thank you for your input.
 

Suslik V

Active Member
Sorry, I don't get it. I was thinking that you wish to playback video, same as any TV broadcasters do for every consumer.
Probably, you need other tools, not OBS.
 

markkuo

New Member
Sorry I might not have been clear enough. I am using other OBS features that no other tools can replace. Now what I want to do is in one scene I have VLC or ffmpeg source, playing a video. That video is so huge so the video author needs to cut it in half so there are actually 2 video files, of the same length.

Those 2 videos will be played on 2 separate computers (so different OBS instances). A controller (using OBS websocket) will then switch both OBS to the video scene, and start the video playback at the same time. I am building the sync part by modifying OBS source code, so that during the video playback, the 2 OBS instances can perfectly sync, if possible.

Hope that is clear! Thank you.
 
Top