Question / Help Does a slower x264 preset mean more stream delay?

chimeratx

New Member
Hello. Just recently I've selected Twitch's beta low-delay stream option, to check it out and see if anyone has any trouble with it. It seemed fine, and the delay seemed a little lower, like 2-3 seconds, which is good but not as good as I expected. I then raided a fellow streamer and he also has that option on, but on his stream the messages seem to arrive almost instantly. The differences between me and him are that he streams at 30fps and I stream at 60, and his x264 preset seems to be faster than mine, which is on slow. I know the processor "takes more time to encode" on slower presets, but I thought that it attempted to deliver the video on the same time always, thus causing increased processor usage. I've been thinking if perhaps I assumed wrong and that it actually DOES take more time to deliver the video on slow instead of veryfast, and that's why his delay is way lower than mine when using the low-delay option. Any other explanation for why my delay might still be relatively long is very welcome, in case this one doesn't fit. Thanks in advance.
 

Suslik V

Active Member
Delay you talking about not related to encoding preset.
The major difference between presets is ultrafast in comparison to all others (because only it has no B-frames). The delay is important if you making video calls: the delay of 0.3...0.5 sec begin noticeable. And while only 2...3 B-frames mostly used, it can't do delay even like 1 sec long, I think. For 30fps you have room in 33ms to get the encoded image. CPU has high frequency and it can do it in 15ms, for example. But B-frames requires to wait for 33 + 33 + 15ms (third frame encoding) and only then begin the encoding of first two for 15ms each (for example only) thus the frame will be delayed to 96ms instead of 15ms.
 

koala

Active Member
96ms instead of 15ms is negligible, if you see delays of 2-3 seconds (1 second is 1000ms).
If you have a delay of 2000ms (2 seconds) or 2096ms (2 seconds plus 96ms), you cannot tell while watching a video. It feels the same.
So if chimeratx has a delay of 2-3 seconds while his friend's stream is "almost instantly", there is another source of delay, which is not the OBS encoder settings.

Perhaps some transcoding is taking place at the streaming service.

And according to the twitch documentation about the low delay mode, it is implemented by reducing buffering at the streaming service while still trying to deliver a continous stream to the clients. Smaller buffer means less latency. Perhaps the twitch servers analyze the network connection between the stream source (you) and itself, and if the stream isn't as continuous as it should be, it increases the buffering automatically to ensure a continuous stream to the clients. And this means higher delay again regardless of the low delay mode. But this is only a guess, I don't have any insight into the inner workings of the Twitch streaming servers.
 
Top