The lights are down low. You’ve made some fresh popcorn. You’ve just sat down for your movie “date night” when….
Buffering…..
Buffering…..
Be honest: How many movie nights have ended because of that one little word?
What about this one?
“Cache Full: Cache filled before reaching the required amount for continuous playback”
Kodi has a lot of options available in the settings screen, but there’s no way currently to change the cache size. So, are we just going to have to live with stuttering videos and annoying Kodi buffering issues?
Right?
Nope. That would make for a pretty short article. 🙂
So, stick around and I’ll tell you about the advancedsettings.xml file and how to modify the Kodi cache. Don’t worry about making any mistakes along the way. You can always reset Kodi and start from scratch if you like.
BONUS: I’ve come out with my largest-ever guide on How to set up Kodi the right way. Check it out here or using the image below!
What is cache?
Even if you’ve never heard the term “cache” before, that’s OK. You’re probably using it every day without even knowing it.
Cache is any temporary data that is stored on a device so that it can get the data faster than you, the end user, can consume it. That way any interruptions in transmission quality or network speed won’t bring your video to a screeching halt.
Think of it like this. Have you ever been at a sports bar watching the same game on two TVs, but one of the TVs is slightly ahead of the other? Imagine one TV is “storing” a few extra seconds of the game, just in case there’s a problem with the signal.
Just for the record, that’s not why the TVs are out of sync, but it makes it a good analogy.
Types of Kodi Cache
There are several different types of cache memory that Kodi\XBMC uses during playback:
Video Cache
Video cache is exactly what it sounds like cache is used for playing back videos streaming from the Internet or somewhere else on your local network. Kodi will use system RAM to store (or buffer) a few seconds of the file. Since system RAM is the fastest type of storage available on just about any computer system, this is going to be your best performance option.
Since Kodi is designed for systems with as little RAM as 1GB, it doesn’t use much RAM for video cache by default – usually about 60MB. This cache is used, as needed, and then cleared after each use.
This is the type of cache that I’ll be showing you how to configure later in this article. If you have network speed issues or a troublesome Wi-Fi connection, this will be your best bet for improving Kodi video playback problems.
Add-On Cache
Unlike video cache, which is a part of the base video playback code, some Kodi add-ons will have their cache. Some may use this to supplement the video cache while other add-ons may ignore the video cache completely and use their own.
The trouble with this form of cache is that the add-on has to do a good job of keeping track of it and cleaning it up. If it doesn’t, then those temporary files will sit on your device, taking up valuable space. To delete the add-on cache, you’ll need to navigate to each add-on folder and delete files manually.
The addon data folder will be in a subfolder in your user data directory. Where these folders are located will depend on your system’s operating system:
Operating System | File Path |
---|---|
Android | Android/data/org.xbmc.kodi/files/.kodi/userdata/ |
iOS | /private/var/mobile/Library/Preferences/Kodi/userdata/ |
Linux | ~/.kodi/userdata/ |
Mac | /Users/<your_user_name>/Library/Application Support/Kodi/userdata/ |
OpenELEC | /storage/.kodi/userdata/ |
Windows | Start – type %APPDATA%\kodi\userdata – press <Enter> |
Remember that older versions of Kodi (before version 14) were called XBMC. If you’re still running one of the older versions and can’t upgrade, replace Kodi with XBMC as you see it in the chart above.
Android Application Cache
I’m sure I don’t have to tell you that pretty much every Android application has its cache.
This will usually be the easiest to clear because it’s the one that we’re most familiar with.
To clear the Kodi Android application cache, or any other Android app cache, go to your Settings menu and select “Apps”. Scroll down to find the app you’re looking for and click on it. There will almost always be a button that says “Clear Cache” in its settings screen.
Unlike a lot of other Android apps, you won’t need to use this method very often. In reality, you should only ever have to manually clear the Kodi cache through the Android Settings screen when Kodi crashes unexpectedly. If it’s not able to remove cache files automatically or a file gets corrupted, this should be one of your first steps to troubleshoot.
This won’t lose any settings that you’ve entered, but it will give you another chance to see those “Kodi is running for the first time” screens that we all know and love.
Click here to find out about Kore: The official Kodi Remote App!
Image Cache
Have you ever looked at how much space is taken up by your image thumbnails? When you think about how small an image is, it doesn’t seem like much. Most images are anywhere from 500Kb to 5MB in size, depending on the resolution. Occasionally you’ll come across uncompressed images that are larger than 5MB, but they’re rare. So what’s the big deal?
Well, when you’ve got a collection of music and movies that you’ve been accumulating for years, those little files can add up. For example, I’ve ripped every single CD I’ve ever owned to my NAS (Network Attached Storage) – over 1100 CDs! If each one has a 1MB image attached to it, that’s over 1GB! Imagine finding space for another 2 movies on your device, simply by managing your Kodi image cache better.
Temp Files
Temp files – the bane of my existence. Well, at least as far as my PC goes.
I’ll bet you’ve got at least one or two ‘Temp’ directories on your PC overflowing with useless files that some program should have uninstalled but didn’t. Kodi has the same problem sometimes. Whether it’s the leftovers from a Zip file installation or remnants of some add-on that wouldn’t leave – you can recover some space by cleaning them out.
Why bother?
It’s simple. The more space you have, the more you can set aside for buffering videos, and isn’t that why you’re reading this article?
Now that you know what cache is, let’s fix those pesky “Kodi cache full” messages. To do this, we’ll create an advancedsettings.xml file.
What is advancedsettings.xml?
Advancedsettings.xml is a file that stores all of the user-created settings for your Kodi installation.
Remember, Kodi is an open-source project that started as a media center that would only work on a modified Xbox. Tweaking has been part of Kodi\XBMC’s DNA since the very beginning.
Does that mean that this is going to be hard? Not at all.
I’ve created a sample advancedsettings.xml file that you can drop in your Kodi folder. You can either download it from the link below or, if you’re more “hands-on”, I’ll show you how you can create your own.
Framework (and a brief description of XML\HTML tags)
The basic framework of the advancedsettings.xml file looks like this:
<advancedsettings>
<setting>value</setting>
…
<setting>value</setting>
</advancedsettings>
If this looks complicated, don’t worry. It’s not that bad. Besides, if you don’t want to stress about it, skip ahead to the download section and use my pre-made file.
Any XML (or HTML) file will always have an opening and closing tag for everything. Think of those tags as “framing” the important stuff – just like a picture frame. If you leave off one side of a picture frame, then the important stuff (the picture) winds up on the floor next to your cat. It’s the same with XML\HTML tags, only without the cat. They usually don’t like programming.
If you look at the file from the top and bottom at the same time, you’ll see what I mean. The opening tag is the first <advancedsettings>. The closing tag will look almost identical, except for the forward slash in front: </advancedsettings>
On the inside, each setting will have its opening and closing tags: <setting> and </setting>. The actual value is there in between the two.
You’ll replace the word “setting” with the actual name of the setting you want to change.
I’ll show you what I mean.
JUST GETTING STARTED?
Get up to speed quickly with my Getting Started with TV Boxes resource page. Check it out here or using the image below!
- Settings you can change
Let me be clear upfront, this is a brief look at the settings you can change in the advancedsettings.xml file. There are dozens of settings you can change to tweak your Kodi experience. We’re only looking at a few which are directly related to Kodi buffering problems. If you want the complete list, please check out the Kodi Wiki page devoted to the advancedsettings.xml file.
Once you get started tweaking settings, you may find several other things that you could improve to make your Kodi setup the best it can be. It can be fun!
Network
Not a setting, but a “family” of settings. All three of the settings listed below will fall under the Network grouping. So we’ll have to include an opening <network> tag and a closing </network> tag.
Buffermode – The “what”
The first Kodi cache setting we will look at is the Buffer mode. Buffer mode controls how Kodi uses the cache during playback. More specifically, it controls which files get buffered. This is the “what files” that will get buffered.
It can have four settings:
Setting | Explanation |
---|---|
0 | This is the default value. This buffers all internet filesystems (http, ftp, webdav, etc.) |
1 | This buffers all filesystems, both Internet and Local |
2 | Only buffers true Internet file systems (http, etc.) |
3 | No buffer |
On most devices that you’re going to find on this site, I recommend using Setting 1. This means you’ll be buffering streaming files and local files, including those on your network. If you’ve got your media store on an external hard drive or NAS, then this will buffer those files during playback.
Our first settings line will look like this:
<buffermode> 1 </buffermode>
Readbufferfactor – The “speed”
Readbufferfactor is the setting that controls how quickly Kodi will fill the cache. By default, it is set to “1”, which means that Kodi will only look ahead slightly to store what’s coming next. Think of this setting as the “speed” in which Kodi fills the buffer.
If your network is unreliable, or slow or you have a fair amount of interference in your home, you’ll want to increase this value.
The setting value is a multiplier of the default limit. Kodi looks at the average speed at which the video will play. Higher resolution\bitrate videos will stream at a higher speed.
The default setting is usually pretty good. I recommend only a slight increase to 1.5.
If you make the other changes and still have issues, you can change this value to as high as 4. If you have a high amount of RAM in your device, you could go even higher than that.
You can increase this value as much as you want. Kodi won’t crash, but it may end up using all of the bandwidth you have on the device. At that point, you won’t see any improvement in increasing the number. You’ll also not be able to do anything else on your device while you’re watching a video.
This settings line will look like this:
<readbufferfactor> 1.5 </readbufferfactor>
Cachemembuffersize – The “How much”
Here is the important one. Cachemembuffersize is the “how much cache should Kodi use” setting.
This value is stored in bytes – not MB or even KB. Plain, old minuscule bytes of memory. That means the number in this setting is going to be very large.
Also, the way the cache works, Kodi will use three times the amount of RAM that you enter in the setting. So if you only have 1 or 2 GB of RAM on your device, you’ll want to be careful with this setting.
Since there are a lot of options with this setting, I’ll illustrate some of the more common ones here:
If you have a low-power device, like a Raspberry Pi, set this number to 50MB (which uses 150MB of RAM):
- <cachemembuffersize> 52428800 </cachemembuffersize>
If you have a device with a lot of memory, you’ll be at the other end of the spectrum. You can set this number to 150MB (which uses 400MB of RAM):
- <cachemembuffersize> 157286400 </cachemembuffersize>
For most users, the following setting should work just fine. Here, we’ll set this number to 100MB (which uses 300MB of RAM):
- <cachemembuffersize> 104857600 </cachemembuffersize>
A word of warning: Kodi Zero Cache
Alternatively, you could use “0” as your setting in cache mem buffer size. You’ll see a lot of articles about “Kodi zero cache” add-ons and tweaks.
I don’t recommend 0 cache for most users – especially those of us that use Android boxes or HTPC’s with flash storage.
What zero cache does is write the entire file to disk for speedy viewing. What’s wrong with that, you ask? As I’ve detailed in this article, flash storage, including Solid State Drives (SSD), has a finite amount of read-writes that it can perform before the drive just plain dies. No clicking like normal hard drives….just dead.
If you write the entire file of every song and movie you play to your internal storage you’ll burn through the life of that storage fairly quickly.
Putting it all together…
Now that you’ve got a basic understanding of the advancedsettings.xml file and an idea of what settings would work for you, it’s time to put them all together into one file.
Using the settings I recommended above, we came up with this:
<advancedsettings>
<network>
<buffermode> 1 </buffermode>
<readbufferfactor> 1.5 </readbufferfactor>
<cachemembuffersize> 104857600 </cachemembuffersize>
</network>
</advancedsettings>
These settings should work for the majority of HTPC\Android TV box users out there, but feel free to modify them if you feel you need to.
Creating (or downloading) the advancedsettings.xml file
Now that you have the settings you want, you have to get them into a file.
Create a new text file using Notepad, Jota, or any other text editor you choose. Then copy the settings above into that file and save the file at “advancedsettings.xml”.
Be sure that the file is saved exactly as above. A common error is that the file is saved as “advancedsettings.xml.txt” – that won’t do you, or Kodi, any good. Pick the right file extension!
Alternatively, you can choose to download my pre-made advancedsettings.xml file here. Just remember to manually change the file extension from “.txt” to “.xml”: advanced settings
How to install the advancedsettings.xml file
Now that you’ve got the file (with the correct extension), you’ll need to place it in your Kodi user data folder on your device.
If you remember from the Add-on cache section at the top of this article, that will vary depending on your operating system. You can use that chart to navigate to your user data folder with ES File Explorer, Windows Explorer, or whatever file management application you prefer.
How to stop Kodi buffering: Wrapping it up
Hopefully, this gives you a better idea of what the advancedsettings.xml file is and how it can help you with Kodi cache and general buffering problems. For answers to other popular streaming device questions, check out our FAQ section!
Have you tried something similar? What settings worked for you? Let us know in the comments below!
Thanks you for the good article.
I see “What”, “Speed” and “How much”. But where is the “Where”? I would like to cache the whole files, and following the concern of limited storage lifetime, do it on external memory.
What if you have a flash drive (C:) but would rather use a large regular hard drive (D:) for the buffering data? Can this be done in order to avoid killing the flash drive with a large buffer size? If so, how?