Tech, eSports, and Gaming!

  • Facebook
  • Twitter
Posted by Mike ApocTV - - 40 comments

I get asked all the time about my stream and how it's quality is so high.  In a future post I may explain my specific setup, but for now this post will attempt to explain what factors affect your stream quality and hopefully provide some insight on to what you should be looking at when you configure your stream. I'm not going to advocate any particular way of streaming since there are too many factors to consider, but hopefully this provides some basic information on to what you should be looking at when configuring things.

There are three main factors when streaming:

  • Quality
    This is how your stream looks to your viewers.
  • Bandwidth
    The "internet power" your stream uses. Streaming requires a high upload bandwidth for best results.
  • CPU Usage
    If you're playing SC2 or another game on the same PC as you're streaming on, you have to balance it so neither your stream nor the game starts suffering from lack of CPU power.


Quality
It's important to note that quality is not directly related to any single factor - eg cranking the resolution to 1080p and claiming that's the best possible quality is simply not true. There are many factors involved with how good your stream will look. Here are some:

  • Codec
    Most streaming software uses either H264 or VP6. The codec is a piece of software that converts the 50MB+/sec of raw image data into a compressed video format suitable for Internet data rates. H264 / MPEG4 is the more modern codec. However there are many implementations and variations in the way codecs can be programmed, such that some encoding software is better than others despite using the same standard.

    Popular software that uses H264 includes Adobe Flash Media Encoder and XSplit. XSplit uses the x264 encoder which is regarded as being the highest quality whereas FMLE uses MainConcept. VP6 is an older codec that is available to users of Adobe Flash Media Encoder. It requires a higher bitrate (more upload) for the same quality, but has some benefits in that it recovers from scene changes faster than FME's H264.

    It's also worth mentioning under the Codec section (but really it's a software issue) that XSplit's internal source scaling will always result in a blurrier output than a Adobe FMLE stream due to a scaling bug in XSplit (Hi SplitMedia please fix this, I've sent in a bug report already!). This becomes very noticeable if you have text or other sharp elements on your stream and is one of the main reasons I personally dislike XSplit.
    2011-08-18: XSplit's scaling issue is fixed when resizing from the same aspect ratio to the same aspect ratio.  Example being 16:9 resized to 16:9.  However, if you resize from a 16:10 source to 16:9, the scaling bug is still there.
  • Frame Rate
    The higher the frame rate, the more frames the codec will need to process and the smoother your stream will look. A good frame rate to target is around 25 FPS. Some streamers use 20 FPS and as long as it's a consistent 20 FPS this is fine, however below 20 FPS your stream will become noticeably jerky and unpleasant to watch. Going above 25 FPS does not yield many benefits while taking additional CPU to encode.

    The main thing to aim for with the frame rate is consistency. A consistent frame rate is good, a frame rate that jumps up and down is very noticeable and annoying to a viewer. Frame rate correlates pretty directly with the codec - the quickest way to reduce CPU usage if you're having trouble is to reduce the frame rate as a 20% reduction in frame rate results in 20% less work for the codec.
  • Resolution
    While you may think the higher the resolution, the better the quality will be, this isn't necessarily true. Very few people will have the CPU and Internet bandwidth to support a high quality 1080p (1920x1080) stream at a decent frame rate. It's much better to have a lower resolution stream at a steady and consistent frame rate than to try and push the resolution as high as it goes.

    Codecs work on a variable bit-rate and more complex scenes can require more time to encode. While your stream might seem fine at 1080p@30FPS while looking at the SC2 menu, come a big battle and you may find your stream turns into a slideshow as the codec can't keep up with all the data.

    Try to pick sizes that are exact 2:1 reductions for best quality, eg if your SC2 is at 1680x1050, try streaming at 840x525. To change the resolution you can either set your SC2 to play in a lower resolution or set your streaming software to resize the input / output. Generally though you will want SC2 to run at your native monitor resolution with either a full size or half size resolution for your stream.
  • Bitrate
    The bit rate is the approximate amount of kbps that the codec will try to produce. However the H264 format is a variable bit rate format, so even if you specify 2000kbps, if the codec tries to encode something and it happens to come out at 2500kbps for that particular instant, it's going to either use it or drop it. It's important to pick a bit rate that is well below the maximum upload speed of your Internet to account for bursts like this. If you have 2mbps upload and stream at 1900kbps, come a burst of 2500kbps your stream is going to lag or drop frames (both equally bad).

    Lagging can become cumulative to the point where if your upstream never manages to recover and "catch up" to the live point in the stream (eg an average of 2.1mbps trying to go out of a 2mbps upstream), your stream will simply not work. Dropped frames are also bad as if a key frame is dropped, it can take 5 - 10 seconds before another key frame is generated, during which time your viewers will have no video.

    On the flip side, too low of a bitrate and your stream will look terrible. Codecs can't work magic - it's impossible to turn 1920x1080 @ 25FPS into a decent looking 1mbps stream for example.

The above four factors are the most important things to consider when setting up your stream. Some streamers prefer a higher resolution with a lower frame rate. Others take a more conservative approach and use a low resolution with a high frame rate and bit rate. This is actually very good option to start with since it guarantees no bitrate quality issues and doesn't usually use much CPU. I would personally recommend going for the lower resolution with higher bitrate/fps, it will look better.

Bandwidth
I've touched on the topic of bandwidth in the quality section, but it deserves its own section for clarity. First of all, streaming is tough on your connection. Any packet loss or jitter can cause your data to arrive late at the streaming provider which will discard it due to the timestamp being late. Worse still, your throughput may be reduced by retransmissions to the point where your stream buffer backs up and no new data ever makes it to your viewers.

When determining your bitrate, a good rule of thumb is to leave about 25% of your upstream unused. If you have a 2mbps upload speed, set your stream bitrate to 1500kbps. This leaves enough room for the occasional burst of data from the codec as well as for background applications such as any VoIP software and of course SC2 itself.

When determining your upstream speed, it's important to perform a realistic test. If you go to www.speedtest.net and pick the closest server to you, you're not going to get a realistic result. For users in the US, I would suggest picking a server on the East or West coast, whichever is furthest from you as a good baseline. If you're still using Windows XP, you will need to apply some registry tweaks to be able to get good performance to sites with higher latency, but that's beyond the scope of this guide.  Maybe a future guide. :)

Depending on your connection type, your upload speed may vary during the day as more users get online. Crowded cable networks and especially using wireless can be a big issue. Run tests at the time you would usually be streaming for accurate results. One final thing to keep in mind is some ISPs offer "boost" technology where for the first X seconds of a transfer, upload/download limits are relaxed slightly to provide for better looking results in speed tests.

For those of you on capped connections with a limited amount of transfer per month, you may want to avoid regular streaming. It can very quickly add up to a lot of bandwidth and may cost you additional fees from your ISP.

Finally, keep in mind that when you set your bitrate to X, your viewers need approximately X + 500kbps for a reliable streaming experience. If you can upload at 10000kbps then that's great, but don't expect many people to be able to watch your stream. (Side note: Justin.TV provides a service to transcode your stream into a lower resolution / bitrate if you are a partnered account. Contact them for details.  With this you can pump your bitrate as high as you want and still be optimal for everyone.)

Here's some very rough example bitrates you should be looking at for a nice quality stream at 25 FPS (these will vary depending on encoder used and other factors, with XSplit you can get away with a lower bitrate for the same quality for example):

480p (720x480): 750-1000kbps
720p (1280x720): 1500-3000kbps
1080p (1920x1080): 3000-5000kbps+



(note: 1080p can fully utilize 10,000kbps+)

Most of you will not be playing in a resolution that matches one of these exactly, so you'll likely want to resize your stream down to a matching aspect ratio.

CPU Usage
Here comes the fun part. Streaming requires lots of CPU. So does SC2. If you stream at too high a quality, both your stream and your game will start to lag. You need to find a balance between quality and how much the stream impacts your game performance.

First, if you have anything less than a quad core processor, you may as well forget about streaming in any kind of decent quality for now. SC2 itself can easily almost max out a dual core CPU, leaving no room for streaming.

Ideal CPUs:
Core i5 2500k / i7 2600k
Core i5 / i7 8xx / 9xx Series
AMD Phenom X4 / X6



*I personally use an i7 950 overclocked to 4.4ghz.

Unfortunately anything less than these including older Core 2 models are showing their age and you won't be able to reach the best results. Streaming and SC2 are extremely CPU dependent, your graphics card has a very minimal impact on things so don't go out and buy an expensive GPU in the hope it will fix things.

The codec you choose (which is influenced by which program you stream with) has a very big impact on CPU. Adobe's Flash Media Encoder has a pretty standard H264 encoder but it uses a lot of CPU. One benefit is that is multi-threaded, meaning it can take full advantage of multiple cores and benefits from i7 CPUs. XSplit on the other hand produces a higher quality output but appears not to benefit from multiple cores very well, so your CPU speed becomes a factor (one reason why the 2500k and 2600k work so well is they can easily hit 4.5+GHz with overclocking). There are other programs such as VLC (very difficult to setup) and Dynno (suffers from macroblock artifacting) but the two main programs most people will be looking at are XSplit and FME.

2011-05-21: If you use XSplit, make sure you check out this thread. It's essential for multi-core in XSplit.  SplitMedia claims they have included the updated x264 library in their latest T3 version, but I've tested it and this just isn't the case.  Follow the instructions in the link, it will help a lot.

2011-08-18: XSplit has updated the x264 library.  The above fix is no longer needed!

How you get your SC2 into the streaming program also has a big impact on CPU usage and in-game lag. Most screen capture options such as XSplit's internal capture and VHScrCap use a significant amount of CPU and rely on GDI which causes your game to lag even if your CPU isn't near maximum. The best option by far is to use DXTory which rips the screen directly out of your video card after it has been rendered by intercepting DirectX calls. This has almost zero overhead associated with it, however DXTory is not free - it will set you back around $50 and will not allow you to capture anything other than games. The next best appears to be SCFH, a GDI based screen capture. Even if you use XSplit, you aren't forced to use XSplit's internal capture - you can easily add a camera source of DXTory or SCFH.

Programs such as XSplit offer a virtual set where you can add overlays and other effects. Keep in mind - especially if you use transparency - that the cost of these effects can add up in terms of CPU usage. High-quality resizing is also an expensive operation for CPUs, so for the lowest possible CPU use, try to match your screen size with your stream size (XSplit users can ignore this since XSplit seems to scale everything regardless of it matching the output size).

Something you will want to do is to address your core loads.  You have two options to do this.  You can set your affinity on your cores so that your streaming program and SC2 run on separate CPU cores or you can set SC2.exe (or whatever game .exe) to High Priority in task manager or whatever application you use. Keep in mind that each person would determine the better option for their setup.  If your game only uses 1 core, then you will want to set affinities.  If your game uses more than 1 core AND each core isn't used at 90%+ cpu usage, then you will want to use the High Priority method.


Another thing if you use Vista / Windows 7 to do is to disable Aero (the fancy translucent desktop effects etc). To do this, right click on the shortcut to your streaming program or SC2 and under Compatibility, tick the "Disable desktop composition" box. This especially helps when using GDI capture methods.

Final Thoughts
One reason I like to use Adobe FMLE over XSplit is the status window. XSplit offers you pretty much zero feedback - it doesn't tell you the current FPS, whether there is any local buffering, if there are any input or output dropped frames, etc. It's pretty much just luck - try some settings and see if your stream lags, if you get buffering just restart and hope it's better, etc. FMLE on the other hand offers you very useful statistics - dropped frames, current bitrate (remember it's variable) and more.

Input drops mean your capture source such as DXTory or SCFH isn't providing input fast enough - this can happen in big battles where your SC2 FPS drops below your desired stream FPS. Output drops are the ones to watch for - this means output frames were dropped because they couldn't be encoded in time. Any amount of output drops means your stream will lag and you should re-adjust your settings. If you see publishing buffer or frame drops at non-zero values, this indicates your upload is too slow or the connection to your streaming service is failing.

Remember to test things with a realistic load - simply looking at the SC2 menu is easy for a codec to encode and won't provide accurate feedback. Watch some replays and move the camera around etc (but don't run replays on 2x or higher since that will use more CPU than a realistic game).



As a final note, I want to make sure you guys know that either FMLE or XSplit are perfectly acceptable solutions.  Each have their own strengths and weaknesses and will require being setup properly.  I may update this guide in the future with additional separate sections for FMLE and XSplit that explain specific detailed settings that are optimal.




Source(s):
R1CH from TeamLiquid

40 Responses so far.

  1. gman says:

    i still have yet to look at some of your vids, i can't at the moment due to lack of quota. but im very keen to see what your take on sc2 strategy is

  2. Dejch says:

    thanks for the info

  3. OG_Merlin says:

    This is a lot of useful info. I had to study it for a little. Thanks.

  4. fit4life says:

    a bit too much text, try breaking it up into different posts, adding more pictures, and getting a brighter layout :) and thank Bananaconda for me.

  5. phosports says:

    thanks for the information, ive been wanting to start recording my sc2 gameplay. maybe i should now, it doesnt sound that difficult

  6. Bj says:

    Thanks for the information man! really nice post!

  7. retrak says:

    xstream keeps saying my password is wrong, even though i've reset it like 5 times :( otherwise i'd try megalive, looks pretty decent.

  8. R.C says:

    Yes! I always wanted to know how to do this! Thanks.

  9. Insider33 says:

    Awesome guide, dude.

  10. Zach says:

    Great writeup. I haven't tried live streaming before but this will certainly help if I do!

  11. Bart says:

    Wow! this looks like it's very useful =D Awesome guide!

  12. Carles says:

    nice guid, and good stream

  13. R.C says:

    Now I'm just trying to think of what I should livestream about!

  14. #19 says:

    This is one of the better guides I've seen out there, very informative.

  15. Serions says:

    Sweet guide man, I've been trying to get a good streaming setup for ages.

  16. Liked the post! Useful! Thanks!

  17. cheshire says:

    Great post as usual apoc ;>

  18. Dola says:

    very nice insights =)

  19. Stephen says:

    Thanks for the guide. Unfortunately, my upload speeds are way too low for high quality streams :(

  20. very interesting read

  21. logo mess says:

    wow great guide, didnt knew that streaming is so intensive!

  22. Equality says:

    Nice post, very informative. Thanks!

  23. Interesting and informative article. Thanks for posting and great blog!

  24. Oh_B_City says:

    Bleh! I just need better CPU cause whenever I stream my FPS drops so low it's unbearable

  25. Thanks man! I always wondered what I needed in order to do this :D

  26. Anonymous says:

    I had been wondering why when i wanted to stream my HoN matches to friends this sucked. Thanks!

  27. Anonymous says:

    Great information. Can't wait to see more from you

  28. Insider33 says:

    This is an amazing guide!

  29. that's a lot of info! niiice

  30. Anonymous says:

    I'm quickly becoming a fan of your site Apoc! Your guides are excellent, thank you.

  31. 321jurgen says:

    I gues I'm okay to do every resolution I want because I got better specs on my computer and my upload speed is 40 mb/s if I test it.

  32. moosehuntsU says:

    This was helpful but what i need to know is how and what do i need to ro live streams

  33. Saebra says:

    Well on behalf of the people too worried about their personal interweb stardoms to say thanks....thanks man!

    Solid article. goodluck

  34. Anonymous says:

    There's also another program that is starting to gain some ground that I like a lot called FFsplit. If you do end up creating separate sections for Xsplit and FMLE, could you add one for FFsplit as well?

  35. Anonymous says:

    Don't listen to the kid who posted below me. He's trying to advertise his own live software.

  36. Very nice guide, thanks for the time to write it - found it quite helpful.

Leave a Reply