How do you stream an online game without getting lag in the process?

Streaming lag might come from different sources.

  1. Processing lag. The video encoding takes to much resources on your computer, monopolises CPU or disk Input Output.
  2. Uploading lag. The video takes to much size and reach the upload limit of your connection.

The second is most likely to create high pings.

To reduce the effect of 2. you need to compress more, requiring more processing power and might increase 1. This can be done by tuning the codec settings (encoding profiles and such).

The only way to reduce 1. and 2. at the same time is to downscale the video, or reduce the number of frame per seconds recorded. This will reduce the quantity of information to encode and therefore the necessary size to transmit. Obviously the quality of the stream will decrease as well, but you can't get all at the same time.

Another way to get better streaming quality would be increasing your processing power (CPU, disk speed, GPU maybe) and your connection bandwidth.

Edit: Tip, if you have NVidia Graphic Card of good quality, there is the opportunity to use NVEnc as your encoder, this uses the GPU to process encode the video, and provides a huge improvement in performance, since the card already processes some of it for display already. It will also lighten the charge of the CPU.


To put it simply, you're always going to get some kind of lag when you're streaming. Ping, in this case, is not directly affected; it's influenced by your remaining bandwidth while you're streaming.

How much lag depends on your upload speed and your stream's bitrate. For example, I have a 1 Mbit/s upload speed, and everyone in my house suffers when I'm trying to upload a YouTube video because uploading files always uses as much bandwidth as possible (by default).

Streaming, on the other hand, is first encoded by either variable bitrate (VBR) or constant bitrate (CBR). In variable bitrate, you're selecting a quality (from a range of numbers) or constraining the bitrate by a maximum and minimum. This works when the stream doesn't need all of the bandwidth, but if you're moving around a lot, then your stream's quality will suffer greatly. In constant bitrate, you're just telling the encoder what bitrate you want. That's it. The bitrate is more stable, and the encoder will take advantage of any bandwidth left over (thus increasing quality, but be aware that some of those bits are actually stuffed ones). But back to the question.

You'll want to set the encoder for OBS to CBR and lower your bitrate so that it's about two-thirds or three-fourths your upload speed. I'd set it between 512 Kbps to 768 Kbps in my case. That way, your game will have plenty of bandwidth left over to send packets to the server and download player states back to you.

(I'm not exactly sure how ISPs bottleneck download and upload speeds, but I'm guessing that your download and upload are summed together and throttled down if needed.)


A couple other options not mentioned.

1) If you have an nVidia card, use their Shadowplay utility instead of OBS. It encodes using the video card hardware and streams directly to Twitch, and will probably improve your performance.

2) If your router supports it, turn on QoS (Quality of Service). Set it up so the stream to Twitch is placed at the lowest priority, and possibly a capped upload rate.

Tags:

Streaming