Optimize XBMC / Kodi Cache Settings on Linux

kodi-logo2

Prior to changing cache settings install Kodi on Arch Linux. The default cache size in XBMC / Kodi is quite conservative especially when considering high bitrate streams. This lack of buffer can cause “Cache is Full” errors when streaming video and a general poor streaming performance. Increasing the cache should fix this issue. Cache settings are changed manually by editing advancedsettings.xml file which also has more cache related settings that can improve streaming.

 

Create or open the settings file.

sudo nano ~/.kodi/userdata/advancedsettings.xml

If using kodi-standalone use the alternate path /var/lib/kodi/.kodi/userdata/advancedsettings.xml instead.

 

Copy the sample settings to advancedsettings.xml file.

<advancedsettings>
  <network>
    <buffermode>1</buffermode>
    <cachemembuffersize>157286400</cachemembuffersize><!-- 150MB -->
    <readbufferfactor>10</readbufferfactor>
  </network>
</advancedsettings>

Weather you are creating a new file or editing an existing one make sure you have at least advancedsettings tag and a network tag within it. All tags are optional and if missing default values will be used.

The default value of buffermode is 0 which enables caching for all internet streams and protocols. To enable buffering of all streams both internet and local use a value of 1. Value of 2 enables buffering only for true internet streams. To disable buffer entirely set the value to 3.

Default cachemembuffersize value is 20971520 bytes (20 MB). Since Kodi requires 3 times free RAM than this settings it will actually use 60 MB of RAM. Settings this too high can cause Kodi to crash when RAM is all used up. For unlimited caching a value of 0 can be used which uses the system disk for caching. This will cause significantly more wear and tear especially on SSD’s.

The value of readbufferfactor determines how fast the cache is filled. The default value of 1 will only buffer a little above the current playback progress. Any value above the default will cause the buffer to fill up at x times the bandwidth of the stream or as fast as the network or device bandwidth allows.

 

Quick Reference

Install Kodi on Arch Linux

sudo nano ~/.kodi/userdata/advancedsettings.xml
sudo nano /usr/share/kodi/userdata/advancedsettings.xml

dom