Вы находитесь на странице: 1из 12

Heres how to modify the Kodi cache

By Tim Wells 130 Comments

The lights are down low. Youve made some fresh popcorn. Youve 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 required amount for continuous playback

Kodi has a lot of options available in the settings screen, but theres no way currently to change
the cache size. So, are we just going to have to live with stuttering videos and buffering issues?

Right?

Nope. That would make for a pretty short article.

So, stick around and Ill tell you about the advancedsettings.xml file and how to modify the
Kodi cache.

BONUS: Ive just posted my largest ever guide on How to set up Kodi 16: Jarvis the right
way. Check it out here or using the image below!
What is cache?
Even if youve never heard the term cache before, thats OK. Youre 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 wont 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 theres a problem with the signal.

Just for the record, thats not why the TVs are out of sync, but it makes it for 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 used for playing back videos streaming from
the Internet or somewhere else on your local network. Kodi will use system RAM in order to
store 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 doesnt 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 Ill 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 own 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 doesnt, then those temporary files will sit on your device, taking up
valuable space. To delete add-on cache, youll need to navigate to each individual add-on folder
and delete files manually.

The addon data folder will be in a subfolder in your userdata directory. Where these folders are
located will depend on your systems 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 youre still
running one of the older versions and cant upgrade, replace Kodi with XBMC where you see it
in the chart above.

Android Application Cache


Im sure I dont have to tell you that pretty much every Android
application has its own cache.

This will usually be the easiest to clear, because its the one that were 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 youre 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 wont 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 its not able to remove cache files automatically or a file gets
corrupted, this should be one of your first steps to troubleshoot.

This wont lose any settings that youve 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 doesnt seem like much. Most images are anywhere from
500Kb to 5MB in size, depending on the resolution. Occasionally youll come across
uncompressed images which are larger than 5MB, but theyre rare. So whats the big deal?

Well, when youve got a collection of music and movies that youve been accumulating for
years, those little files can add up. For example, Ive ripped every single CD Ive ever owned to
my NAS (Network Attached Storage) over 1100 CDs! If each one has a 1MB image attached
to it, thats 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.

Ill bet that youve got at least one or two Temp directories on your PC just overflowing with
useless files that some program should have uninstalled, but didnt. Kodi has the same problem
sometimes. Whether its the leftovers from a Zip file installation or remnants of some add-on that
wouldnt leave you can recover some space by cleaning them out.

Why bother?

Its simple, really. The more space you have, the more you can set aside for buffering videos, and
isnt that why youre reading this article?

Now that you know what cache is, lets fix those pesky Kodi cache full messages. To do this,
well 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 out as a media center that would only
work on a modified Xbox. Tweaking has been part of Kodi\XBMCs DNA since the very
beginning.

Does that mean that this is going to be hard? Not at all.

Ive 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 youre more hands on, Ill 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, dont worry. Its not that bad. Besides, if you dont 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. Its
the same with XML\HTML tags, only without the cat. They usually dont like programming.

If you look at the file from the top and bottom at the same time, youll 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 own opening and closing tags: <setting> and </setting>.
The actual value is there in between the two.

Youll replace the word setting with the actual name of the setting you want to change.

Ill 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 up front, 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. Were 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 a number of other things that you could
improve to really make your setup the best it can be. It can be fun!

Network

Not really a setting, but a family of settings. All three of the settings listed below will fall
under the Network grouping. So well have to include an opening <network> tag and a closing
</network> tag.

Buffermode The what

The first Kodi cache setting were going to look at is the Buffermode. Buffermode controls how
Kodi uses the cache during playback. More specifically, it controls which files get buffered. This
is the what files 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 youre going to find on this site, I recommend using Setting 1. This means
youll be buffering streaming files and local files, including those on your network. If youve 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 whats coming next.
Think of this setting as the speed in which Kodi fills the buffer.

If your network is unreliable, slow or you have a fair amount of interference in your home, youll
want to increase this value.

The setting value is a multiplier of the default limit. Kodi looks at the average speed that the
video will play at. 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.

Basically, you can increase this value as much as you want. Kodi wont crash, but it may end up
using all of the bandwidth you have in the device. At that point, you wont see any improvement
in increasing the number. Youll also not be able to do anything else on your device while youre
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 actually 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, youll want to be
careful with this setting.

Since there are a lot of options with this setting, Ill 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, youll 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 folllowing setting should work just fine. Here, well set this number to
100MB (which uses 300MB of RAM):

<cachemembuffersize>104857600</cachemembuffersize>

A word of warning: Kodi Zero Cache

Alternately, you could use 0 as your setting in cachemembuffersize. Youll see a lot of articles
about Kodi zero cache add-ons and tweaks. I dont recommend 0 cache for most users
especially those of us that use Android boxes or HTPCs with flash storage.

What zero cache does is write the entire file to disk for speedy viewing. Whats wrong with that,
you ask? As Ive detailed in this article, the 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 youll burn
through the life of that storage fairly quickly.

Putting it all together

Now that youve got a basic understanding of the advancedsettings.xml file and an idea of what
settings would work for you, its time to put them all together into one file.

Using the settings I recommended above, we come 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 wont do you, or Kodi, any good. Pick the right file extension!

Alternately, you can choose to download my pre-made advancedsettings.xml file here. Just
remember to manually change the file extension from .txt to .xml: advancedsettings

How to install the advancedsettings.xml file


Now that youve got the file (with the correct extension), youll need to place it in your Kodi
userdata 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 userdata folder with ES File
Explorer, Windows Explorer or whatever file management application you prefer.

Wrapping it up
Hopefully this give you a better idea of what the advancedsettings.xml file is and how it can help
you with Kodi cache problems.

Have you tried something similar? What settings worked for you? Let us know in the

Once you have created the XML File with the relevant settings

Go Back Up until you see Write XML file in Easy Advanced Settings
Application

Press write file

See File has been created message bottom RHS of screen

Then just to check go to

List enabled settings and you should see them there

Of course if not just go back and re-edit the relevant entry or entries

I did this last night, I dont know if this make sense, I compare the
settings over here over the kodi wiki how to, and find that on the
kodi wiki, the values dont have space, I followed kodi wiki and
removed the space between values, and then I clear the cache on
my exodus addon and the cache on kodi app, reboot my android
TV, and when I watched a movie it buffers one time after that the
movie plays smoothly, thank you for this solution.

Very detailed article until it got to the most important part, How to install the
advancedsettings.xml file. Then almost no information on how to actually do this?

Unfortunately this caused Kodi to crash every time I tried to open it.
Please elaborate on this section!

Assuming you have the Add On installer installed, go to programs,


click on Add On Installer, fine the Easy advanced settings add on,
click on it and install it. Go back to home screen, click on video
add ons, click on easy advanced settings and then click on
network, then click on network settings. There you will see the
cachemember buffer, curltimeout, ect settings. Enter the credentials
Tim has stated above. After all datat has been entered, click the
back arrow until you reach the menu where it has write XML
file. Click on it and wait for the notification in the bottom right
corner. Thats it. All done. Hope this helps.

o Tim Wells says

October 13, 2015 at 8:59 pm

If you currently have an advancedsettings.xml thats already in your userdata,


dont overwrite it. Take a look at the settings in that file and modify them using
the tips in this article.

I changed the 104857600 to the lager number because I have 6gb of ram

2. Open notepad or whatever program u use yo create a note

3. Paste the whole code in the note

4. Click save as name is advancedsettings.xml (no quotes) click the save as type: drop
down to All files (*.*) & make sure to save the file to a place you can easily find it.

5. Now ull need to find the add-on cashe on the device. In windows its this %APPDATA
%\kodi\userdata

6. If you dont see a advancedsettings.xml file there now u can just drag and drop the one
you just created, if there is one already there make sure it looks like the once in this
tutorial.
7. Now you can reboot the system and youll be all set