What encoding Settings should you use?

Hey let’s all ask the big question what encoding settings should you use in today’s streaming environment. You have mobile users and desktop users but time after time we are affected by the Bandwidth on the End user. So let’s discuss a bit about how this works. We need to first understand what one image at 1080p maximum possible data that the image could contain with no compromise.

Are you catching the trend here? The more color Depth Factor the higher the bandwidth required before encoding. This is especially important for live games or events. Let’s say you have multiple cameras that are streaming back to a center console that is doing the recording or broadcasting to get that data there in the best possible quality you could be looking at some very high rates depending on your Resolution frame rate and quality that you wish to achieve.

An example is at 1080p 60 fps at 8 Color Depth Factor your looking at 1.49 Gbps and at 60 fps that increases to a total Signal Bandwidth of 4.46 Gbps roughly.

This is why in house 10 gig fiber is used at most sporting events to each high end camera system allowing for full bandwidth and depth quality. But there are some things that can be done to encode this signal and transmit it at lower bit rates. We will get to this later on in this short to long drawn out article. I have been testing encoding rates with OBS since 2012 in both Linux and windows. The videos you will see below are only done in Windows 11 Pro with Current at the time OBS installation and NVENC Encoding using an Nvidia RTX 3070. To view more and Bandwidth Calculator you can click here. Another very educational site that I have found that has helped me through some of this is here. You can find Twitch Basic Stream information located here or stream.Twitch.tv . For Youtube they have a dedicated page as well located here.

Understanding Internet Speeds and Quality

So you go out to your cable provider and purchase that 1 Gigabit internet connection but what they fail to mention to you is its 1 Gigabit down and only 50 Mbps upload. This is to prevent users from using the internet to upload data to the internet in bulk. Mainly to help with piracy back in the early 2000’s and has carried over as a feature according to the Cable ISP’s this is why Symmetrical service is unlikely until you get to fiber internet providers and why Fiber is the ultimate way to go it takes a lot of the Packaging and BS out of internet. So now that you know how I feel about the failing cable company and why they are useless in my opinion let’s get into it. You got this 1 Gigabyte download connection again with only 50 Mbps upload but often times if and when you run a Trace route you will notice a long tree out to the actual internet where the data can be routed outside of your providers hands. This is where quality and latency come into play. Often times Cable providers they like to create a one stand Christmas tree instead of redundancy in there backhauls so they can’t handle the throughput often times because the equipment is outdated or not enough fiber lines were run when they layed down the fiber the first time. So let’s test your internet some internet test sites are as follows:

Now let’s talk about what this speed test means.

We pay for 100 Mbps download and 30 Mbps upload and it is Business class fiber from Clearwave Communications. We will soon be getting residential gigabit symmetrical fiber internet which will be leaps and bounds better than what we have.

TestMy.net Test ID : de2dlyN2p.i7WCMablK

So as you can see we get 89.17 Mbps download and 31.68 Mbps upload. That 11 Mbps on the downstream is probably everyone else on the network watching videos and playing Minecraft on the Minecraft servers check out Ltcraft.net for that.

So according to the above speed test we have approximately 40 Mbps download and about 5 Mbps upload that can be used for streaming. I always cut the Download bandwidth in half and the upload bandwidth in 1/6th roughly. So when streaming you have a buffer or a safety net your not just slamming the bandwidth limiters when everyone else is using the internet. When you stream your using the upload of that network to stream the data out across the internet to a server that data needs bandwidth range for give and take example some times it might pull more that 5mbps at a time it is important to think about this when setting up your encoder settings in the field.

Now let’s look at Trace Routes what is it and what ip should I use to get a base line. Google DNS is typically the ip I use to test my traceroute against. Which is 8.8.8.8

It looks like this:

Let’s talk about the hops here from Windows Terminal window shown above with the command of: tracert 8.8.8.8

  • Hop 1 is our Router here at the house.
  • Hop 2 is our ISP Gateway.
  • Hop 3 is our ISP’s Contracted provider.
  • Hop 4 is our ISP’s Contracted provider.
  • Hop 5 is our ISP’s Contracted provider.
  • Hop 6 is our ISP’s Contracted provider.
  • Hop 7 is our ISP’s Contracted provider.
  • Hop 8 We finally reach the outside of the Forking tree.
  • Hop 11 We reach google DNS server where the icmp ping was received and sent back to us.

Now along the way you can see latency increases Almost 200ms of latency plus or minus if congestion is occurring. This is why often times you will see a even more slight delay on streaming out to the internet verses to a streaming server located inside your network. I was playing with nginx RTMP servers for awhile. Now that we have covered hops and latency we need to talk about Jitter and dropped packets. Jitter and dropped packets will cause many issues as well packets not being acknowledged or out of order packets which will cause stream stuttering etc. Cable providers are famous for Buffer Bloat a good article on this can be found here. We will not be covering this it’s some thing to be aware of if you notice funny business when testing your internet connection.

To test for packet loss I like to use Windows Terminal again with the command: ping -t 8.8.8.8

I like to let that run for about two minutes then to stop it while in the window use ctrl + C to cancel and stop the command.

Where the Lost= 0 if you have anything above 0 you have a problem some where across your network. You should have 0% Packet loss. Check your home network and your ISP for solutions.

Another tool that can be used is Windows MTR and yes there are packages for linux as well.

Once you get and run MTR you will want to let it run for about two minutes to get a true diagnostic of your Internet connection quality.

Typically hops with No Response from Host are icmp blocked routers. ISP’s like to do this to hide there routers or if they are having an issue behind a router some times they will hide the router in hopes you won’t notice the packet loss. I think this should be illegal in my opinion but no one has bothered to ask me.

Here is an Example of what an MTR report looks like.

WinMTR Statistics

WinMTR statistics

Host % Sent Recv Best Avrg Wrst Last
pf.lorentedford.com 0 232 232 0 0 0 0
157-185-79-33.clearwave.com 0 232 232 3 4 32 3
No response from host 100 47 0 0 0 0 0
be2316.ccr21.mci01.atlas.cogentco.com 0 232 232 11 12 65 11
be2432.ccr31.dfw01.atlas.cogentco.com 0 232 232 21 22 84 21
be2763.ccr41.dfw03.atlas.cogentco.com 0 232 232 21 22 84 21
tata.dfw03.atlas.cogentco.com 0 232 232 27 27 53 27
74.125.50.198 0 232 232 27 29 106 28
108.170.240.129 0 232 232 28 28 32 29
142.251.60.143 0 232 232 27 27 29 28
dns.google 0 232 232 27 27 30 27

If you see any packet loss here you have a problem outside of ISP’s hiding there router icmp pings.

Now let’s talk about Encoding CPU vs NVENC (GPU)

CPU encoding basically puts the work load of your cpu to encode what ever it is your streaming out to the network. Most people do not have the overhead for this to do it reliably and at good quality it takes big money.

Nvenc GPU encoding. Well now this is reasonable for streaming if you have an RTX 30 series or higher. An RTX 30 series has the capability of using NVENC in obs to encode the stream down to a much more reasonable output setting to be streamed across the internet.

Example OBS settings

Keep in mind this is done with following PC Specifications your results may vary depending on the Hardware used.

  • OS Windows 11 Pro
  • CPU= 12th Gen Intel Core i7 – 12700F
  • Memory= 64 Gb 3200 Mhz DDR4
  • GPU= Nvidia RTX 3070
  • Motherboard= MSI MAG B660M MORTAR WIFI DDR4 LGA 1700 Intel B660 SATA 6Gb/s Micro ATX Intel Motherboard
  • Main Monitor= PG259QNR ROG Swift 360hz
1st Stream

Testing Stream encoding settings for Mobile environments. 1080p 30fps 3800kbps slow-2pass full resolution.

The goal of this stream is testing for Mobile users.

The goal here is to cater to the mobile environment and the mobile viewers. What is the best setting for them. Not for the general pc viewer.

All tests were done with NVENC x264

2nd Stream

Testing Stream encoding settings for Mobile environments. 1080p 20fps 2800kbps slow-2pass full resolution.

The goal here is to cater to the mobile environment and the mobile viewers. What is the best setting for them. Not for the general pc viewer.

All tests were done with NVENC x264

3rd Stream

Testing Stream encoding settings for Mobile environments. 1080p 20fps 1800kbps slow-2pass full resolution.

The goal here is to cater to the mobile environment and the mobile viewers. What is the best setting for them. Not for the general pc viewer.

All tests were done with NVENC x264

4th Stream

Testing Stream encoding settings for Mobile environments. 1080p 60fps 2800kbps Faster-2pass full resolution.

This stream was awful one of the worst experiences I have ever had the game lagged so bad.

This is to show what it takes to stream at 60fps.

5th Stream

Testing Stream encoding settings for Mobile environments. 1080p 60fps 6000kbps Faster-2pass full resolution.

This was an ok experience but Twitch had an issue with it because the bit rate was so high.

The Streaming Settings I Generally Use.

https://www.twitch.tv/videos/2087534735

Testing Stream encoding settings for Mobile environments. 1080p 30fps 3200kbps Slow-2pass full resolution.

This is my default at the moment and what I plan to stream with in the future.

What have I learned

I suppose after several years of messing with streaming I have come to realize that it’s all a compromise. You just have to find an in between for the environment your in. The tools above will help you dictate whether you can stream or not reliably but nothing is 100%. In reality how do you mitigate down time or mitigate issues while streaming well you cater to the common denominator a majority of the people lets face it watch you tube twitch and Facebook all from mobile devices. Generally speaking they are going to have bad internet as well. The best thing you can do is step down the bandwidth to the lowest possible with out complete compromise on quality. But during times of instability or network congestion you may have to end your stream and call it. Better to record the video and upload it later than it is to have a stream that is garbled and a total waste. I learn the hard way with everything. Yeah that’s why I don’t have a large subscriber base. I like to tinker with things and learn. Hopefully this helps you understand the basic principles I take in streaming and quality control. By the way I have never found those magic settings. I am always changing some thing.