Linux pi3 + eth0 + openVpn + sshfs + kodi 17
#1
Question 
<Check the EDIT below please>

Hey guys,

i hope i am in the right forum-scetion here. I have a problem and I am running out of ideas.

Since four days now I am trying different *.img files, from LibreElec, OSMC, Raspian StretchLite to Frankenmatic.
But apart from the Frankenmatic one, i have always tiny amounts of lags / stuttering while watching a movies.
I really do not understand why Frankenmatic - which is the biggest IMG file from all tested - runs smooth because it does always load it's deskop too before / while launching kodi.
The other IMG files are way smaller and only load into termial or directly into kodi and are less heavy at all, but still not lag free, while Frankematic runs really smooth. 

I want to achieve a smooth playback using the rapsbian strech lite img because i want to be able to install even more software on top of kodi. Nextcloud would be another goal, to be able to synchronize calendar and contact-data from my android phone. But first I have to get rid of the lag in kodi to do so.

The main difference I see between Raspbian and Frankenmatic is the Kernel build, and the number of running and sleeping processes.

Raspbian:
Code:
pi@raspberrypi:~ $ uname -a
Linux raspberrypi 4.14.52-v7+ #1123 SMP Wed Jun 27 17:35:49 BST 2018 armv7l GNU/Linux

pi@raspberrypi:~ $ top
Tasks: 101 total,   1 running,  58 sleeping,   0 stopped,   0 zombie
%Cpu(s):  1,2 us,  0,5 sy,  0,0 ni, 98,3 id,  0,0 wa,  0,0 hi,  0,0 si,  0,0 st

Frankenmatic:
Code:
pi@frankenmatic:~ $ uname -a
Linux frankenmatic 4.9.35-v7+ #1014 SMP Fri Jun 30 14:47:43 BST 2017 armv7l GNU/Linux

pi@frankenmatic:~ $ top
Tasks: 173 total,   1 running, 172 sleeping,   0 stopped,   0 zombie
%Cpu(s):  2.1 us,  1.1 sy,  0.0 ni, 96.0 id,  0.8 wa,  0.0 hi,  0.0 si,  0.0 st

I am asking myself how it is possible to have 173 processes, but only 1 running - which is kodi - and to have 172 sleeping.



My setup is always as follows:
  • dd img to sdcard
  • Startup Pi
  • When possible I run raspi-config and turn on SSH, turn off VNC, setup Language/Keyboard, Set GPU mem to 256, Expand Filesystem and set Wait for Network at Boot to NO
  • Reboot
  • Then,
    Code:
    apt-get update && apt-get -y dist-upgrade && reboot
  • Add the MPG2 key and WVC1 key to config.txt
  • Next:
    Code:
    apt-get -y install openvpn sshfs rng-tools bmon iotop htop kodi
  • create advancedsettings.xml in .kodi/userdata/ with
Code:
<advancedsettings>
  <cache>
    <buffermode>1</buffermode>
    <memorysize>69206016</memorysize>
    <readfactor>40</readfactor>
  </cache>
</advancedsettings>
 
  • In general I turn off Swap - but makes no difference
  • start an openvpn connection to my home-server with:
Code:
client
dev tun
proto udp
port 1094
remote hostname.com
ca /etc/openvpn/pi3-transparent/ca.crt
cert /etc/openvpn/pi3-transparent/pi3-transparent.crt
key /etc/openvpn/pi3-transparent/pi3-transparent.key
script-security 2
up /etc/openvpn/update-resolv-conf
down /etc/openvpn/update-resolv-conf
verb 2
cipher AES-256-CBC
#cipher none
#mtu-test
fragment 1440
mssfix 1440
 
  • start sshfs with:
Code:
fs -p 2202 [email protected]:/home/alex/Filme-HDD/ /home/pi/media-fs/filme/ -o IdentityFile=/home/pi/.ssh/id_rsa,reconnect,Ciphers=arcfour,max_write=1024

 



EDIT: I have been able to fix the stuttering videos. Unfortunately my audiofiles (from mp3 over flac to wav) are stuttering:

I have fixed the stuttering when playing video in Raspbian by switching the hardware acceleration option from MMAL to OMXPlayer.

Unfortunately i have stuttering when playing audiofiles from my music library check https://forum.kodi.tv/showthread.php?tid=334464
Reply
#2
It's quite an opening post, but 99% of it is outside the scope of Kodi AFAICT. There are a few things:

- We don't care about the whole VPN crap. It's not a required part for Kodi itself to run.
- LibreELEC and OSMC are dedicated Kodi builds, Raspbian and Frankenmatic not so much IMO.
- Cranking up your buffer will wear out your SD card, and with a slowing down card, stutter problems could arise. (You really need that buffer?)
- Setting GPU mem to 256 by default. Why?!?

Start with providing a debug log (wiki) via pastebin of playing a video that has (micro)stutters, or other hiccups. Then we can see (or not) what is happening as far as Kodi is concerned.
Reply
#3
Hi Klojum,

i just created the Log File and uploaded it to pastebin. I hope this helps somehow. If you need any more information please let me know.
I am aware off that this is not a Kodibug, but i thought the community here is the right place to ask for the optimal settings to recieve a fluid playback of audio and video files.

To your questions / suggestions:
  • I use the buffer because it has a positive impact on the stream. I am also thinking about lowering that number at a minimum. But for now I am in a testing-stage.
  • About the GPU mem set to 256, well i did that because i am troubleshooting, and i thought a higher number, less trouble^^
  • The VPN crap, how you call it, is very important to me. This way i am able to access my server / services by opening only one port in my router. I have a huge Video, Audio, Pictures and Documents collection, that i want and sometimes need to access from the outside. Next would be Nextcloud, Android backups, Calendar etc. lots of sensitive data, and by only opening one port in my firewall i thought i am way more secure than thinking about how to harden each service (From Apache to SSH)

Best wishes,
Alex.
Reply
#4
Stream #0:0(eng): Video: h264, yuv420p, 700x480 [SAR 10:11 DAR 175:132], 31.25 fps, 31.25 tbr, 1k tbn, 48.27 tbc (default)

This is one of the weirdest video frame rate I've seen so far... 31.25 fps ?? I'm not a video guru, but how does that happen? There are plenty of adjustments going on:

Code:
10:44:17.349 T:1499456256 DEBUG: CDVDClock::ErrorAdjust - CVideoPlayerAudio::OutputPacket - error:-35942.400692, adjusted:-35942.400692
10:44:18.442 T:1499456256 DEBUG: CDVDClock::ErrorAdjust - CVideoPlayerAudio::OutputPacket - error:10722.565001, adjusted:10722.565001
10:44:19.304 T:1499456256 DEBUG: CDVDClock::ErrorAdjust - CVideoPlayerAudio::OutputPacket - error:-48750.268654, adjusted:-48750.268654
About the VPN statement: plenty of people on this forum use it for obvious other reasons, so sometimes the good suffer from the bad. It happens.
Reply
#5
(2018-08-03, 05:55)Klojum Wrote: - Cranking up your buffer will wear out your SD card, and with a slowing down card, stutter problems could arise. (You really need that buffer?)
Video cache is held in RAM, not on the sd card, unless zero cache is specified.
Reply
#6
Hello guys,

sorry that i didn't reply sooner, but frustration was high and i needed to take a rest before reengaging on this work.

The last days i kept using the Frankenmatic installation, streaming my movies from my home in germany to my apartment here in spain. I had absolutely no lags, no matter what kind of video source i selected (From 480p to 1080p). 
I have created a log file from the Frankenmatic one, to be able to compare it with the stuttering Raspbian one. I started logging this morning, but it appears the logfile begins yesterday night - perhaps because the pi was running since than.
I filtered out all lines, that did not contain any "error" with:
Code:
cat kodi.log | grep -i error > kodi.log.error
I have uploaded these filtered logfiles to Pastebin:  Raspbian_Error_Log | Frankenmatic_Error_Log
  1. The first thing that is obvious, none of the two Kodi-installations is error-free.
  2. Raspbian has a huge amount of CDVDClock::ErrorAdjust - CVideoPlayerAudio::OutputPacket errors while Frankenmatic only shows up one of this kind:
    Code:

    07:45:26.146 T:1544938416   DEBUG: CDVDClock::ErrorAdjust - CVideoPlayerAudio::OutputPacket - error:-30054.175984, adjusted:-30054.175984
  3. Frankenmatic only has two lines that say:
    Code:
    07:45:25.051 T:1923806128   DEBUG: ActiveAE::SyncStream - average error of -5.121583, start adjusting
    07:45:25.052 T:1923806128   DEBUG: ActiveAE::SyncStream - average error -0.121583 below threshold of 30.000000
    while the Raspbian installation has this six times more:
    Code:
     09:51:25.604 T:1882190592   DEBUG: ActiveAE::SyncStream - average error of -17.359532, start adjusting
    09:51:25.605 T:1882190592   DEBUG: ActiveAE::SyncStream - average error -0.359532 below threshold of 30.000000
    09:51:38.622 T:1882190592   DEBUG: ActiveAE::SyncStream - average error of 43.261312, start adjusting
    09:51:38.622 T:1882190592   DEBUG: ActiveAE::SyncStream - average error 0.261312 below threshold of 30.000000
    09:51:49.788 T:1882190592   DEBUG: ActiveAE::SyncStream - average error -153.066687 above threshold of 100.000000
    09:51:49.789 T:1882190592   DEBUG: ActiveAE::SyncStream - average error -3.066687 below threshold of 30.000000
    09:52:00.158 T:1882190592   DEBUG: ActiveAE::SyncStream - average error -146.017741 above threshold of 100.000000
    09:52:00.159 T:1882190592   DEBUG: ActiveAE::SyncStream - average error -0.017741 below threshold of 30.000000
    09:52:11.547 T:1882190592   DEBUG: ActiveAE::SyncStream - average error -236.047265 above threshold of 100.000000
    09:52:11.549 T:1882190592   DEBUG: ActiveAE::SyncStream - average error -0.047265 below threshold of 30.000000
    09:54:48.974 T:1882190592   DEBUG: ActiveAE::SyncStream - average error -105.997145 above threshold of 100.000000
    09:54:48.974 T:1882190592   DEBUG: ActiveAE::SyncStream - average error -5.997145 below threshold of 30.000000
  4. Rapsbian has a few errors that Frankenmatic does not show up:
    Code:
     09:50:52.385 T:1911730176   ERROR: DBus: Error org.freedesktop.DBus.Error.ServiceUnknown - The name org.freedesktop.UPower was not provided by any .service files
    09:50:53.362 T:1911730176   DEBUG: UDisks: org.freedesktop.DBus.Error.ServiceUnknown - The name org.freedesktop.UDisks was not provided by any .service files
    09:50:53.362 T:1911730176   DEBUG: DeviceKit.Disks: org.freedesktop.DBus.Error.ServiceUnknown - The name org.freedesktop.DeviceKit.Disks was not provided by any .service files

When comparing both LOG's it's obvious that the Rapsbian-Log shows way more errors. Especially when taking into account, that the Frankenmatic log logged a longer period ( while the Rapsbian log was only about a few minutes).
I have absolutely no clue why. I do even not understand what these error's mean that i have listed. If anybody could explain me some, i would be happy.
Last but not least, i want to remember my first hint that i did in this thread: How it is possible to have 173 processes sleeping, but only 1 running - which is kodi.

I somehow believe, that the Frankenmatic installation is way less cpu-intensive than the Raspbian one, and i would like to turn off as much processes as possible. As shown i my first posting: Frankenmatic has about ~170 loaded processes but nearly all of them are sleeping. Raspbian has about ~100 processes loaded and nearly 50% is running, while the other 50% is sleeping.

One more thing that i do not understand is when comparing the results of the free command.

Raspbian
Code:
 pi@raspberrypi:~ $ free
              total        used        free      shared  buff/cache   available
Mem:         766752       73956      541380        5184      151416      638224
Swap:             0           0           0


Frankenmatic
Code:
 pi@frankenmatic:~ $ free
             total       used       free     shared    buffers     cached
Mem:        750632     701892      48740      29880      54268     418664
-/+ buffers/cache:     228960     521672
Swap:            0          0          0

I would like to know why i have one more line in the Frankenmatic output, that does not show up in the Rapsbian output: -/+ buffers/cache:     228960     521672

Best wishes o/

PS:
Unfortunately the LogFile was to big to upload it to Pastebin so I have created a new one now, that fits the pastebin restrictions.
I have also uploaded the Frankenmatic-Kodi-Log i did refer to in this post at a filehoster named zippyshare: https://www118.zippyshare.com/v/KFf71tZQ/file.html
Reply
#7
That Frankenmatic is based on Raspbian also, and the Kodi versions are from the same source. The diference is that one is 17.3 and the other is 17.6. If the same happens on LibreELEC and OSMC, it is most likely a bug, most likely on the firmware. It has nothing to do with the system and the amount of proccesses running on the backgroung. That file has a weird fps (31.25fps) and, most likely that is the problem. Please upload a sample of that file for us to test.

PS: When posting logs, please post the full logs and not only a snippet.
Reply
#8
thx for your reply.

The weird fps 31.5 does also show up in the Frankenmatic log, where i do not have any issues when playing the file. As explained before, the log was to big to be uploaded to Pastebin, so i did upload it to a filehoster: https://www118.zippyshare.com/v/KFf71tZQ/file.html
If i am going to create a sample of that file and upload it somewhere how long (seconds) should that file be?
Reply
#9
The minimum amount to reproduce the problem.
Reply
#10
i am convinced that we are on a wrong path here.
As said, i had no problems with the frankenmatic img. I was able to play smooth all kinds of videos. They do not all have the same fps. Also they had different resolutions etc.
Also i have a second pi3 here and no matter which oh the two pi's i use, both show exactly the same effects.
As far as i understand firmware is implemented inside the hardware somehow or is the firmware implemented different on the pi's?
Reply
#11
(2018-08-06, 15:23)AlexOnLinux Wrote: As far as i understand firmware is implemented inside the hardware somehow or is the firmware implemented different on the pi's?

Firmware is just files on the sdcard that run on the GPU.
Reply
#12
(2018-08-06, 15:23)AlexOnLinux Wrote: i am convinced that we are on a wrong path here.
As said, i had no problems with the frankenmatic img. I was able to play smooth all kinds of videos. They do not all have the same fps. Also they had different resolutions etc.
Also i have a second pi3 here and no matter which oh the two pi's i use, both show exactly the same effects.
As far as i understand firmware is implemented inside the hardware somehow or is the firmware implemented different on the pi's?
The only problem I can see on the Raspbian log is when you play one of that 31.25 fps video files. No attempt was made to play other video files. Other errors shown are not relevant/important/unrelated. From your logs:

Frankenmatic:
10:39:41.824 T:1910841344 NOTICE: Raspberry PI firmware version: Jul 3 2018 14:15:46 Copyright © 2012 Broadcom version 47b05c853342eb6e4ea5b017d981e0ef247fb8be (clean) (release):
09:37:50.776 T:1945215648  NOTICE: Starting Kodi (17.3 Git:20170525-1789806-dirty). Platform: Linux ARM 32-bit
09:37:50.776 T:1945215648  NOTICE: Using Release Kodi x32 build (version for Raspberry Pi)
09:37:50.776 T:1945215648  NOTICE: Kodi compiled May 25 2017 by GCC 4.9.2 for Linux ARM 32-bit version 3.16.7 (200711)
09:37:50.776 T:1945215648  NOTICE: Running on Raspbian GNU/Linux 8 (jessie), kernel: Linux ARM 32-bit version 4.9.35-v7+
...
09:37:54.275 T:1945215648  NOTICE: Raspberry PI firmware version: Jul  3 2017 14:16:43
                                            Copyright © 2012 Broadcom
                                            version 4139c62f14cafdb7d918a3eaa0dbd68cf434e0d8 (tainted) (release)

Raspbian Stretch Lite:
10:39:40.838 T:1910841344 NOTICE: Starting Kodi (17.6 Git:20171115-d69a54a). Platform: Linux ARM 32-bit 10:39:40.838 T:1910841344 NOTICE: Using Release Kodi x32 build (version for Raspberry Pi) 10:39:40.838 T:1910841344 NOTICE: Kodi compiled Nov 23 2017 by GCC 6.3.0 for Linux ARM 32-bit version 4.9.53 (264501) 10:39:40.839 T:1910841344 NOTICE: Running on Raspbian GNU/Linux 9 (stretch), kernel: Linux ARM 32-bit version 4.14.52-v7+ ... 10:39:41.824 T:1910841344 NOTICE: Raspberry PI firmware version: Jul 3 2018 14:15:46 Copyright © 2012 Broadcom version 47b05c853342eb6e4ea5b017d981e0ef247fb8be (clean) (release):
10:39:40.838 T:1910841344  NOTICE: Starting Kodi (17.6 Git:20171115-d69a54a). Platform: Linux ARM 32-bit
10:39:40.838 T:1910841344  NOTICE: Using Release Kodi x32 build (version for Raspberry Pi)
10:39:40.838 T:1910841344  NOTICE: Kodi compiled Nov 23 2017 by GCC 6.3.0 for Linux ARM 32-bit version 4.9.53 (264501)
10:39:40.839 T:1910841344  NOTICE: Running on Raspbian GNU/Linux 9 (stretch), kernel: Linux ARM 32-bit version 4.14.52-v7+
...
10:39:41.824 T:1910841344  NOTICE: Raspberry PI firmware version: Jul  3 2018 14:15:46
                                            Copyright © 2012 Broadcom
                                            version 47b05c853342eb6e4ea5b017d981e0ef247fb8be (clean) (release)

So, both running Raspbian, one Jessie the other Stretch (more recent). Kodi is from the same source, raspberrypi.org. Different kernel and firmwares.
So the problem most likely is on the newer Kodi versions, firmware or even on your Kodi settings. A sample of that video file will help to determine the problem.
Reply
#13
Thank you rascas for support,

i think you are right, It is due to the other version of Kodi or Firmware,
I updated my Frankenmatic yesterday night from Jessie to Stretch + i upgraded all software incl. Kodi 17.6 -  took a few hours to do that dist-upgrade. After that i did also upgrade the firmware by following this guide.
After i finished with all this, i was unable to play smooth video or audiofiles until i changed the hardware acceleration option in kodi. Than i tried the Raspbian-OS-IMG and switched that hardware acceleration mode in there too, to see if that helps. And bang, suddenly i had no more video-stuttering when using that Raspianimage. But unfortunately now i am unable to play smooth audiofiles in neither of the two debian stretch images (Raspbian and Frankenmatic)

I did edit my first posting, because now i have a new problem - the audiofiles don't run smooth anymore.
Reply
#14
Please don't edit posts. I doubt that someone is going to read or reread all of this to help you. I am not even sure what's your problem now, there is no log... If it is a different problem, make a new post.
Reply
#15
Roger, i have created a new thread for the audio issues. https://forum.kodi.tv/showthread.php?tid=334464

Thank you and best wishes o/
Reply

Logout Mark Read Team Forum Stats Members Help
pi3 + eth0 + openVpn + sshfs + kodi 170