Both Video and Live TV Buffering/Freezing Video Problems Solved

Shipwreck

New member
Mar 17, 2015
122
1
0
Alrighty....... So after an all nighter (plus 7 hours) of playing with settings, scouring the internet researching, reading until my eyes had projectile bleeding and my brain began to ooze out of my ear holes I have solved the dreaded horrendous buffering issues with videos AND live TV! Okay, this is where I need to issue the standard 'results may vary' disclaimer.... The settings I am about to post were used on 3 different Windows 7 PCs that all had varying amounts of RAM and varying internet speeds and running Kodi 15. My own system is used for video and music production so it's a substantially higher end system than these 3 and my settings are higher... not because they were needed but just because I could LOL. I don't have any of the android boxes to test these on, but based on the research I did these settings should also be good to go on those as well, again though this is a use at your own risk scenario.

For those with higher than 30 Mbps internet and/or more than 1 gig of RAM you can use higher settings. For higher internet speeds you would change the <readbufferfactor> and for more RAM you would change the <cachemembuffersize>. In these settings I used the <cachemembuffersize> that utilizes RAM instead of the 0 setting that utilizes the hard drive for cache. The reason for this is because I discovered that RAM is much faster than using the hard drive (which I actually figured was the case anyway). The <cachemembuffersize>of 157286400 is about 150MB of RAM, so if you have 2 gigs of RAM you could use 250000000 for about 250 MB, if you have 4 gigs of RAM use 400000000 for 400 MB. You could go higher if you have more RAM but you shouldn't need to. For those using Windows systems there is also an added step below these settings.

EDIT: I created 3 advancedsettings.xml files that use the 3 different internet speeds listed below. I attached them here below. Download the zip files (you only need the one that corresponds with your internet speed) and then extract it. Now right click on the extracted file and click copy. Now go to C:\users\XXXXX\appdata\roaming\Kodi\userdata XXXXX is whatever your username on your computer is. Now in that folder right click and click paste. That should do it.

Code:
[B][COLOR="#800080"]Settings for internet speed below 20 Mbps, and 1 gig of RAM
Mix of SD and HD streams up to 1080p[/COLOR][/B]


<advancedsettings>
 

<pvr>
        <minvideocachelevel>60</minvideocachelevel>
        <minaudiocachelevel>60</minaudiocachelevel>
    </pvr>
 
   <network>

    <buffermode>0</buffermode>
    
    <cachemembuffersize>157286400</cachemembuffersize>
        <readbufferfactor>10</readbufferfactor>

    <curllowspeedtime>300</curllowspeedtime>

  </network>

</advancedsettings>


[B][COLOR="#800080"]Settings for internet speed of 20 Mbps, and 1 gig of RAM
Mix of SD and HD streams up to 1080p[/COLOR][/B]


<advancedsettings>
 

<pvr>
        <minvideocachelevel>60</minvideocachelevel>
        <minaudiocachelevel>60</minaudiocachelevel>
    </pvr>
 
   <network>

    <buffermode>1</buffermode>
    
    <cachemembuffersize>157286400</cachemembuffersize>
        <readbufferfactor>40</readbufferfactor>

    <curllowspeedtime>300</curllowspeedtime>

  </network>

</advancedsettings>


[B][COLOR="#800080"]Settings for internet speed of 30 Mbps and above, and 1 gig of RAM
Mix of SD and HD streams up to 1080p[/COLOR][/B]


<advancedsettings>
 

<pvr>
        <minvideocachelevel>60</minvideocachelevel>
        <minaudiocachelevel>60</minaudiocachelevel>
    </pvr>
 
   <network>

    <buffermode>1</buffermode>
    
    <cachemembuffersize>157286400</cachemembuffersize>
        <readbufferfactor>80</readbufferfactor>

    <curllowspeedtime>300</curllowspeedtime>

  </network>

</advancedsettings>

For Windows users, I found the above settings alone were pretty good. However, I had a brain storm from my old software developing days about how Windows handles internet traffic. This lead me to check out the Windows registry and I found that there were indeed some settings in there I could play with the see if it would help even more. The result is the attached file here. This is a reg editing file that will add the settings to your Windows registry to make video buffering even better. This will work on both Windows 7 and Windows XP systems. I don't have any Windows 8 systems to test it on so I can not vouch for how it would work with that. Just download the zip file and extract it and then double click the tcp_perf_smb.reg file and it will automatically set he keys in the registry. You may get some warnings about changing the registry, just click yes to all of them to allow it to set the keys.

Any and all feedback is welcome.

View attachment 596View attachment 604View attachment 603View attachment 602
 
Last edited:
Very Helpful Info For People Not Too Techie

Alrighty....... So after an all nighter (plus 7 hours) of playing with settings, scouring the internet researching, reading until my eyes had projectile bleeding and my brain began to ooze out of my ear holes I have solved the dreaded horrendous buffering issues with videos AND live TV! Okay, this is where I need to issue the standard 'results may vary' disclaimer.... The settings I am about to post were used on 3 different Windows 7 PCs that all had varying amounts of RAM and varying internet speeds and running Kodi 15. My own system is used for video and music production so it's a substantially higher end system than these 3 and my settings are higher... not because they were needed but just because I could LOL. I don't have any of the android boxes to test these on, but based on the research I did these settings should also be good to go on those as well, again though this is a use at your own risk scenario.

For those with higher than 30 Mbps internet and/or more than 1 gig of RAM you can use higher settings. For higher internet speeds you would change the <readbufferfactor> and for more RAM you would change the <cachemembuffersize>. In these settings I used the <cachemembuffersize> that utilizes RAM instead of the 0 setting that utilizes the hard drive for cache. The reason for this is because I discovered that RAM is much faster than using the hard drive (which I actually figured was the case anyway). The <cachemembuffersize>of 157286400 is about 150MB of RAM, so if you have 2 gigs of RAM you could use 250000000 for about 250 MB, if you have 4 gigs of RAM use 400000000 for 400 MB. You could go higher if you have more RAM but you shouldn't need to. For those using Windows systems there is also an added step below these settings.

Code:
[B][COLOR="#800080"]Settings for internet speed below 20 Mbps, and 1 gig of RAM
Mix of SD and HD streams up to 1080p[/COLOR][/B]


<advancedsettings>
 

<pvr>
        <minvideocachelevel>60</minvideocachelevel>
        <minaudiocachelevel>60</minaudiocachelevel>
    </pvr>
 
   <network>

    <buffermode>0</buffermode>
    
    <cachemembuffersize>157286400</cachemembuffersize>  [B]*SEE NOTE BELOW[/B]
        <readbufferfactor>10</readbufferfactor>

    <curllowspeedtime>300</curllowspeedtime>

  </network>

</advancedsettings>


[B][COLOR="#800080"]Settings for internet speed of 20 Mbps, and 1 gig of RAM
Mix of SD and HD streams up to 1080p[/COLOR][/B]


<advancedsettings>
 

<pvr>
        <minvideocachelevel>60</minvideocachelevel>
        <minaudiocachelevel>60</minaudiocachelevel>
    </pvr>
 
   <network>

    <buffermode>1</buffermode>
    
    <cachemembuffersize>157286400</cachemembuffersize>
        <readbufferfactor>40</readbufferfactor>

    <curllowspeedtime>300</curllowspeedtime>

  </network>

</advancedsettings>


[B][COLOR="#800080"]Settings for internet speed of 30 Mbps and above, and 1 gig of RAM
Mix of SD and HD streams up to 1080p[/COLOR][/B]


<advancedsettings>
 

<pvr>
        <minvideocachelevel>60</minvideocachelevel>
        <minaudiocachelevel>60</minaudiocachelevel>
    </pvr>
 
   <network>

    <buffermode>1</buffermode>
    
    <cachemembuffersize>157286400</cachemembuffersize>
        <readbufferfactor>80</readbufferfactor>

    <curllowspeedtime>300</curllowspeedtime>  [B]GOOD CATCH - I totally glossed over this one when reading the wiki[/B]

  </network>

</advancedsettings>


*NOTE
IMPORTANT that whatever RAM you decided to use, you MUST have three (3) times that available amount of FREE RAM or risk having KODI crash.

For Windows users, I found the above settings alone were pretty good. However, I had a brain storm from my old software developing days about how Windows handles internet traffic. This lead me to check out the Windows registry and I found that there were indeed some settings in there I could play with the see if it would help even more. The result is the attached file here. This is a reg editing file that will add the settings to your Windows registry to make video buffering even better. This will work on both Windows 7 and Windows XP systems. I don't have any Windows 8 systems to test it on so I can not vouch for how it would work with that. Just download the zip file and extract it and then double click the tcp_perf_smb.reg file and it will automatically set he keys in the registry. You may get some warnings about changing the registry, just click yes to all of them to allow it to set the keys.

Any and all feedback is welcome.

View attachment 596


I'm right with you in this line of reasoning about the RAM versus writing to disk that so many have done after having so many Youtubers recommend it. For me, a better scenario.

Now I'm getting a pretty smooth experience and that's on PCs that are not very high spec. In fact, one is over 9 years old and is just a Pentium XPS old gamer's box that I had built for video and music production back in the day. I only just upgraded it to it's max of 4 Gigs of RAM last month and the graphics card is finally starting to go again and I'm looking online for a replacement. I've literally 'baked the GPU in the oven' and brought it back to life 5 times in the past 9 years since Dell had problems with this model of mobile desktops. Once again, Youtube to the rescue! I know many people wouldn't be bothered when you can get a brandy new quad or octo core dirt cheap these days. But this pc has been a champ and seemingly refuses to totally give up the ghost, lol.

Kudos on sharing the knowledge. Reading IS a powerful tool, eh?
Now give your bleeding eyes a break. ;)
 
Aaaah LOL the old card baking trick LOL. I used that a few times over the years.

Yeah, using the hard drive was ok... but just ok. I still noticed some stuttering here and there even on my high end system that way. I got searching around to see if there was a way to make Kodi use my larger disc for the cache thinking that might help and that's when I got thinking about seek times and such on hard drives and that lead me to remember that RAM is a much faster in and out than a hard drive LOL. Changed the setting to use the RAM instead and BAM, it was beer time to celebrate LOL.

I'm going to make a video showing how to do all this and upload it and post it here for those who need one.
 
OK, thought I'd make it even easier LOL. I just edited my first post above and added three zip files with the three different advancedsettings.xml file above with instructions on what to do with them.
 
OK, thought I'd make it even easier LOL. I just edited my first post above and added three zip files with the three different advancedsettings.xml file above with instructions on what to do with them.

Shipwreck, not seeing the instructions. I am using Kodi 14.2. Not seeing where to enter code in advanced settings.
 
Still buffering, only now it takes longer to buffer the channels. What about the registry file?


Seems as if tonight is not a good night to tweak buffering settings as what I am getting from a current post involving our forum admin. is that there seems to be some server issues resulting in lots of buffering and no channels.
 
Last edited:
Much better this morning. Shipwreck buffering tweak seems to be working. Just skipped through a few live channels and some VOD's, no buffering and things seem to be faster. A little hitching when the epg is loading, about 15-25 secs. but otherwise things are moving better.

Of note though I upgraded to Kodi 15 and am not having any problems with the tv tab loading when I start Kodi. Don't rightly know what resolved the issue. However, I suspect it may be Shipwrecks buffering tweak. It may have solved the timing issue referred to by dara I think. I suspect Shipwreck's tweak since I remember reading previous posts that upgrading to 15 never solved the channel load timing.
 
I was checking your settings, mainly the < 1GB/20mbps one.

Can you explain your reasons for choosing your values on curllow and readbufferfactor

Thanks

I'm curious about this as well. In particular, the libcurl setting. The wiki states that
Code:
<curllowspeedtime>5</curllowspeedtime>  <!-- Time in seconds for libcurl to consider a connection lowspeed -->
So inputting a 40 would mean for Kodi to consider the connection speed to be low after 40 seconds.

I've never been a networking genius, especially in trying to sleuth out the speed aspect. In my case, I have 25MB down/10MB upload speeds currently.

On one windows 7 (x86) box I have 4 Gigs of RAM. In Kodi, under "System->Info" it shows "1360-1375-ishMB Free" so I rounded down to 1350 MB then further rounded that down to 1300 and divided by 3. Since my PC has crashed a few times this week I further rounded down to 400MB. (400MB X 3 = 1200MB) This is equal to 40000000 bytes (4 and 7 zeros). So far no further crashes (touch wood).

For the <readbufferfactor> setting
Code:
<readbufferfactor>1.0</readbufferfactor> <!-- this factor determines the max readrate in terms of readbufferfactor [B]* (times)[/B] avg bitrate of a video file.
This can help on bad connections to keep the cache filled. It will also greatly speed up buffering. Default value 1.0. -->

Setting the readbufferfactor too high will not crash the system but it MAY max out the HTPC's bandwidth.

So, 'splain, please... :)
 
I'm curious about this as well. In particular, the libcurl setting. The wiki states that
Code:
<curllowspeedtime>5</curllowspeedtime>  <!-- Time in seconds for libcurl to consider a connection lowspeed -->
So inputting a 40 would mean for Kodi to consider the connection speed to be low after 40 seconds.

I've never been a networking genius, especially in trying to sleuth out the speed aspect. In my case, I have 25MB down/10MB upload speeds currently.

On one windows 7 (x86) box I have 4 Gigs of RAM. In Kodi, under "System->Info" it shows "1360-1375-ishMB Free" so I rounded down to 1350 MB then further rounded that down to 1300 and divided by 3. Since my PC has crashed a few times this week I further rounded down to 400MB. (400MB X 3 = 1200MB) This is equal to 40000000 bytes (4 and 7 zeros). So far no further crashes (touch wood).


For the <readbufferfactor> setting
Code:
<readbufferfactor>1.0</readbufferfactor> <!-- this factor determines the max readrate in terms of readbufferfactor [B]* (times)[/B] avg bitrate of a video file.
This can help on bad connections to keep the cache filled. It will also greatly speed up buffering. Default value 1.0. -->

Setting the readbufferfactor too high will not crash the system but it MAY max out the HTPC's bandwidth.

So, 'splain, please... :)

Thanks expatter, I see shipwreck has not surfaced yet or he might still be stranded on the other side of the island. You will have to stop by and rescue him too....after all he is not really a bad boy, he has good intentions...I hope!
 
Been doing some research into the wiki myself, but just cant see any improvement in the VoD. Then again, I have no way of knowing if the problem is local or with the server. Somehow, live tv seems to be better with less or no buffering for the most part.
 
Hey all, sorry for the delay in replying. I've been busy here getting my new place settled. I was going to post the technical info behind the settings but didn't want to over whelm those who aren't tech inclined. When explaining technical stuff I tend to get too technical and people I am explaining it to end up looking at me with that deer in the headlights look LOL.....
So in my best laymans terms here's my reasoning for the settings I chose.

To start, I'll explain what buffering/cache means fr those who may not know. The way I have explained it to people that they understand it better is that cache is a container and buffer is the amount of something the container can hold. So in this case cache is the container that your system or Kodi will hold data in, and the buffer is how much of that data your system or Kodi can save in the cache. The reason for setting this limit is so that Kodi doesn't hog all your systems resources because it still needs resources to run other programs in the background including your operating system.

buffermode - This setting tells Kodi what to buffer in the cache. It's like putting a note on a container that says "only put juice in this container because the kids drink out of it and if you put alcohol in it they'll get drunk", or a note on a door saying "Office, no children allowed" to keep kids from disturbing your work. Setting it to 1 forces Kodi to buffer both internet data and any other data from your LAN (local area network). The reason for buffering both internet and other local network data is in case you have other people or programs working on your network. As an example; Often when I am testing Kodi I am also working on my other system rendering very large video files, audio files, transferring them back and forth from my work system to my rendering drives and such. My work systems are connected to the same network as Kodi so I need to make sure both the Kodi system and work systems have the resources they need to work efficiently together on the network.

cachemembuffersize - This setting will do two things. It will tell Kodi what to use for your cache and how much can be used. You can set it to 0, which mean unlimited and will force Kodi to use you hard drive as the place to put your cache. Or you can set a specific number, which will tell Kodi to use your system memory. Setting it to 0 is like saying OK, I rented space in a large office building with other offices in it, but because it's so large several companies can have offices in it with little problems. However, this particular office building uses partial walls or cubicals to separate the offices. So when people are going back and forth between different offices or in and out of the building there are many others doing the same. This also leaves less privacy as you can hear others talking in other offices spaces and vice versa. While you may have more space you have to contend with the others using the space and this can slow down the traffic and efficiency.
When you set a specific number for your cache it's like renting an office space that is self contained with actual walls and it's own entrance to speed up entering and leaving and keep down noise from other offices. The number you set specifies how large your cache office will be. You need to determine what the best size will be in order to be efficient to store your office equipment and still have room for free flow of traffic, or in this case data.
I set this to 157286400 which is the amount of system memory to use in bytes. It is equal to 150 MB (megabytes), which means Kodi will store 150 MB of video data in the cache. As I mentioned in the original post those with higher amounts of RAM/memory can set this higher if they wish, but 150 MB should be enough to be efficient on most systems. What this does is stores a certain amount of the video in the memory in case there are disconnection issues or speed issues with streaming the video. With part of the video already stored in your memory if there is a disruption to the stream your system will continue to play the part of the video that is stored in the memory and you won't notice and disruption. Then when the streams disruption is cleared up your cache will continue to pull in the rest of the video and continue to do this so you notice little to not disruption.
Now, the thing is, this isn't just a one way path. It pulls and pushes at the same time. So you want and equal amount of pull and push to keep things smooth. So you have 75 MB of pull and 75 MB of push. Also, the Kodi documentation says it actually uses 3 times this amount of memory for streaming. But when I ran system monitors and benchmarking on the three different systems I have it set up on I found out that it actually only uses about 1.5 times this amount and at time a maximum of 2 times the amount. So even with only 1GB of memory you still have plenty left for other resources.

readbufferfactor - This is how fast Kodi will fill your cache/container from the source, the source is your internet connection. Think of your internet connection as a container that holds water, and it has several spouts on it that direct water into various containers. The various containers on your system would be anything that uses your internet connection such as, open web browsers, other people or applications using your connection. There is a valve on this main source container that regulates where the water goes and how fast the water goes in each direction. Now say your source container/internet connection contains 20 gallons/Mbps. Now, there are more factors to how this works. One is the data/video you are using the internet connection to pull in, another is how full your buffer is and how fast it is pushing out. So in these examples we have 150 Megabytes of storage in the cache (75 in 75 out). If you are pulling in a video in at 20 Mbps (Megabits per second) you are pulling in 150 MB (Megabytes) per minute, that's about 20 minutes of video depending on the quality. However, remember you are actually only pulling in 75 MB because the other 75 is going out/playing, so you are pulling in about 10 or 12 minutes of video. So once you pull in the 75 MB your internet connection isn't being used until it need to refill your cache. So while you may be maxing your connection at times it doesn't max out constantly and allows for other applications/people to use the connection.

curllowspeedtime - This is how long Kodi will wait before it realizes a connection is too slow to operate efficiently or a connection is lost and abort it/kick out from the stream and back into Kodi or the EPG. 300 is the number of seconds which equals five minutes. The reason for waiting five minutes is because of the above settings in the readbufferfactor. You have 10 or 12 minutes of video stored in your cache, so if there is a disruption to the stream the curllowspeedtime will wait for five minutes for the disruption to be rectified before aborting the video. If the disruption is rectified before the 10 or 12 minutes of video in your cache empties out there won't be an abort and you won't be kicked out of the video.

The settings for pvr I got from a Kodi PVR developer here:

Code:
http://forum.kodi.tv/showthread.php?tid=159142

Posts 4 and 5.

The reg edits... The advancedsettings file only deals with Kodi. You can set these any way you like, but if your actual operating system limits your network activity and those limits are below the settings for Kodi then the Kodi settings are useless. The reg edit optimizes your total network activity to speed things up which allows for the Kodi settings to actually work.

I also need to note here that the actual servers have been having issues. So it doesn't matter how you tweak your own system, if the servers we are getting the videos from are having problems it will of course affect our own systems as well.
 
Last edited: