Thursday, August 6, 2015

How to Stream on a Potato

There are main factors that determine Twitch stream quality: bitrate, resolution, encoding quality, and frames per second. Each of these has upper limits and in theory you get the best quality by maximizing each one. In practice, it's a more complicated balancing act. The Twitch recommended settings and the settings suggested by the OBS Estimator are okay but definitely not optimal.

Streamers, Know Your Limits


The first step is to find your system limits. For bitrate run the upload speedtest at [1] Record that figure. For more accurate results, you can run the test multiple times and record the lowest figure and/or average.

Here's my connection. The average is 13.4Mbps up but the important figure is the lowest connection speed which was 7.56Mbps. 

Twitch recommends a maximum upload bitrate of 3500kbps (3.5Mbps) so if your minimum result from is higher than that, congratulations, set your bitrate to 3500kbps and move on to the next section. You can set it even higher but Twitch's ingest servers can only accept a maximum of around 8000kbps and setting it higher than 3500 is allegedly considered abuse. I personally stream higher than 3500 but there's a risk of getting shut down by Twitch.

If your minimum bitrate is below 3.5Mbps, say 2.7Mbps, set your OBS bitrate to slightly under that, e.g. 2.5Mbps (2500kbps).


The limit is the resolution of your monitor. You can usually find out this information by right clicking on your desktop and examining the display settings but I recommend using Speccy by the company Piriform. It's free and provides all your relevant computer specifications in a very easy way. Your resolution can be found in the graphics section. If you game at below your monitor resolution for performance reasons, then that is your resolution limit. Most of the time, however, monitor and game resolution are the same.

Here's my Speccy. You can see my resolution is 1920x1080

At this point in time, given that 1080p is the most common resolution, and given that the video window in Twitch while having chat sidebar viewable is only around 720p, and given that Twitch only allows a 3500kbps bitrate, the highest streaming resolution I'd recommend - no matter your system - is 720p. For people gaming at 1080p, this means an OBS downscale of 1.5, but if you are gaming at some other resolution, you will want to adjust the downscale to the one closest to 1280x720. [2]

Encoding quality 

This is the trickiest one because it depends on the game and your CPU.
The first thing to do to get useful measurements is to set your computer to high performance mode. In Windows, press the start button and search for "power options". Set it to "high performance" which might only be viewable by clicking "show additional plans". Remember to set performance back to balanced after you find out your CPU frequency
The next thing to launch Speccy and click on the CPU tab at left. Record the model, number of cores, and the frequency they are running at towards the bottom. [3]
For Intel processors my starting recommendations are:
8 cores+ @ 4GHz or higher, slow
Haswell or later, 6 cores @ 3.7GHz or higher, medium 
Sandy or Ivy 6 cores @ 4.5GHz or higher, medium 
Older 6 cores or 6 cores running at lower frequencies, fast 
Haswell or later 4 cores @ 4.5GHz or higher, faster 
4 cores that do not meet the above, veryfast 
2 cores, Quicksync/VCE/NVENC or veryfast with higher downscale
For AMD processors my starting recommendations are:
8 core FX series, 6 core Phenom, faster 
6 core FX series, 4 core Phenom, veryfast 
4 core FX and under, Quicksync/VCE/NVENC or veryfast with higher downscale

Frames per second 

This is hard limited by your monitor frequency which can be found next to the resolution of your monitor in Speccy. It's not really important since nearly all monitors built within the past decade are 60Hz or greater and Twitch and Flash player don't work well past 60fps. In-game frame rate can impose additional limits. To check your in game frame rate, you can install FRAPS, or for Steam games use the FPS counter found under settings > in-game and set fps counter to on. I prefer using the RivaTuner Statistics Server (RTSS) which can be modified to provide additional useful information but it's more complicated to setup.

Here's a view of FRAPS. While playing the game you would hit F12 to see your in-game fps.

Nearly all monitors in use today are 60Hz which means that setting video fps higher than 60 is pointless. If your in-game fps is higher than 60, set streaming video fps to 60. If it is lower, then set streaming fps accordingly. This also means that you will want to change the video fps on a per-game basis for best quality. 
For instance, I get triple digit framerates in Killing Floor 2 so I set video fps to 60 in that case. However in ARK I get around a 45-50fps minimum so I set my video fps to 50. In ArmA the minimum framerate varies from around the 20s in large cities to over 60 elsewhere. You'll have to decide for yourself but in general, I would err on the side of more frame rate. In that link you can see the difference between 30 and 60fps. Some members of the OBS forums believe there isn't a big difference, especially for streaming, but they are wrong. Even if you can't manage 60, even 40fps is a 33% improvement in smoothness over 30. This is also the reason why some streamers enable motion blur, it makes motion look less jittery. Try that if you are unable to maintain a high in-game fps.

Performance Issues 

Preliminary checklist before adjusting stream settings:

  • Close the stream while streaming
  • Make sure your computer is plugged in and power set to "balanced" or "high performance"
  • Reboot your computer and/or router
  • Make sure you are using Game Capture in OBS.
  • Make sure you have selected a fairly nearby ingest server. You can use JTVPing to help find the optimal one or you can just select them manually.
  • If you are using a 2 core processor, turning off multicore rendering can help (or use affinity - to be covered later)
  • Check for thermal throttling with HWiNFO64 though good cooling is always advisable as by default, Intel CPUs will only go into Turbo mode if temperatures are low enough.

You can find out if your encoding settings are too high by examining the OBS log files.
OBS Log files can be found by typing %appdata% in the search box in Windows. Hit enter, then navigate through through roaming > OBS > logs. It might be a good idea to create a shortcut to this folder. Just sayin'
You must close OBS to view the logs for the current session and hit "Ctrl F" to open the "Find" box. Search for late and you will find a section that tells you: frames skipped due to encoder lag, total frames duplicated and number of late frames. If any of these values are above 1%, your stream settings are too high. Tabbing out, messing with in-game settings, etc. can increase these values so testing multiple runs of at least 5 minutes is a good idea.
If you started and stopped your stream multiple times, there will be multiple sections showing duplicated/late frame information. There are time stamps to help you identify each particular section. 

  1. Lower your encoding quality one step but do not lower it below veryfast. If you are at veryfast or using Quicksync/VCE/NVENC then
  2. If you are using Quicksync, under Advanced options, change the Preset to lower quality (with 1 being the highest). If you are at the lowest quality Preset then
  3. Lower your streaming fps gradually. Personally I think 30fps is a minimum and if you have it set there then,
  4. Increase your resolution downscale an additional step (so from 1.5 to 2 for example). If you are at the maximum 3x downscale then
  5. Decrease in-game resolution, so if you are playing at 1080p, try playing at 720p. If it is smooth, try increasing quality gradually through reducing resolution downscale 

End Notes

[1] The reason I prefer over is that is single threaded which is a more accurate representation of actual upload speed for Twitch.

Here are my results which you can see ranges from a low of 7.4 up to 23.7Mbps. My service is plan is 35Mbps upload but you can see the average is less than half that. However if I use Speedtest, my upload is reported as the full 35Mbps. To avoid dropped frames, I should set my maximum upload to 7.4Mbps. However, as Twitch recommends 3.5Mbps maximum, I can feel confident that if I set it to 3.5Mbps, I will not drop frames because of my connection.

[2] There are a handful of streamers with very powerful setups who stream at 1080p60 medium/slower which seems like the ultimate quality but it is not. ipengineer78 and Edgar stream at 6Mbps, and Widgitybear even less. Motion suffers from horrible artifacting. At these low bitrates, artifacting (macroblocking, smearing, and quality pumping) are very noticeable. They are significantly reduced at 720p.

When Twitch allows 20Mbps streams, 1080p60 medium/slow will offer better quality, even for viewers watching in a 720p window, because of detail and chroma benefits from downscaling. But until then, 720p60 is the gold standard.

1080p60 @ 6Mbps and any compression setting will have very good per pixel sharpness when there is no motion, however. This renders things like HUD detail exactly which can make it seem like you are playing the game and is great for screenshots. During high motion scenes, this illusion gets shattered and personally I think it better to have 100% of your frames at good quality than 95% of your frames at mediocre quality and 5% of frames at high quality.

The following is a sample of Edgar's stream who runs at 1080p60 medium/slower @ 6Mbps or so.

His game name tag is very crisp; certainly more crisp than 720p would be. Would you say this is in HD quality? No. 720p would be a large improvement, but even on the slow preset it would still be distinguishable from actually playing the game. To achieve the complete illusion of being in game for 1080p60 would require more than just bitrate but HEVC encoding as well, something unachievable even with the ten thousand dollar dedicated dual-Xeon setups the previously mentioned streamers use. Don't get me wrong, their streams are high quality, but 1080p60 is not optimal.

[3] Games will use one or two cores which drastically affects processing power available for video transcoding.

Essentially an i3 and most laptops have only one core available for transcoding which means hardware encoding (Quicksync, VCE, NVENC) is the best option here. A typical desktop i5/i7 has three cores available for encoding which represents 200% higher performance. This is on top of the frequency advantage desktops enjoy which can be substantial over power saving parts.

It is simply not enough to say that an i5 is enough for veryfast 720p60. Someone I know streaming an FPS (CSGO) on an i5-4200U can only do it at 306p30 and Savage Lands at 256p30, even with Haswell's speedier version of Quicksync. Changing from Preset 4 to Preset 7 worked and allowed 512p30 in CSGO. Savage Lands even at 256p30 and Preset 7 fails.

I'll try to revise the frequency recommendations occasionally since new x264 releases bring better performance and ability to take advantage of newer instruction sets. In theory, x264 or Handbrake benchmarks should reflect the type of work OBS is doing but they aren't quite the same. Haswell and later chips are better suited for streaming, ceteris paribus, on account of AVX2 instructions and that is not reflected in those benchmarks.

Revision History

August 6 2015 - Initial post
August 7 2015 - Added Quicksync/fps specific info for high encoding problems

If you are using Quicksync, under Advanced options, change the Preset to lower quality (with 1 being the highest). If you are at the lowest quality Preset then

Added fps reduction as a step to increase streaming performance

Lower your streaming fps gradually. Personally I think 30fps is a minimum and if you have it set there then,

Recommendation for cooling on account of throttling/Turbo parameters

Sep 1 2015 - Can confirm that at 3.2GHz with hex core, 720p60 fast works but medium skips around 15% of frames

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.