OBS Streaming Tutorial

Once upon a time streaming was a complex process that involved high end computer hardware, bespoke capture equipment, and immensely complex server farms to finally deliver a low quality video stream that left even the most avid of ASCII art fans in want. But no more! Through a combination of amazing open source software, the proliferation of streaming sites such as Twitch.TV, Own3d.tv and Ustream, and the constant march of innovation in the hardware sector, it is easily possible to send a gorgeous looking HD stream to thousands of viewers across the globe with nothing more than a reasonably good internet connection and a modest gaming PC.

In this upcoming series of tutorials I’ll be breaking down the jargon and explaining everything you need to know and do to produce a great looking, lag free stream.

 

Some Quick Theory

Streaming is pretty complicated. There’s no perfect settings or configuration and many aspects come down to a matter of personal preference. What I’m going to do here is give you the most concise possible explanation of the key numbers and parameters that you need to decide upon when setting up your stream. So first off, a quick glossary:

  • Bitrate: This is the amount of data per second that the stream sends. In the context of live video/audio streaming, bitrate is almost always expressed in kilobits per second. You should always assume this unless stated otherwise.
  • Resolution: This means exactly the same as it does in context of games and monitors. It’s the size of the video expressed in the pixel width/height. Most popular streams are 720p (aka, 1280×720), while some might even be 1080p (1920×1080).
  • Aspect Ratio: This is the “shape” of the video expressed as a ratio between width and height. For example a square has an aspect ratio of 1:1 because its width and height are equal. 2:1 would be a rectangle twice as wide as it is tall, and vice versa 1:2 would be twice as tall as it is wide. 16:9 is the standard aspect ratio of widescreen video resolutions such as 720p and 1080p.
  • FPS/Frame Rate: A video is simply a series of individual images, and this refers to the number of images per second. Most online video has a frame rate of 30fps (Frames Per Second). Almost all computer monitors have a frame rate of 60fps, while some higher end gaming monitors have a frame rate of 120fps. In the context of monitors, “frame rate” and “hertz” are almost entirely interchangeable terms. I feel I should note at this point that the idea that the human eye doesn’t notice above 15/20/25fps is a myth with a mountain of evidence to the contrary.
  • h.264/x264: h.264 is the video codec that is typically used for modern online video. This is almost without exception in the world of live video streaming. The x264 encoder is a piece of open source software that encodes video in the h.264 codec. To use an analogy, h.264 is the piece of music while x264 is the musician who will play it.
  • CBR/VBR: Constant BitRate and Variable BitRate refer to two different approaches of encoding video. With the CBR method, the encoder is given a target bitrate which it will attempt to encode the video at regardless of the resulting quality. With VBR, the encoder is given a maximum bitrate and “quality balance” value. The encoder will then try to encode the video as best it can with the available bitrate, while the quality balance value determines how much of the available bandwidth it should try to use. For example with little movement on screen and a quality setting of 6, an encoder may only use 500kbps, however when there is a large battle on the screen it may spike up to its max bitrate of 2500kbps. VBR is king for quality, but CBR offers a lot of other benefits that make it ideal for streaming games. It’s worth noting that Twitch.TV are actually encouraging their users to use CBR as its mutually beneficial for both the streamer and Twitch themselves.
  • Delta Based Encoding: This is a slightly more technical term. “Delta” in mathematics essentially refers to the difference between two values. If you know the first value and the Delta, it is possible to find the second value, and if you know both values, it is possible to calculate the Delta. In the same vein, a Delta based encoder works by calculating changes from Frame 1, to 2, to 3, and so on. h.264 uses a delta based approach to encoding video.
  • Encoder Preset: This is a specific feature of the x264 encoder, but it’s important to know. For lack of a better expression, this describes the amount of “effort” the encoder should put in. Setting a slower value will make it dedicate more CPU power to finding the optimal descriptors while results in a better overall video quality.

 

So now that we’ve hopefully busted some jargon we can get on to explaining how on earth this stuff actually works. If you were being attentive, you might have had a couple of moments reading that glossary where things just clicked and made sense. It’s important to remember that every single value here matters.

The key takeaway from the bit about Delta Based Encoding should basically be: More Bitrate = More room to record detail about changes = Better Video Quality. If you use CBR, the amount of room to record those changes is constant, while if you use VBR it can varied so that smaller changes from frame to frame are described with less bits, leaving more room for when you have frames with larger changes. By using CBR, the amount of CPU power used by your streaming software becomes a constant allowing Windows to balance the share of CPU time between your encoding program and the game itself much more efficiently, which to put it short, means that your game performs better and is affected less by the fact you’re streaming.

You can sit all day and describe what these things do, but ultimately how they work together is what matters. There is a trifecta of quality that encompasses Bitrate, Resolution and Frame Rate. Every other setting can be changed to suit the particular values used, but the balance of these 3 settings is ultimately what determines the quality of your stream. High Resolution/High Framerate/Low Bitrate will look extremely blocky and pixelated, Low Res/High Framerate/High Bitrate will make text unreadable and detail unnoticeable, and High Res/Low Famerate/High Bitrate will make it feel like watching a high quality gif.

A good policy is to work out what bitrate you can/will stream at (anything in the region of 1500-3000 based on your PC specs and internet speed is a good number) and then play around with the resolution/frame rate until you find a good balance. As a rule of thumb, 720p/30fps is your baseline, and anything beyond that is a bonus. For FPS and other games with a lot of movement, the extra smoothness that comes from streaming 720p/60fps can make your stream much nicer to watch. For games with a top down video such as SC2/Dota 2/LoL/etc, the extra image detail given by doing 1080p/30fps is often preferable. The other option however is to simply leave it at 720p/30fps and let it make use of the extra bitrate to make your stream look incredibly crisp. After much experimentation in the SC2 and Dota 2 scene, an unspoken consensus has been reached on that last approach. It is however by no means the best and you may find you prefer one of the other options. To steal a phrase from the Starcraft scene, We don’t have the technology to stream at 1080p/60fps reliably. While higher end machines today are fully capable of it, doing so requires a bitrate of 4000+ which no current streaming platform is capable of delivering reliably to a large audience.

As a final note, Audio.

Audio is something that few people will notice or pay attention to, but if it’s not good, it will be noticed. I personally feel the best approach to audio is to use a reasonably high bitrate entirely regardless of what bitrate you are using for video. The reason for this is that “high” in the context of audio is an order of magnitude less than it is for video. Using the AAC codec, anything in the region of 96-128 bitrate will give crystal clear audio. On simple cost benefit analysis, it’s worth it. The difference between streaming video at 2000 and 2050 bitrate would be almost indistinguishable in a blind test, but the difference between 48 and 96 bitrate on AAC audio is so huge that even your grandparents would notice.

 

OBS Itself!

Congratulations! If you’re still digesting the above information (I wouldn’t expect anyone not to be after reading something that information dense), then you’ve already done most of the hard work. The difficulty is in understanding and choosing settings, not in physically hitting the buttons on your keyboard and mouse to effect them.

For this example I’m going to be configuring OBS to stream CS:GO. Since I’ve done this before I already know exactly what settings I’m going to use. If this is your first time, feel free to use these settings as a base (they’re quite modest) and either increase or decrease them as needed based on the guidelines above.

 

Main Window

Main Window

This window is your new best friend. Get to know it, but for now, go ahead and click on the “Settings…” button.

 

General

General

  • Setting Profile: OBS has the ability to create multiple profiles. A Profile will hold a unique set of every setting in this settings window.
  • To create a new profile, go ahead and type a new profile into the “Setting Profile” box, then click add. You now have a new profile!

 

Encoding

Encoding

  • Use CBR: This is just a checkbox that enables/disables CBR mode.
  • Enable CBR padding: If you untick this box when CBR is enabled, then you will be able to change bitrate without restarting your stream. Leave this ticked unless you have a really good reason for wanting to do that.
  • Quality Balance: This is the “quality balance” variable I referred to in the CBR/VBR explanation which is obviously greyed out with CBR enabled.
  • Use Custom Buffer Size: The buffer is the area of memory in which x264 stores video until it is sent away to your streaming platform. There’s little reason to modify this manually. Having it the same as your max bitrate is generally good enough.
  • Max Bitrate: This specified the Maximum bitrate if using VBR, or the target bitrate if using CBR.
  • Buffer Size: As explained above.
  • Codec: This is the audio codec used. AAC is more modern and far superior codec to MP3. There is little reason to use anything else.
  • Bitrate: As explained in the footnote about audio.

 

Broadcast Settings

Broadcast Settings

  • Mode: OBS has the ability to both stream live to a streaming platform, and simply record locally to an mp4 file on your computer.
  • Streaming Service: This is fairly self-explanatory.
  • Server: Twitch and most other streaming platforms have a number of geographically located ingest servers. As a rule of thumb you can just use the one closest to you, but feel free to try another if you run issues.
  • Play Path/Stream Key: This is a kind of username/password in one that OBS uses to stream to your streaming platform. On Twitch.TV, you can find this by going to your dashboard and then looking at the software tab. There will be a “show stream key” button.
  • Auto-Reconnect: Leave ticked unless you are particularly keen on having your stream go offline and not noticing for 20 minutes.
  • Auto-Reconnect Timeout: 10 is fine.
  • Delay: This is the delay that OBS should put on your stream. Setting this to 900 will give you a 15 minute delay, 600 for 10 minutes, etc.
  • Minimize Network Impact: This will cause OBS to make its traffic lower priority than the rest of the traffic on your computer. This is a good idea for online gaming, but can be problematic if you are downloading at the same time or have other people on your internet connection.
  • Save to file: This will tell OBS to also locally record a VOD as well as streaming to a server. Useful for podcasts and other shows.
  • Hotkeys: This will let you set a keyboard shortcut to stop/start your stream.

 

Video

Video

  • Video Adapter: OBS uses DirectX to composite the image (layer the game/webcam/images/etc on top of each other) before it gets encoded. This tells it which graphics card to use. Pay particular attention to this if you are using a dual GPU Macbook Pro or other high-end laptop.
  • Base Resolution: For this setting, you should just use the resolution you plan to play the game at.
  • Resolution Downscale: This allows you to downscale the video to a lower resolution. The resultant resolution shown in this box is the actual resolution that your stream will be shown to your viewers at.
  • Filter: It is possible to get a nicer looking stream using Bicubic or Lanczos, particularly on top down games like LoL/SC2/Dota 2/etc however your mileage may vary.
  • FPS: This is the FPS of the stream itself as described above in the theory section.
  • Disable Aero: This just disables windows Aero. For those not in the know, that’s the nice rendering component that makes windows transparent. Generally this setting is based on game performance. If your games are CPU limited, then leave aero on. If they’re GPU limited, then disable aero for a small boost in performance. Again, your mileage may vary with this setting.

 

Audio

Audio

  • Desktop Audio Device: This tells OBS where to take your desktop audio from. Default will make it just grab the sound going to your speakers, and this is typically what you want to do.
  • Microphone/Auxiliary Audio Device: You want to pick your regular microphone here.
  • Use Push-to-talk: Enabling push to talk will make it such that your microphone’s audio is only heard on stream while you hold down a certain key. Just the same as it works in Mumble/TS3/Vent/etc.
  • Hotkeys: These are just keyboard shortcuts to mute/unmute your desktop audio and microphone audio.
  • Force Microphone/Auxiliary to Mono: If you have a mono microphone and your computer isn’t detecting that, then use this setting so that your viewers don’t only hear you talking into their left ear.
  • Desktop Boost: This is a multiplier. So 1 will have no effect, 2 will make it twice the volume, etc.
  • Mic/Aux Boost: Same as above.
  • Mic Time Offset: This is particularly useful if you have a webcam with a little delay. By changing this setting you can delay your audio a little so that people see your mouth move and hear you speak in sync.

 

Advanced

Advanced

  • NOTE: Many of these settings have bespoke uses. The defaults are almost always good enough.
  • Use Multithreaded Optimizations: Tells the x264 encoder to run in multithreaded mode. Generally leave this on unless you have a good reason to turn it off.
  • Process Priority Class: You can use this to have OBS have have a lower CPU time priority than other programs. In a really tightly tuned streaming setup this can be quite helpful, but usually its best to just leave it at Normal.
  • x264 CPU Preset: This is the Encoder Preset variable I referred to in the theory glossary. As a rule of thumb, veryfast is the best default. If you’re tweaking settings and have quite a bit of free CPU power, setting this to faster or even fast can work.
  • Keyframe Interval: If you remember how I referred to h.264 being a delta based encoder in that it sends information on changes. Well this is how often it sends a full or “key frame” that the changes are based on. Twitch have recently started to recommend a 2 second keyframe interval which seems a little arbitrary although I have no reason to disagree with it, so that’s probably a good value.
  • Custom x264 Encoder Settings: Leave this unticked. If you read my original tutorial that I wrote almost a year ago I gave some advice on what to use here that didn’t make a lot of sense in hindsight. If you’re still using it, don’t.

 

Configuring Scenes

You now want to go close the settings window so you’re back at the main window. First you need to add a “scene”. A scene is essentially just a template view. To do this, right click in the Scenes list and click “Add Scene”. For this example I’m making one called “CS:GO”. Now we need to add some sources. The first thing you will need to do now is load the game you wish to stream. In League of Legends particularly this is a little awkward. You need to get into a game, let it load, then alt tab to do this.

There are 2 methods of capturing a game in OBS: Window Capture and Game Capture. Window Capture works by capturing images of the game window (this can also be used to capture other programs too), while Game Capture works by ripping the raw image directly from the graphics card’s memory. With the exception of a few buggy edge cases, Game Capture is almost always the better option. It is also worth noting that if OBS is running as administrator and your game is not, or vice versa, OBS won’t be able to lock on with Game Capture.

To add a game with game capture, right click in the Sources List, click “Add”, then click “Game Capture”. You will then be presented with a list of all running applications on your computer. Hit Refresh, find your game, then hit ok.

If your game is running, hit “Preview Stream” and you should see it appear in the preview window as shown below!

preview

If your game is running in fullscreen mode, you will have to test by simply starting the stream up and checking the vods, or having a friend check the stream for you.

Now last of all, you can hit “Stop Preview”, then hit “Start Streaming”, and after a couple of second the bottom right indicator should start showing a kb/sec, showing that you are infact live. If all is well, congratulations, you are now a streamer!

At this point, what you will likely want to do is spend a bit of time tweaking the settings, either to get your game to run a little better, to reduce lag or to improve the quality with resources left over.

If you found this tutorial helpful, free to leave a comment here, reddit, or follow on twitter @adamskyride

One Response to OBS Streaming Tutorial

  1. Blek says:

    Nice guide, this certainly would have been helpful a couple months ago and I’m sure it’ll make life easier for many beginners.

Leave a Reply