HOW-TO:Modify the video cache: Difference between revisions

From Official Kodi Wiki
Jump to navigation Jump to search
(v21 Updates -)
Tag: Replaced
 
(36 intermediate revisions by 10 users not shown)
Line 1: Line 1:
{{mininav| [[advancedsettings.xml]] {{l2| [[Video library]] }} }}
{{mininav| [[advancedsettings.xml]] {{l2| [[Video library]] }} }}
<section begin="intro" />This page describes '''three [[advancedsettings.xml]] settings''' that can be used to maximize the video playback cache. You can use all or just a couple of these settings to see significant improvements in cache performance, should you require it ''(most users will not require these modifications)''. This can help with intermittent network issues, buffering, reduce how long the network is tied up, and sometimes improve battery life.<section end="intro" />




{{note|Even if you change the cache settings in XBMC, that won't change how fast the video file data comes in over the network. For example, it won't make a slow server load the video any faster.}}
The cache tags in the advancedsettings.xml file have been deprecated.


The cache settings are now adjusted in the '''[[Settings/Services/Caching|Settings ► Services ► Caching]]''' settings page.


{{TOC limit|2}}
== Steps ==
If you don't already have an [[advancedsettings.xml]] file, it's very simple to make. XBMC uses this file for advanced settings and features that normal users shouldn't modify without first knowing what they do, as well as for experimental features, etc.


{{how-to
{{Updated|21}}
| Step1 = Since you can use all or just some of the following settings, let's start out with the basic file. Create a '''plain text file''' (no rich text formatting, don't use .doc, etc) and save it as '''advancedsettings.xml'''. Make sure that the file extension is ".xml" and {{color|red|'''not'''}} ".txt" or ".xml.txt".
 
| Step2 = Cut and paste this into your new plain text file:
:<syntaxhighlight lang="xml" enclose="div">
<advancedsettings>
  <network>
    <!--- The three settings will go in this space, between the two network tags. --->
  </network>
</advancedsettings>
</syntaxhighlight>
 
| Step3 = Add some or all of the settings tags from the '''[[#Cache settings|next section]]'''.
 
| Step4 = Save this file in your [[userdata folder]]:
{{note|If you have an existing file, make sure the <network></network> tags, and settings we'll add between them, are between the main <advancedsettings></advancedsettings> tags.}}
::{{#lst:userdata|location all}}
}}
 
==Cache settings==
{| class="prettytable"
! advancedsettings.xml tag !! what it does
|-
| <code><buffermode>'''1'''</buffermode></code>
 
| {{infobox|datastyle=background:#ddf;|data1=Requires XBMC v13.0 or higher}}{{big|'''Choose what to buffer'''}}
 
This setting will force XBMC to use a cache for all video files, including local network, internet, and even the local hard drive. Default value is 0 and will only cache videos that use internet file paths/sources.
 
{| class="datatable"
|-
| 0 || Buffer all internet filesystems (like "2" but additionally also ftp, webdav, etc.) (default)
|-
| 1 || Buffer all filesystems, both internet and local
|-
| 2 || Only buffer true internet filesystems (streams) (http, etc.)
|-
| 3 || No buffer
|}
|-
| <code><cachemembuffersize>'''20971520'''</cachemembuffersize></code>
 
| {{infobox|datastyle=background:#ddf;|data1=Requires XBMC v12.0 or higher}}{{big|'''Increasing the cache'''}}
 
Here we can do two things:
* {{Big|'''Value: 20971520''' ''(or any value, in bytes)''}} '''-''' keep the cache in RAM, but increase how much RAM is used. The number is the buffer size in bytes ''(20971520 is the default, which is 20MB, which requires 60MB of free RAM)''. XBMC will not buffer ahead more than this. {{Note|For the memory size set here, XBMC will require 3x the amount of RAM to be free. Setting this too high might cause XBMC to crash if it can't get enough RAM.}}
'''''or'''''
* '''{{Big|Value: 0}} -''' we can use the local disk memory (typically your hard drive), which will not put any limit on the size (outside of the size of your drive).  This also allows devices with low RAM, such as the [[Raspberry Pi]], to cache more than they normally would due to the small amount of RAM they have. The cache is deleted from the local disk whenever playback is stopped. {{note|This will likely cause increased wear-and-tear on your drive.}}
|-
| <code><readbufferfactor>'''10'''</readbufferfactor></code>
 
| {{infobox|datastyle=background:#ddf;|data1=Requires XBMC v13.0 or higher}}{{big|'''Increase the fill-rate of the cache'''}}
 
By default '''(value: 1)''', XBMC will only fill the cache a little above what is needed to play it back. It does this as to not max out your network and possibly max out some hardware. For most users and hardware, this setting shouldn't cause any issues, but be aware of it if you have unusual CPU spikes in your HTPC.
 
 
The value of this setting is a multiplier of the default limit. If XBMC is loading a typical bluray raw file at 36 Mbit/s, then a value of '''2''' will need at least 72 Mbit/s of network bandwidth. However, unlike with the RAM setting, you can safely increase this value however high you want, and XBMC won't crash. Just know that it might cause XBMC to attempt to use all available bandwidth on your HTPC during playback.
|}
 
==Examples==
 
===Example 1===
All three options enabled, using local hard drive for cache.
 
;advancedsettings.xml
<syntaxhighlight lang="xml" enclose="div">
<advancedsettings>
  <network>
    <buffermode>1</buffermode>
    <cachemembuffersize>0</cachemembuffersize>
    <readbufferfactor>10</readbufferfactor>
  </network>
</advancedsettings>
</syntaxhighlight>
 
===Example 2===
Only cache size changed, using 100MB of RAM for cache (which requires 300MB of free RAM).
 
;advancedsettings.xml
<syntaxhighlight lang="xml" enclose="div">
<advancedsettings>
  <network>
    <cachemembuffersize>104857600</cachemembuffersize>
  </network>
</advancedsettings>
</syntaxhighlight>
 
===Example 3===
Two options enabled, using 50MB of RAM for cache (which requires 150MB of free RAM), and cache both internet, LAN, and local content.
 
;advancedsettings.xml
<syntaxhighlight lang="xml" enclose="div">
<advancedsettings>
  <network>
    <buffermode>1</buffermode>
    <cachemembuffersize>52428800</cachemembuffersize>
  </network>
</advancedsettings>
</syntaxhighlight>
 
=== Example 4 ===
A safe setting for most devices with 1GB of RAM that should help most users "on the edge". All protocols get cached, cache rate fills up pretty much as fast as possible, and cache size is 150MB, using 400MB of ram total.
 
;advancedsettings.xml
<syntaxhighlight lang="xml" enclose="div">
<advancedsettings>
  <network>
    <buffermode>1</buffermode>
    <cachemembuffersize>157286400</cachemembuffersize>
    <readbufferfactor>20</readbufferfactor>
  </network>
</advancedsettings>
</syntaxhighlight>
 
=== Example 5 ===
 
If you find XBMC/Kodi instructions and videos as baffling as I do perhaps this solution I've cherry-picked from different posts will help. It worked for me using a Windows 7 computer with 8 GB RAM.
 
First...Before getting Kodi I added the advancedsettings.xml file to my XBMC userdata folder. When I downloaded Kodi the information in the file changed. So I would suggest clicking Start and typing userdata in the Search box. Click userdata and see if you have an advancedsettings.xml folder listed. If you do, click on it, copy and save what's inside where you can find it again just in case, then replace what's inside with:
 
<!-- zerocache -->
<advancedsettings>
<network>   
<buffermode>1</buffermode>
<cachemembuffersize>157286400</cachemembuffersize>
<readbufferfactor>20</readbufferfactor>
<curlclienttimeout>45</curlclienttimeout>
</network>
<gui>   
<algorithmdirtyregions>3</algorithmdirtyregions>
<nofliptimeout>0</nofliptimeout>
</gui>
<videoscanner>
<ignoreerrors>true</ignoreerrors>
</videoscanner>
</advancedsettings>
 
Click the X on the top right hand side of the box. Click Save. Close the userdata folder.
 
If you don't see an advancesettings.xml file in your userdata folder just do the following:
 
Right click in an open area below the files and folders in userdata.
Put cursor on New and scroll over and down and click on Text Document.
Look up at the list in userdata and right click on NewTextDocument.txt  .
Click Open. (You may have to click elsewhere in the folder then go back and right click on NewTextDocument.txt if the Open option doesn’t appear.).
Copy the following…
 
<!-- zerocache -->
<advancedsettings>
<network>   
<buffermode>1</buffermode>
<cachemembuffersize>157286400</cachemembuffersize>
<readbufferfactor>20</readbufferfactor>
<curlclienttimeout>45</curlclienttimeout>
</network>
<gui>   
<algorithmdirtyregions>3</algorithmdirtyregions>
<nofliptimeout>0</nofliptimeout>
</gui>
<videoscanner>
<ignoreerrors>true</ignoreerrors>
</videoscanner>
</advancedsettings>
 
…and paste it into the NewTextDocument.txt .
Click File.
Click Save As.
In the File name box type advancedsettings.xml .
Click Save.
Open (or close and restart) XBMC.
Enjoy.
 
==Notes==
<references />
 
{{Gotham updated}}


[[Category:Advanced topics]]
[[Category:Advanced topics]]
[[Category:How-to]]
[[Category:How-to]]
[[Category:Video library]]
[[Category:Video library]]

Latest revision as of 19:04, 6 May 2024

Home icon grey.png   ▶ advancedsettings.xml
▶ Video library
▶ HOW-TO:Modify the video cache


The cache tags in the advancedsettings.xml file have been deprecated.

The cache settings are now adjusted in the Settings ► Services ► Caching settings page.