Odroid N2+ and lots of skipped frames for NFS-mounted files

Hey folks

For years I was running LibreElec on my old Odroid C2 and was very content with the smooth video playback. Recently I bought a newer Odroid N2+ and installed CoreElec 20.2 on it. At first, everything seemed great. But then I noticed that quite a few videos show a lot of judder, to the extent that the video freezes for up to one second before continuing.

I use the setting “Adjust display refresh rate” which, in particular together with the no longer available “sync playback to display” setting worked wonders on my old setup. I played around with lots of settings, in particular set a whitelist of all the supported modes, but ultimately I cannot seem to arrive at a smooth playback experience. Hence my post here.

From what I can tell, the issue mostly (?) appears with videos with 29.97fps, which my monitor does not support natively. To investigate, I enabled debug logging and skimmed the log for obvious pointers but I could not find anything clear.

Edit: The issue also exclusively seems to appear for files located on an NFS mount. Local files play fine.

Here is an incomplete list of what I investigated:

  • In the Player Debug overlay, the “skip” counter increases by anything between 1 and 30 whenever a freeze happens
  • The freezes seemingly happen at random times in the video, sometimes the video plays fine for a whole minute before freezing again 10 times in 10 seconds.
  • CPU load on the Odroid seems constantly in the 30% range so likely not a problem
  • Cache level in the Player Debug Overlay suggests that the cache is always full enough
  • Turned off “Adjust display refresh rate”, no change
  • Turned off hardware acceleration, no change·
  • Replacing OdroidN2+CoreElec with my old system, I get smooth playback, so cables/TV are not to be blamed

Here you can find the debug log of watching a video that first played fine for around two minutes but then suddenly experienced a burst of skipped frames starting around the log timestamp 23:14:34.

I’d really appreciate your help for finding what is wrong in my setup. Thanks!

Maybe your TV does not support 29,97/59.94Hz?
The Video is displayed with a frame rate of 33ms, this is a rate of 30,3Hz?

Try with clean fresh install and make proper logs:
https://wiki.coreelec.org/coreelec:ce_support

My TV definitely does not support 29,97/59,94Hz natively but I’ve been able to reproduce the issue also with 24/25/30 fps videos that are natively supported, so that does not seem to be the issue.

I’ve tried with a clean install and it turns out that the issue seems very likely related to my video files being on an NFS filesystem. I can play the exact same file from a local source without any skips but as soon as I attempt to play it from NFS, I get the occasional skip.

Naturally, I thought that this was related to buffer underruns, so I increased the cache size in advancedsettings.xml, which, from what I can tell, improves the situation but does not get rid of it completely.

Here are the “proper logs” as requested:

And here are a couple of observations I’ve made:

  • It feels as if skipping back 10s sometimes (?) fixes the problem for the next 10-15min but then it just comes back.
  • The cache fill level in the player debug overlay always shows roughly the same number, so the player cache never empties. Behind the cache size there is a percentage number which sometimes drops to 0%. This seems to be correlated with the frame skips but it is not always the case.

For NFS you can try to use a kodi network buffer parameter. @boot2k3 do know something about it.

As mentioned in my post, I already increased the cache size quite a bit. Here is what my advancedsettings.xml looks like:

<advancedsettings>
  <cache>
    <buffermode>1</buffermode>   # Cache all file systems
    <memorysize>67108864</memorysize>    # Cache size 64MB
    <readfactor>5</readfactor>    # Fill cache quickly
    <chunksize>1048576</chunksize>     # NFS chunk size
  </cache>
</advancedsettings>

Is there something else that I am missing?

I played around a bit more and it seems that the problem is related to Kodi’s NFS implementation. I get random frame skips when the source file in Kodi has a nfs:// path, meaning that Kodi handles the interaction with the NFS server. When I instead natively mount the nfs share in CoreElec, outside of Kodi, then Kodi plays the file without any skipped frames.

Is it possible that for some reason there is contention between the thread that populates the cache and the thread that renders the video, so that in some cases the former can stall the latter? That would match the symptoms I see very well. Is it possible that they maybe run in the same thread?

I know this thread is closed but I have just encountered this issue with my Nexus install.
I started digging because my playback was getting very ropey with lots of stalls and crashes, I thought it was my network at fault but then suspected that it might be a NFS protocol mismatch so I locked my Coreelec client to V4 and my OpenmediaVault server to V4 as well. This broke all shares on my Kodi box and no amount of messing about with the settings brought them back - they were showing up on media selector but it was impossible to browse into the share.
In the end I have had to migrate all my Kodi shares to SMB (not best pleased).

It seems that this is fundamentally a Kodi issue as people are reporting it on all platforms so I doubt there is much that can be done. The funny thing is that it only just emerged as an issue after faultless NFS behaviour for the last couple of years. It also seems that whatever it is is not a high priority for the Kodi devs as its been hanging for quite some time at this stage.

Bummer.

1 Like

There are also a lot of issues with SMB shares.
I start a movie from NAS and hit pause. Leave it there until NAS HDD fall asleep. Then I continue playback and rewind 10s. Kodi do freeze.
Same happen on Ubuntu Kodi.

There are so many thread mutex locks in Kodi so I guess they lost the overview and produce dead locks on multiple places…

Its a mighty pain when some excellent functionality gets broken because a dev just doesn’t pay enough attention to checking. My brother who is a long standing programmer hates Kodi because of its buggyness.

i am going to attempt to use autostart.sh to mount my NFS shares - apparently that locks Kodi out of messing it up.

UPDATE: at least in the case of Coreelec loading the NFS shares at boot manually did not avoid the issues introduced by kodi - so for the time being it will have to be SMB.