SRT server settings need to reduce lag
So I got a Windows server OS VDS and set up OBS there. I tested it with 2 SRT clients and see latency from 3to4 seconds from them.
So I have some questions regarding this issue
1 do i need ffmpeg custom install or obs has it up to date and fully set up?
2 can i reduce that 4sec lag from client with some srt line arguments? on srvers side
3 how to optimize lag while having 2 or more clients?
server and client are in one country phisicly server and client both have 1gb internet. CPU on server works fine and handle stable 60fps but on twitch channel i see buffers a lot and huge lag from server to twitch. clients sent srt on 6000 bitrate server use the same settings
20 Replies
What is your RTT? What are you currently specifying?
1. You can use OBS' SRT implentation, yes.
2. Probably, depends on RTT
3. Could you rephrase the question? What is "lag" in this instance? You can specify latency per sender
To be perfectly honest, my best result in OBS was by specifying nothing. Got about 300ms glass to glass. That was OBS -> OvenMedia
If you are using the media source in OBS to "ingest" SRT, then you can try messing with
probesize
and rtbufsize
, as the default buffer is quite large (in order to handle reliable streams)how to measure RTT? i tried google it but no way I will be able to understand all that words... may be there is a cmd command for windows or some software?
I think its good enough to shortcut it with a simple ping. Dosent need to be super accurate.
you'll find the RTT term all over SRT, so if you want to take the simple way out, just pretend it say ping
so ping server_ip will be enough? then I can set up param latency for each client?
I need more information about what you're doing. How you're measuring the latency, how / what is sending SRT, and to where, and who is consuming (viewing).
Might also want to try a tracert to see where the latency is coming from
If it's external there isn't much you'll be able to do
I would bet money that the latency is coming from the reading side (ingest/decode), buffering input. Its extremely common to have a sizable buffer to handle variance, re-ordering, udp etc. If you have a fairly trustworthy connection and protocol, this can be slimmed down substantially with limited downside (unless the path craps out of course)
do you have SRT latency parameter set on either side? connection negotiation will use bigger one of those. if nothing is specified, SRT default of 125ms is used
no have not been using latency parameter. will it help if caller has bad connection? listener has 1gb port
yes. it gives bit of time for SRT to resend dropped packets
try 2 seconds at first. increase to maybe 5 with few steps if that doesn't work
should be like ?latency=2000 as far as i remember srt syntax?
yes but most clients/servers use microseconds so 2000000
if url has already ? somewhere you need to use & instead
ok, thank you! will test this! listener do not has any other parameters or there are some useful I should try to use to get better performance for client with unstable internet?
no need for other parameters for now. you can set most of the SRT parameters on either end and caller/listener will negotiate best value to use on connection handshake
there are some parameters to make reconnections happen bit faster but latency has biggest impact
Thank you! Will test this asap
Ok, so with ?latency=2000000 for srt source I will have 2sec delay and if I will use discord audio it always will be ahead of srt source for 2 sec? So i can just delay it for 2 sec (i believe for obs it will be -2000 in audio source settings?) and srt sound and discord one will be sync all the time? (I remember NDI delay was inconsistent and could become more over time, srt does this or it consistent 2 sec if latency param stays for 2 sec?)
what are you doing with discord? it wasn't mentioned in first message
maybe write longer description what you are trying to achieve
srt will serve game and game audio and discord will serve camera and mic
in LAN or over internet?
in LAN you can probably use way lower latency. on wifi 200-300ms is ok
i've used SRT on mobile internet stream delivery so my brain made sone assumptions too quickly 🙂
Should specify that callers will be not from my network. I will use srt for hosting events not for personal streams
ok. SRT latency stays same and drops frames if it's about to run over. adding audio/video latency in OBS via filters should keep them mostly in sync