2021-10-12, 03:43
Hello,
This post concerns mainly Kodi Leia, but not only, it might be useful for one lower or one higher release at least
I come here as the last resort, I think I've read most if not all the posts about kodi caching video files so let me try to explain
I post it in OS independent because I don't believe it has something to do with my OS (which is LE9.2)
I am a kodi user for several years now, I had kodi on windows and linux, with intel and arm arch processors
Mostly, I used kodi on RPI2, then RPI3, now RPI4 because I watch videos that gets heavier and heavier
I could watch a .avi video on RPI2, now I run RPI4 with .mkv movies over 30GB regularly
Now the introdution is done I'll setup the initial condition, the goal and the issues encountered
I have a hardware capable of running Kodi alone ( with a minimalistic OS underneath it of course )
My network is a gigabit LAN over ethernet
The video sources are pointing to an SMB share such as:
| KODI | <----- ethernet cable 1000Mbps -----> | Files sharing server |
The goal is to be able to play a single ~40-50 Gigabyte .mkv file containing a 2 hours movie on Kodi without buffering and stuttering
I'd start the movie and hit the "Pause" button to let Kodi cache it to RAM or most probably a disk (external HDD, SSD, SD, whatever)
My hardware is capable of decoding the codecs of such files and the network is obviously not a problem, I have dedicated ethernet cable for that
The constraints:
The file server is capable of sharing to any network equipment a speed up to 5 Megabytes per second
Now if my calculations are right, if I get the max upload from the file sharing server of 5 Megabytes per second, I could watch a movie of (5 * 60 * 60 * 2 / 1024) 35 Gigabytes for 2 hours without requiring advanced caching, which is far from the 50 Gigabyte movie required
In my case, I want to cache 7Gb of that movie in the RAM or even more on the disk (by pausing the playback at the beginning and come back and play it after caching)
Now let's go through the wikis and posts on forums:
I had no success configuring my Kodi with this wiki:
https://kodi.wiki/view/HOW-TO:Modify_the_video_cache
Settings used:
<buffermode>1</buffermode> : Buffer all filesystems, both internet and local
I tried also to write only 4 but no changes
<memorysize>894784853</memorysize> : The number is the buffer size in bytes (20971520 is the default, which is 20MB, which requires 60MB of free RAM)
So I run it on a RPI4 with 4Gigabytes of ram, then I get the free ram available from the debug statistics obtained from the player with the hotkey CTRL+SHIFT+O which would be around 2 and a half Gigabyte, divide by 3 and write the bytes it in the config file:
>>> 2.5/3*1024*1024*1024
894784853.3333334
894784853 that would be the ideal RAM to put on cache but! simple experiment, run the following command in the terminal just before starting the playback (on linux):
$> watch -n 1 'free -m'
this should show us how much RAM is left in Megabytes.
After starting the playback and pausing for caching, the RAM almost doesn't fill, +- 20Megabytes, that's all...
So I tell myself, sh*t, I misplaced a number or misunderstood something in the documentation, so I tried 89478485300, 8947848530, 89478485, 8947848, 894784, 89478, you get the idea... the setting doesn't do anything, so maybe if my RAM is not compatible something something kodi or linux version dependent bla bla, I disable it by writing 0 in the config file and monitor the filesystem with the following command:
$> watch -n 1 'df -h'
I must see the FS available space to reduce because I disabled RAM cache so it should exclusively write caches on disk, and I wait, I wait, I wait..., after 15 minutes of waiting and seeing no changes I try to play with one last setting
<readfactor>10</readfactor>: Increase the fill-rate of the cache
I did extensive tests with readfactor of 1, 2, 4, 10, 20, 50, 100, including going over all the values mentionned above over and over again
After hours of tests, I conclude that the advancedsettings.xml file has no effect on caching, but hey, maybe I just did everything wrong? So we continue to the next step
OpenWizard addon:
https://www.kodi-guide.com/how-to-fix-kodi-buffering/
Now that I tried to fix the things manually, I decided to use this addon, long story short, it has no effect on caching, the only good thing this addon did for me, is cache folder cleanup from time to time
This addon sets the advancedsettings.xml file to most optimal values if you select the right options (I tried them all)
Conclusion: sounds good, doesn't work
Some other links worth mentionning:
https://forum.kodi.tv/showthread.php?tid=221134
The guy had slow NFS on Kodi and got a workaround by mounting the NFS share with a script instead of relying on the Kodi media source
I tried to mount my SMB share with a command line and copy a single file from remote to local and measure the transfer speed
Conclusion: manually mounted SMB share or set up through media sources in Kodi GUI have same speed more or less
https://www.reddit.com/r/kodi/comments/q...hd_videos/
VLC caches the SMB shares better than kodi, the person seem to have a similar issue as me
I tried to fiddle with VLC Network caching settings, it works in milliseconds and not bytes, so I can write up to one minute of network caching which would make at my download rate, an advance of only 240 Megabytes, not that much but at least it works.
Conclusion: VLC Network caching settings functions as expected even if it's a bit limited, I could maybe try to recompile it and remove the max one minute setting network cache limit to get what I need, or find the config file responsible for it and write it here (might not work as I cope tho...)
https://forum.kodi.tv/showthread.php?tid=335626
This person tries to fiddle with the advancedsettings.xml like me
Conclusion: not much success for him...
Other 2 links without solution for me:
https://forum.kodi.tv/showthread.php?tid...memorysize
https://forum.kodi.tv/showthread.php?tid=314480
Conclusion:
I am not the only one with that issue as I can see, normal video players allow caching on disk or RAM without issue, and through native UI, not some config files
Now if it's too much to ask to have a decent caching system, let me know, I am ready to accept that my expectations are too high here
If I don't find the solution on this forum, I might consider abandonning running Kodi on Raspberry Pi, or running Kodi on LibreElec, or running Kodi, forever, I've spent too much time on that bullsh*t
Regards
This post concerns mainly Kodi Leia, but not only, it might be useful for one lower or one higher release at least
I come here as the last resort, I think I've read most if not all the posts about kodi caching video files so let me try to explain
I post it in OS independent because I don't believe it has something to do with my OS (which is LE9.2)
I am a kodi user for several years now, I had kodi on windows and linux, with intel and arm arch processors
Mostly, I used kodi on RPI2, then RPI3, now RPI4 because I watch videos that gets heavier and heavier
I could watch a .avi video on RPI2, now I run RPI4 with .mkv movies over 30GB regularly
Now the introdution is done I'll setup the initial condition, the goal and the issues encountered
I have a hardware capable of running Kodi alone ( with a minimalistic OS underneath it of course )
My network is a gigabit LAN over ethernet
The video sources are pointing to an SMB share such as:
| KODI | <----- ethernet cable 1000Mbps -----> | Files sharing server |
The goal is to be able to play a single ~40-50 Gigabyte .mkv file containing a 2 hours movie on Kodi without buffering and stuttering
I'd start the movie and hit the "Pause" button to let Kodi cache it to RAM or most probably a disk (external HDD, SSD, SD, whatever)
My hardware is capable of decoding the codecs of such files and the network is obviously not a problem, I have dedicated ethernet cable for that
The constraints:
The file server is capable of sharing to any network equipment a speed up to 5 Megabytes per second
Now if my calculations are right, if I get the max upload from the file sharing server of 5 Megabytes per second, I could watch a movie of (5 * 60 * 60 * 2 / 1024) 35 Gigabytes for 2 hours without requiring advanced caching, which is far from the 50 Gigabyte movie required
In my case, I want to cache 7Gb of that movie in the RAM or even more on the disk (by pausing the playback at the beginning and come back and play it after caching)
Now let's go through the wikis and posts on forums:
I had no success configuring my Kodi with this wiki:
https://kodi.wiki/view/HOW-TO:Modify_the_video_cache
Settings used:
<buffermode>1</buffermode> : Buffer all filesystems, both internet and local
I tried also to write only 4 but no changes
<memorysize>894784853</memorysize> : The number is the buffer size in bytes (20971520 is the default, which is 20MB, which requires 60MB of free RAM)
So I run it on a RPI4 with 4Gigabytes of ram, then I get the free ram available from the debug statistics obtained from the player with the hotkey CTRL+SHIFT+O which would be around 2 and a half Gigabyte, divide by 3 and write the bytes it in the config file:
>>> 2.5/3*1024*1024*1024
894784853.3333334
894784853 that would be the ideal RAM to put on cache but! simple experiment, run the following command in the terminal just before starting the playback (on linux):
$> watch -n 1 'free -m'
this should show us how much RAM is left in Megabytes.
After starting the playback and pausing for caching, the RAM almost doesn't fill, +- 20Megabytes, that's all...
So I tell myself, sh*t, I misplaced a number or misunderstood something in the documentation, so I tried 89478485300, 8947848530, 89478485, 8947848, 894784, 89478, you get the idea... the setting doesn't do anything, so maybe if my RAM is not compatible something something kodi or linux version dependent bla bla, I disable it by writing 0 in the config file and monitor the filesystem with the following command:
$> watch -n 1 'df -h'
I must see the FS available space to reduce because I disabled RAM cache so it should exclusively write caches on disk, and I wait, I wait, I wait..., after 15 minutes of waiting and seeing no changes I try to play with one last setting
<readfactor>10</readfactor>: Increase the fill-rate of the cache
I did extensive tests with readfactor of 1, 2, 4, 10, 20, 50, 100, including going over all the values mentionned above over and over again
After hours of tests, I conclude that the advancedsettings.xml file has no effect on caching, but hey, maybe I just did everything wrong? So we continue to the next step
OpenWizard addon:
https://www.kodi-guide.com/how-to-fix-kodi-buffering/
Now that I tried to fix the things manually, I decided to use this addon, long story short, it has no effect on caching, the only good thing this addon did for me, is cache folder cleanup from time to time
This addon sets the advancedsettings.xml file to most optimal values if you select the right options (I tried them all)
Conclusion: sounds good, doesn't work
Some other links worth mentionning:
https://forum.kodi.tv/showthread.php?tid=221134
The guy had slow NFS on Kodi and got a workaround by mounting the NFS share with a script instead of relying on the Kodi media source
I tried to mount my SMB share with a command line and copy a single file from remote to local and measure the transfer speed
Conclusion: manually mounted SMB share or set up through media sources in Kodi GUI have same speed more or less
https://www.reddit.com/r/kodi/comments/q...hd_videos/
VLC caches the SMB shares better than kodi, the person seem to have a similar issue as me
I tried to fiddle with VLC Network caching settings, it works in milliseconds and not bytes, so I can write up to one minute of network caching which would make at my download rate, an advance of only 240 Megabytes, not that much but at least it works.
Conclusion: VLC Network caching settings functions as expected even if it's a bit limited, I could maybe try to recompile it and remove the max one minute setting network cache limit to get what I need, or find the config file responsible for it and write it here (might not work as I cope tho...)
https://forum.kodi.tv/showthread.php?tid=335626
This person tries to fiddle with the advancedsettings.xml like me
Conclusion: not much success for him...
Other 2 links without solution for me:
https://forum.kodi.tv/showthread.php?tid...memorysize
https://forum.kodi.tv/showthread.php?tid=314480
Conclusion:
I am not the only one with that issue as I can see, normal video players allow caching on disk or RAM without issue, and through native UI, not some config files
Now if it's too much to ask to have a decent caching system, let me know, I am ready to accept that my expectations are too high here
If I don't find the solution on this forum, I might consider abandonning running Kodi on Raspberry Pi, or running Kodi on LibreElec, or running Kodi, forever, I've spent too much time on that bullsh*t
Regards