Kodi 17 - libnfs on RPi1 too slow for bluray files

  Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
belegdol Offline
Junior Member
Posts: 18
Joined: May 2014
Reputation: 0
Post: #1
Hello,
I have recently noticed that libnfs appears to be too slow to handle high bitrate bluray files. The performance seems to be barely below what is needed. I have a server running Fedora 25, and I was able to play the file flawlessly both using my smartphone as a client, as well as mounting the nfs share natively (by calling mount via command line).
I also found a discussion on github where some improvements to libnfs were being discussed [1], was there any further progress made?
[1] https://github.com/sahlberg/libnfs/issues/108

ETA: network graph when using native mount:
[Image: 544b1379d0ffcf2116b7108b7ab84c24]
network graph when using libnfs:
[Image: 9f40fd4608d49cc44f6e8695e18b5a8c]
(This post was last modified: 2017-05-14 19:50 by belegdol.)
find quote
popcornmix Offline
Team-Kodi Member
Posts: 7,868
Joined: Feb 2011
Reputation: 327
Post: #2
There were some experiments in increasing libnfs buffer size on Milhouse nightly builds.
Currently the change has been reverted, but this build still includes it:
http://forum.kodi.tv/showthread.php?tid=...pid2577222

Could you test that to see if there was any improvement?
find quote
belegdol Offline
Junior Member
Posts: 18
Joined: May 2014
Reputation: 0
Post: #3
It feels a tiny bit better subjectively, but it is still too slow for smooth playback. Here is how the network monitor looks like:
[Image: 10c012c5659507da104a598436f43f9c]
Please keep in mind that I can only run the Pi at medium overclock, otherwise I get blinking in menus.
find quote
popcornmix Offline
Team-Kodi Member
Posts: 7,868
Joined: Feb 2011
Reputation: 327
Post: #4
(2017-05-22 20:12)belegdol Wrote:  Please keep in mind that I can only run the Pi at medium overclock, otherwise I get blinking in menus.

Sounds like an insufficient power supply.
You could try adding config_hdmi_boost=7 to config.txt which may help, but I suspect better power supply is the real fix.
find quote
belegdol Offline
Junior Member
Posts: 18
Joined: May 2014
Reputation: 0
Post: #5
I tried config_hdmi_boost=7 but it does not seem to help. The power supply is 1.2 A one which I bought from RS components for the Pi, how does it look on paper?
In any case, I did some more thorough testing with latest Mulhouse build (23 May). Even with turbo overclock, native mount, UDP and rsize=8192 the playback stops every now and again. Looking at network monitor, the data seem to flow at around 5 MB/s only. On the other hand, dding a ~400 MB file to /dev/null reaches 7.3 MB/s. According to PlayerDebug CPU0 hovers around 100% so it appears that CPU is the limiting factor. I already enabled DTS passthrough and omxplayer, is there anywhere else where the few missing CPU cycles could be gained? Thanks!

Wysłane z mojego Nexus 9 przy użyciu Tapatalka
find quote
popcornmix Offline
Team-Kodi Member
Posts: 7,868
Joined: Feb 2011
Reputation: 327
Post: #6
In general OS mounts are more efficient that libnfs/libsmb

Can you try mounting from command line and playing from the local mount point?

You can also play with mounting options. e.g.
Code:
mount 192.168.4.9:/storage/test -o _netdev,nfsvers=3,rw,intr,noatime,rsize=32768,wsize=32768,nolock,async,proto=tcp​ /home/pi/dell
find quote
belegdol Offline
Junior Member
Posts: 18
Joined: May 2014
Reputation: 0
Post: #7
Hi,

I am already using an OS mount with the following options:
Code:
ro,udp,rsize=8192
rsize=8192 was the fastest based on dd tests

Wysłane z mojego Nexus 9 przy użyciu Tapatalka
find quote
belegdol Offline
Junior Member
Posts: 18
Joined: May 2014
Reputation: 0
Post: #8
In addition to the above, is there a reason why kodi would stream one file much faster than another? Both are bluray rips and the file which is being streamed faster (sufficient for smooth playback) - m1 - has actually higher bitrate than m2.
m1 mediainfo
Code:
General
Unique ID                                : 1 (0x1)
Complete name                            : m1/m1.mkv
Format                                   : Matroska
Format version                           : Version 4 / Version 2
File size                                : 39.4 GiB
Duration                                 : 2 h 13 min
Overall bit rate mode                    : Variable
Overall bit rate                         : 42.1 Mb/s
Movie name                               : m1
Encoded date                             : UTC 2017-03-21 20:49:12
Writing application                      : mkvmerge v9.9.0 ('Pick Up') 64bit
Writing library                          : libebml v1.3.4 + libmatroska v1.4.5
Cover                                    : Yes
Attachments                              : m1.jpg / m1.jpg / m1.jpg / m2.jpg

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : [email protected]
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 2 h 13 min
Bit rate mode                            : Variable
Maximum bit rate                         : 35.5 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Title                                    : m1
Language                                 : English
Default                                  : No
Forced                                   : No

Audio #1
ID                                       : 2
Format                                   : DTS
Format/Info                              : Digital Theater Systems
Format profile                           : MA / Core
Mode                                     : 16
Format settings, Endianness              : Big
Codec ID                                 : A_DTS
Duration                                 : 2 h 13 min
Bit rate mode                            : Variable / Constant
Bit rate                                 : Unknown / 1 509 kb/s
Channel(s)                               : 8 channels / 6 channels
Channel positions                        : Front: L C R, Side: L R, Back: L R, LFE / Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 93.750 FPS (512 spf)
Bit depth                                : 24 bits
Compression mode                         : Lossless / Lossy
Title                                    : m1
Language                                 : English
Default                                  : Yes
Forced                                   : No

Audio #2
ID                                       : 3
Format                                   : DTS
Format/Info                              : Digital Theater Systems
Mode                                     : 16
Format settings, Endianness              : Big
Codec ID                                 : A_DTS
Duration                                 : 2 h 13 min
Bit rate mode                            : Constant
Bit rate                                 : 1 509 kb/s
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 93.750 FPS (512 spf)
Bit depth                                : 24 bits
Compression mode                         : Lossy
Stream size                              : 1.41 GiB (4%)
Title                                    : m1
Language                                 : English
Default                                  : No
Forced                                   : No

Audio #3
ID                                       : 4
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Format settings, Endianness              : Big
Codec ID                                 : A_AC3
Duration                                 : 2 h 13 min
Bit rate mode                            : Constant
Bit rate                                 : 320 kb/s
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 spf)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 307 MiB (1%)
Title                                    : m1
Language                                 : English
Service kind                             : Complete Main
Default                                  : No
Forced                                   : No

Audio #4
ID                                       : 5
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Format settings, Endianness              : Big
Codec ID                                 : A_AC3
Duration                                 : 2 h 13 min
Bit rate mode                            : Constant
Bit rate                                 : 640 kb/s
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 spf)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 613 MiB (2%)
Title                                    : m1
Language                                 : French
Service kind                             : Complete Main
Default                                  : No
Forced                                   : No

Audio #5
ID                                       : 6
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Format settings, Endianness              : Big
Codec ID                                 : A_AC3
Duration                                 : 2 h 13 min
Bit rate mode                            : Constant
Bit rate                                 : 640 kb/s
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 spf)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 613 MiB (2%)
Title                                    : m1
Language                                 : Spanish
Service kind                             : Complete Main
Default                                  : No
Forced                                   : No

Text #1
ID                                       : 7
Format                                   : PGS
Muxing mode                              : zlib
Codec ID                                 : S_HDMV/PGS
Codec ID/Info                            : Picture based subtitle format used on BDs/HD-DVDs
Title                                    : English-PGS
Language                                 : English
Default                                  : No
Forced                                   : No

Text #2
ID                                       : 8
Format                                   : PGS
Muxing mode                              : zlib
Codec ID                                 : S_HDMV/PGS
Codec ID/Info                            : Picture based subtitle format used on BDs/HD-DVDs
Title                                    : French-PGS
Language                                 : French
Default                                  : No
Forced                                   : No

Text #3
ID                                       : 9
Format                                   : PGS
Muxing mode                              : zlib
Codec ID                                 : S_HDMV/PGS
Codec ID/Info                            : Picture based subtitle format used on BDs/HD-DVDs
Title                                    : Spanish-PGS
Language                                 : Spanish
Default                                  : No
Forced                                   : No

Text #4
ID                                       : 10
Format                                   : PGS
Muxing mode                              : zlib
Codec ID                                 : S_HDMV/PGS
Codec ID/Info                            : Picture based subtitle format used on BDs/HD-DVDs
Title                                    : French-FORCED-PGS
Language                                 : French
Default                                  : No
Forced                                   : No

Text #5
ID                                       : 11
Format                                   : PGS
Muxing mode                              : zlib
Codec ID                                 : S_HDMV/PGS
Codec ID/Info                            : Picture based subtitle format used on BDs/HD-DVDs
Title                                    : Spanish-FORCED-PGS
Language                                 : Spanish
Default                                  : No
Forced                                   : No

Menu
00:00:00.000                             : en:Chapter 01
00:02:34.654                             : en:Chapter 02
00:07:46.466                             : en:Chapter 03
00:08:42.813                             : en:Chapter 04
00:11:04.622                             : en:Chapter 05
00:12:21.198                             : en:Chapter 06
00:13:41.153                             : en:Chapter 07
00:17:19.913                             : en:Chapter 08
00:20:09.541                             : en:Chapter 09
00:21:54.771                             : en:Chapter 10
00:23:47.092                             : en:Chapter 11
00:24:31.386                             : en:Chapter 12
00:26:53.445                             : en:Chapter 13
00:27:46.623                             : en:Chapter 14
00:30:37.293                             : en:Chapter 15
00:33:53.406                             : en:Chapter 16
00:37:11.270                             : en:Chapter 17
00:42:30.089                             : en:Chapter 18
00:47:16.124                             : en:Chapter 19
00:51:04.144                             : en:Chapter 20
00:52:23.723                             : en:Chapter 21
00:55:53.266                             : en:Chapter 22
00:59:48.251                             : en:Chapter 23
01:02:07.807                             : en:Chapter 24
01:05:25.504                             : en:Chapter 25
01:10:24.094                             : en:Chapter 26
01:12:49.531                             : en:Chapter 27
01:16:28.458                             : en:Chapter 28
01:19:04.322                             : en:Chapter 29
01:21:55.160                             : en:Chapter 30
01:23:25.667                             : en:Chapter 31
01:25:58.987                             : en:Chapter 32
01:27:34.958                             : en:Chapter 33
01:29:57.308                             : en:Chapter 34
01:31:53.841                             : en:Chapter 35
01:34:18.736                             : en:Chapter 36
01:36:07.511                             : en:Chapter 37
01:37:48.237                             : en:Chapter 38
01:40:27.604                             : en:Chapter 39
01:42:44.074                             : en:Chapter 40
01:45:26.778                             : en:Chapter 41
01:47:55.010                             : en:Chapter 42
01:50:31.416                             : en:Chapter 43
01:53:28.885                             : en:Chapter 44
01:55:46.272                             : en:Chapter 45
01:59:23.447                             : en:Chapter 46
02:01:11.347                             : en:Chapter 47
02:03:15.596                             : en:Chapter 48
02:05:42.117                             : en:Chapter 49
m2 mediainfo
Code:
General
Unique ID                                : 2 (0x2)
Complete name                            : m2/m2.mkv
Format                                   : Matroska
Format version                           : Version 4 / Version 2
File size                                : 33.9 GiB
Duration                                 : 2 h 7 min
Overall bit rate mode                    : Variable
Overall bit rate                         : 38.0 Mb/s
Movie name                               : m2
Encoded date                             : UTC 2017-04-15 16:00:31
Writing application                      : mkvmerge v9.9.0 ('Pick Up') 64bit
Writing library                          : libebml v1.3.4 + libmatroska v1.4.5
Cover                                    : Yes
Attachments                              : m2.jpg / m2.jpg / m2.jpg / m2.jpg

Video
ID                                       : 1
Format                                   : AVC
Format/Info                              : Advanced Video Codec
Format profile                           : [email protected]
Format settings, CABAC                   : Yes
Format settings, ReFrames                : 4 frames
Codec ID                                 : V_MPEG4/ISO/AVC
Duration                                 : 2 h 7 min
Bit rate mode                            : Variable
Maximum bit rate                         : 37.0 Mb/s
Width                                    : 1 920 pixels
Height                                   : 1 080 pixels
Display aspect ratio                     : 16:9
Frame rate mode                          : Constant
Frame rate                               : 23.976 (24000/1001) FPS
Color space                              : YUV
Chroma subsampling                       : 4:2:0
Bit depth                                : 8 bits
Scan type                                : Progressive
Title                                    : m2
Language                                 : English
Default                                  : No
Forced                                   : No

Audio #1
ID                                       : 2
Format                                   : DTS
Format/Info                              : Digital Theater Systems
Format profile                           : MA / Core
Mode                                     : 16
Format settings, Endianness              : Big
Codec ID                                 : A_DTS
Duration                                 : 2 h 7 min
Bit rate mode                            : Variable / Constant
Bit rate                                 : Unknown / 1 509 kb/s
Channel(s)                               : 8 channels / 6 channels
Channel positions                        : Front: L C R, Side: L R, Back: L R, LFE / Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 93.750 FPS (512 spf)
Bit depth                                : 24 bits
Compression mode                         : Lossless / Lossy
Title                                    : m2
Language                                 : English
Default                                  : Yes
Forced                                   : No

Audio #2
ID                                       : 3
Format                                   : TrueHD
Format profile                           : TrueHD+Atmos / TrueHD
Codec ID                                 : A_TRUEHD
Bit rate mode                            : Variable
Maximum bit rate                         : 6 645 kb/s
Channel(s)                               : Object Based / 8 channels
Channel positions                        : Object Based / Front: L C R, Side: L R, Back: L R, LFE
Sampling rate                            :  / 48.0 kHz
Frame rate                               : 1 200.000 FPS (40 spf)
Compression mode                         : Lossless
Title                                    : m2
Language                                 : English
Default                                  : No
Forced                                   : No

Audio #3
ID                                       : 4
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Format settings, Endianness              : Big
Codec ID                                 : A_AC3
Duration                                 : 2 h 7 min
Bit rate mode                            : Constant
Bit rate                                 : 640 kb/s
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 spf)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 585 MiB (2%)
Title                                    : m2
Language                                 : English
Service kind                             : Complete Main
Default                                  : No
Forced                                   : No

Audio #4
ID                                       : 5
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Format settings, Endianness              : Big
Codec ID                                 : A_AC3
Duration                                 : 2 h 7 min
Bit rate mode                            : Constant
Bit rate                                 : 640 kb/s
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 spf)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 585 MiB (2%)
Title                                    : m2
Language                                 : Spanish
Service kind                             : Complete Main
Default                                  : No
Forced                                   : No

Audio #5
ID                                       : 6
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Format settings, Endianness              : Big
Codec ID                                 : A_AC3
Duration                                 : 2 h 7 min
Bit rate mode                            : Constant
Bit rate                                 : 640 kb/s
Channel(s)                               : 6 channels
Channel positions                        : Front: L C R, Side: L R, LFE
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 spf)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 585 MiB (2%)
Title                                    : m2
Language                                 : French
Service kind                             : Complete Main
Default                                  : No
Forced                                   : No

Audio #6
ID                                       : 7
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Mode                                     : Dolby Digital
Format settings, Endianness              : Big
Codec ID                                 : A_AC3
Duration                                 : 2 h 7 min
Bit rate mode                            : Constant
Bit rate                                 : 224 kb/s
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 spf)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 205 MiB (1%)
Title                                    : m2
Language                                 : English
Service kind                             : Complete Main
Default                                  : No
Forced                                   : No

Audio #7
ID                                       : 8
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Mode                                     : Dolby Digital
Format settings, Endianness              : Big
Codec ID                                 : A_AC3
Duration                                 : 2 h 7 min
Bit rate mode                            : Constant
Bit rate                                 : 224 kb/s
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 spf)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 205 MiB (1%)
Title                                    : m2
Language                                 : English
Service kind                             : Complete Main
Default                                  : No
Forced                                   : No

Audio #8
ID                                       : 9
Format                                   : AC-3
Format/Info                              : Audio Coding 3
Mode                                     : Dolby Digital
Format settings, Endianness              : Big
Codec ID                                 : A_AC3
Duration                                 : 2 h 7 min
Bit rate mode                            : Constant
Bit rate                                 : 224 kb/s
Channel(s)                               : 2 channels
Channel positions                        : Front: L R
Sampling rate                            : 48.0 kHz
Frame rate                               : 31.250 FPS (1536 spf)
Bit depth                                : 16 bits
Compression mode                         : Lossy
Stream size                              : 205 MiB (1%)
Title                                    : m2
Language                                 : English
Service kind                             : Complete Main
Default                                  : No
Forced                                   : No

Text #1
ID                                       : 10
Format                                   : PGS
Muxing mode                              : zlib
Codec ID                                 : S_HDMV/PGS
Codec ID/Info                            : Picture based subtitle format used on BDs/HD-DVDs
Title                                    : English-PGS
Language                                 : English
Default                                  : Yes
Forced                                   : No

Text #2
ID                                       : 11
Format                                   : PGS
Muxing mode                              : zlib
Codec ID                                 : S_HDMV/PGS
Codec ID/Info                            : Picture based subtitle format used on BDs/HD-DVDs
Title                                    : English-SDH
Language                                 : English
Default                                  : No
Forced                                   : No

Text #3
ID                                       : 12
Format                                   : PGS
Muxing mode                              : zlib
Codec ID                                 : S_HDMV/PGS
Codec ID/Info                            : Picture based subtitle format used on BDs/HD-DVDs
Title                                    : Spanish-PGS
Language                                 : Spanish
Default                                  : No
Forced                                   : No

Text #4
ID                                       : 13
Format                                   : PGS
Muxing mode                              : zlib
Codec ID                                 : S_HDMV/PGS
Codec ID/Info                            : Picture based subtitle format used on BDs/HD-DVDs
Title                                    : Spanish-FORCED-PGS
Language                                 : Spanish
Default                                  : No
Forced                                   : No

Text #5
ID                                       : 14
Format                                   : PGS
Muxing mode                              : zlib
Codec ID                                 : S_HDMV/PGS
Codec ID/Info                            : Picture based subtitle format used on BDs/HD-DVDs
Title                                    : French-PGS
Language                                 : French
Default                                  : No
Forced                                   : No

Text #6
ID                                       : 15
Format                                   : PGS
Muxing mode                              : zlib
Codec ID                                 : S_HDMV/PGS
Codec ID/Info                            : Picture based subtitle format used on BDs/HD-DVDs
Title                                    : French-FORCED-PGS
Language                                 : French
Default                                  : No
Forced                                   : No

Menu
00:00:00.000                             : en:Chapter 01
00:07:06.926                             : en:Chapter 02
00:17:30.883                             : en:Chapter 03
00:26:05.855                             : en:Chapter 04
00:31:14.038                             : en:Chapter 05
00:39:29.075                             : en:Chapter 06
00:46:17.566                             : en:Chapter 07
00:52:11.169                             : en:Chapter 08
00:58:50.360                             : en:Chapter 09
01:05:58.579                             : en:Chapter 10
01:13:01.293                             : en:Chapter 11
01:24:16.301                             : en:Chapter 12
01:31:50.880                             : en:Chapter 13
01:41:10.981                             : en:Chapter 14
01:46:07.611                             : en:Chapter 15
01:56:19.597                             : en:Chapter 16
find quote
popcornmix Offline
Team-Kodi Member
Posts: 7,868
Joined: Feb 2011
Reputation: 327
Post: #9
m2 may have a more variable bitrate, with higher peaks even though the average is less.
find quote
belegdol Offline
Junior Member
Posts: 18
Joined: May 2014
Reputation: 0
Post: #10
But would the variable bitrate influence how fast the file is transmitted over the network? I have been monitoring the speed using system monitor installed on the server and m1 is being served at around 6 MB/s whereas m2 caps at around 4 MB/s.
I think that for some reason the second file has higher CPU requirement and there is not enough left for NFS. Even with readfactor set to 2 and buffermode set to 1 the transfer speed is the same and playback is jerky while PlayerDebug shows CPU usage hovering around 100%. Looks like it might be the time to upgrade to Pi 3...

Wysłane z mojego XT1580 przy użyciu Tapatalka
find quote
albertstroh77 Offline
Senior Member
Posts: 110
Joined: Apr 2015
Reputation: 3
Post: #11
One more vote for OS level mounts. Solved buffering issues more than once for me.
find quote
belegdol Offline
Junior Member
Posts: 18
Joined: May 2014
Reputation: 0
Post: #12
I believe​ I may have solved this: when I checked the files I had available I realised that ones which only has dts-hd ma as the lossless audio were playing fine, wherereas ones which contained dolby atmos on top of that were running out of bandwidth. Not even os-level mount over udp and rsize=8192 was enough. To test my theory, I remuxed the latter files removing the atmos audio track (alongside other unneeded audio tracks and subtitles) and the bandwidth problems have disappeared.
It looks like having two lossless audio tracks in one bluray rip is the proverbial straw breaking the camel's back.

Wysłane z mojego Nexus 9 przy użyciu Tapatalka
(This post was last modified: 2017-06-18 19:05 by belegdol.)
find quote