Tips about OBS to improve your streams on DLive or other platforms.

in #dlive7 years ago (edited)

obs-studio.jpg
Since a couple of months, me and my friends have been on steemit and DLive all the time. We started streaming gameplays and some even ended up buying gaming PC's just to be part of it.

Thanks to the fact of being in a group with people who like the same things, we find out perfect settings for something rather quickly compared to someone who would work alone. Obviously, a group of people would run into problems quicklier than someone who's alone.

Finding the problem

Due to the above, one of my friend started experiencing alot of freezes and problems on his streams. Not just on DLive, also on other platforms. This made me realize, the problem is not platform related but it's either OBS related or hardware related. Many people don't know the best part about OBS when you are having troubles with your streams, which is the log files. The log files can be found under "Help" in OBS studio.

In the log files you will be able to find what's going wrong in most cases. My friend had encoding issues, but you may have other issue(s). Here is an example picture to show you which part of the error log you should pay attention to:
Knipsel.JPG

To find this part you could use CTRL+F to start a search in the .txt file, you could search for "frames" to find this part of the error log quickly.

Solving different kind of problems

The way we solved my friend's problem was easy. After trying for hours and hours, we were very excited when we found out that we got it working smoothly. Imagine the feeling that you get when your stream is lagging and freezing all the time. It's very frustrating, especially if you have a gaming PC. You could only imagine how happy we were when we finally were able to fix it. Since my friend was not the only one having troubles, we managed to solve everyone's problems with the steps explained below.

These are the things we tried which worked and which everyone should try step by step:

  1. Output Mode
    In the Settings section of OBS you can go to "Output" and change the Output mode to "Advanced". Changing this will allow you to add a buffer size which seems to improve your stream drastically. According to the @dlive team, having the bitrate and buffer size on the same numbers will result in the best quality streams. Make sure you use the same number for both these settings.

  2. CPU Usage Preset
    This is a setting which might improve or destroy your stream. In our case, it improved the stream drastically, but i can imagine this also making it worse for some people. We changed the setting from "veryfast" to "superfast". You could play with this setting carefully and see if it improves your stream or makes it worse, obviously you need to try and find the perfect setting for yourself by changing this untill you find that.

  3. Encoder
    Depending on the GPU in your PC, you most likely will have more than 1 encoder available on OBS. Changing your encoder may/can drastically improve your stream.

In most cases, the above 3 steps will improve your stream alot. In our case, it went from freezing/lagging to high quality stream without any frame losses.

Exploring the internet about OBS can help alot

Although we couldn't find out much about the above 3 steps on the internet our selfs, we did find alot of other helpfull posts on the internet which can sovle most problems. Actually while writing this post and searching directly on the things that i have listed i happened to find a post on OBS's official website about these kind of problems. I will copy paste that here with the link under it, all credits to the OBS team for writing this.

As written by "dodgepong" on the OBS forums:

Encoding video is a very CPU-intensive operation, and OBS is no exception. OBS uses the best open source video encoding library available, x264, to encode video. However, some people might experience high CPU utilization, and other programs running on your computer might experience degraded performance while OBS is active if your settings are too high for your computer's hardware. In some cases, OBS will say "High CPU usage!" on its status bar, meaning that your computer can't encode your video fast enough to maintain the settings you have it set to, which will cause video to freeze after a few seconds, or periodic stuttering.

Here are some ways you can reduce resource utilization and, hopefully, make both OBS and your programs run faster while encoding:

Downscale your output resolution

The resolution that you are encoding at has the biggest impact on CPU usage. For example, 1080p has more than twice the number of pixels in each frame versus 720p, and your CPU usage increases accordingly. The most common way to reduce CPU usage is to downscale your resolution. When you downscale, OBS takes your scene and shrinks it as much as you tell it to before giving it to the encoder. You may want your base resolution at 1080p, since that's the resolution your content is in, but your CPU may not be able to encode an un-downscaled 1080p video. So you can downscale your resolution to 720p (or lower) to keep your image the same, but using a smaller resolution to reduce CPU load.

You can change how much you want to downscale in Settings > Video > Output (Scaled) Resolution. You can keep your Base (Canvas) Resolution the same, so that your layout doesn't change, and then downscale the resolution to whatever gives you good performance.

The different downscale filters (bilinear, bicubic, and Lanczos) simply change the algorithm used to shrink the picture: bilinear is fastest and takes the fewest resources, but doesn't look as good, while Lanczos takes more resources but looks better. Performance-wise, though they aren't that much different. Feel free to experiment with which filter works best for you.

Lower your frame rate

If you're streaming above 30 FPS, another option is to consider is lowering your frame rate to 30 FPS. It will reduce the number of frames your CPU has to process in a give time span, which will reduce CPU usage. You may even feel the need to lower your frame rate to something below 30 FPS, in the case that your CPU is really weak and struggling.

Change your x264 preset

The video encoder, x264, has a number of "presets" that will change your video quality and CPU usage accordingly. The OBS default is veryfast, which for the majority of cases is the best balance between CPU usage and video quality. This setting can be changed in Settings > Output (check the Enable Advanced Encoder Settings if you're in Simple mode) > Encoder Preset.

The name of the preset is intended to indicate how "fast" the encoder should run. Faster presets will use less CPU at the cost of quality computations. Slower presets will use use more computations for quality, but will use much more CPU.

For example, if you would like to try to reduce CPU usage without modifying your resolution or FPS, you can reduce your CPU usage by changing your x264 preset to superfast or ultrafast, and x264 will spend less time trying to make the image look good, and will spare you some CPU cycles. The image may look a bit blockier or pixelated, but you will be able to retain your resolution/fps.

Be very careful with this setting, because even one step faster or slower can have a huge impact on CPU usage. For example, the preset named "faster" can use twice the amount of CPU as "veryfast", the one right above it. Always set it back to veryfast if you're not sure what to set this to.

Try Quicksync, AMF, or NVENC

Quicksync, AMF, and NVENC are hardware encoders that come on recent Intel Integrated GPUs, newer AMD GPUs, and recent nVidia GPUs, respectively. You can offload encoding load to those hardware encoders at the cost of a somewhat noticeable decrease in quality at the same bit rate. Do note that QSV / NVENC are very bad at low bitrates so they are not recommended for streaming.

If you have one of the mentioned hardware encoders, you can see if those options are available to you in Encoding settings.

Quicksync is a bit trickier to set up, but here is a guide: https://obsproject.com/forum/resources/how-to-use-quicksync.82/
Likewise, here is the troubleshooting guide for the AMF encoder: https://github.com/Xaymar/obs-studio_amf-encoder-plugin/wiki/Troubleshooting-Guide

Check your sources

Some sources such as webcams and capture cards can use a lot of CPU just by being on your scene as they have to decode the video data. If you're using a webcam, check it isn't running at too high of a resolution (more than 480p is rarely needed if it isn't full screen). Browser sources can also consume CPU if there are complex animations or scripts active.

Upgrade your hardware

Some CPUs are so weak that they are near-hopeless for getting anything decent working. Dual-core CPUs and AMD APUs are particularly notorious for this. They might be able to get away with a 360p stream at 25 FPS using the ultrafast preset, but it certainly won't look good. That's up to you to decide. If you have a Sandy Bridge i5 or i7 or later, or an AMD 6-core or 8-core or later, then you should be able to come up with a decent-looking stream at reasonable resolutions and frame rates.

OBS is different from many other streaming/recording programs in that it makes use of your GPU for better performance. Unfortunately, on some older or budget model GPUs this can be a bottleneck in your stream's performance. This is generally due to low memory bandwidth and/or low processor core count. GPUs such as the nVidia GTX 200-series (250, 260, 280) and 9800GT and earlier were once very powerful in their day, but are now very old cards that will make OBS performance suffer greatly.

Other programs/games use CPU too

Certain programs (particularly games) can use a lot of CPU. This includes some obvious ones, such as Battlefield 4, and some non-obvious ones, such as games played via emulators. If a game uses a lot of CPU, it can interfere with OBS just as OBS can interfere with the game, so you will need to consider turning down these settings to compensate for the game you're playing. You can also use the "Process priority" setting in Settings > Advanced to increase or reduce processor priority of the program. It's common to give OBS "Above normal" process priority to ensure that OBS is prioritized by the system and running smoothly, though use it with caution.

Run your log through the log analyzer for more advice

If there are any other things that could be causing OBS to run slow, you can often find them by running your OBS log through R1CH's log analyzer. It will let you know of any other performance problems that could be slowing things down, or any other problems you might be having with your settings. You can do this from your OBS Help > Log Files menu, or by pasting your log into the box on the analyzer site.

You can find the page where this has been posted here:
https://obsproject.com/forum/threads/high-cpu-usage-high-encoding-taking-too-long-to-encode-read-this-first.23334/

I was very happy to share this with everyone here while beginning to write this post, unfortunately or maybe happily i found that OBS already stated most things on their forums. Either way, i´m deciding to post this anyway so atleast the people who find this post get the help they need.

In the past couple of weeks, i´ve learned alot about DLive, OBS and streaming in general. I even learned how to stream using FFMPEG to DLive, which was awesome but had a very bad quality for me. I would be able to get that quality up by playing with the settings but it looks like with above information OBS could work perfectly fine. In case you do have any questions you would like to ask me, i´m available on DLive´s Discord channel and also most of the time you can find me on steem.chat #general channel.

Thank you for reading and hope this helps!

Sort:  

Actually had an issue as related to server connection few days back while trying to come live and after trying every trick I could find and think of, decided to change my internet connection and boom I was live, an addition to the above if you experience same problem try changing or checking your internet connection

This should be one of the first things people should do when they encounter the server connection error. DLive still is very new and unfortunately got alot of bugs :(.

Thank you for your helpfull reply!

You welcome and keep up the good work

Hi! I am a robot. I just upvoted you! I found similar content that readers might be interested in:
https://obsproject.com/forum/threads/high-cpu-usage-high-encoding-taking-too-long-to-encode-read-this-first.23334/

I saw plenty of obviously self written text along with the quoted portion...had no problem upvoting this. :)

Hi @cheetah, apart from the quoted texts i wrote everything my self. I added the quoted texts because i thought it would be helpfull to share with the people reading this post. Thanks for pointing it out, but i pointed it out myself too. Great work tho!



Congratulations, this post was rewarded with a SteemGC Upvote!

Want to meet fellow Steemit gamers and earn upvotes yourself? Join the SteemGC Discord channel!

This is a lot of help for those either having issues or needing help with getting setup. Great share for all gamers.