ossrs / srs

SRS is a simple, high-efficiency, real-time media server supporting RTMP, WebRTC, HLS, HTTP-FLV, HTTP-TS, SRT, MPEG-DASH, and GB28181.
https://ossrs.io
MIT License
25.7k stars 5.38k forks source link

Sync multiple stream #1319

Closed pryiz closed 3 years ago

pryiz commented 5 years ago

Hi there,

I use SRS on 3 differents servers, so 3 IPs. The goal is to have 3 video input from 3 smartphones (using broadcastme mobile app). I have those 3 inputs in my OBS software and then stream it to facebook.

My issue : those 3 inputs are totally desynch, even if allsmartphones are on the same wifi.

Any clue how I can fix it? Is is possible to have multiple devices to the same IPs?

Thanks a for lot for your work and help!

hy05190134 commented 5 years ago

what's the mean of sync multiple stream? Do you mean the same delay of different streams as if the 3 different stream coming from the same device?

pryiz commented 5 years ago

Hi, yes you got it!

I have 3 smartphones, each streaming to a different server: Smartphone1 : rtmp://"IP1"/live/stream Smartphone2 : rtmp://"IP2"/live/stream Smartphone3: rtmp://"IP3"/live/stream

and when I add those 3 streams in OBS, videos are not sync...

thanks for your answer

hy05190134 commented 5 years ago

@pryiz I wonder how to check the streams whether sync? just by eyes? what's your demand by syncing the 3 streams? for the communicating with 3 people?

ccMatrix commented 4 years ago

This would be an excellent feature which I could also really use.

Maybe inject a timestamp into the stream which is then used to hold back and sync the streams? Smartphone apps could get current time using ntp server and add the current timestamp to meta info of rtmp stream?

winlinvip commented 3 years ago

Won't support, because it's not a common use scenario.

drunkod commented 1 year ago

@winlinvip ,

Please add synchronizing media streams function. This is a unique feature for the project and can attract users like OBS.

This is already implemented in RTP. SRT?, RTMP? implementation is necessary.

Larix Broadcaster (aka mobile obs) streaming client has added a feature to send NTP timestamps for all supported streams: Insert SEI time metadata and specify NTP server, this allows synchronizing streams on server side. https://softvelum.com/timesync/

RTP - Synchronizing media streams: Implementation of NTP is not required to use RTP... However, if NTP timestamp implemented in RTCP, it can be used to synchronize media streams even from different host... https://gist.github.com/simonkim/a9a3aa4f1ca04448c64212b3b079d107
Synchronizing Streams via SRT: Some SRT encoders like new JVC-cams , Haivision-encoder and software encoder LarixBroadcaster (iPhone/Android) can do this: synchronize internal clock by time-server (usually by NTP protocol). It means all encoders have one clock:if one camera has time 11:59:59 then other cameras have same time. send this time inside encoded feed (SEI metainfo) https://github.com/Haivision/srt/issues/2044#issuecomment-865034230 https://manpages.ubuntu.com/manpages/focal/man1/srt-multiplex.1.html