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.
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.