LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - ARM
User Name
Password
Slackware - ARM This forum is for the discussion of Slackware ARM.

Notices


Reply
  Search this Thread
Old 10-07-2019, 11:59 AM   #1
tarnow
LQ Newbie
 
Registered: Sep 2019
Posts: 17

Rep: Reputation: Disabled
Raspberry Pi 4 + Slackware ARM -current + Kodi 18.4 + FFmpeg 4.2 with x265


Hello Everybody,

In case somebody wants to try the new Raspberry Pi 4 with Slackware and Kodi here is more information.
http://axes2solution.com/kodi-slackware.html
 
Old 10-08-2019, 12:15 PM   #2
stormtracknole
Senior Member
 
Registered: Aug 2005
Distribution: Slackware, RHEL
Posts: 1,259

Rep: Reputation: 231Reputation: 231Reputation: 231
Quote:
Originally Posted by tarnow View Post
Hello Everybody,

In case somebody wants to try the new Raspberry Pi 4 with Slackware and Kodi here is more information.
http://axes2solution.com/kodi-slackware.html
This is great. Thank you for sharing!
 
Old 10-08-2019, 04:33 PM   #3
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
Nice work tarnow!

I'm not planning to get a Pi4, actually actively moving away from Raspberries (and ARM in general), but since I've spent some time optimizing, building and documenting the Kodi 17 & 18 releases for Raspberries up to Pi3B+, I have some questions/curiosities.

I took a look on both the xbmc.SlackBuild and the kodi.patch you provided and I'm wondering:

1. while patching the FFMPEG Makefile, are you sure you enabled the HW accelerated decoding for x264 & x265 (you forgot to do it for the MPEG2, but that was not activated anyways without a license on all the Raspberries - I had to buy such licences) with the configure switches: --enable-libx265 --enable-libx264 ?
In my last attempt to get FFMPEG working properly with the MMAL acceleration (without x265), I had to use specific configure switches and also to patch the FFMPEG code:
https://www.linuxquestions.org/quest...5/#post5958276
I also realized that the very efficient OMX decoding was broken and noticed that they don't really care about it anymore, dropped it already in Kodi 19. Frankly, this was also the point I started to loose interest in Raspberries.
I noticed you enabled it in the FFMPEG build with --enable-omx --enable-omx-rpi. Is it working OK? It was useless for me on PVR (DVB) streams in Kodi 18.1 - constantly interrupting.

2. in the xbmc.SlackBuild you provide the configure script the --with-platform=raspberry-pi4 directive. Wondering if in Kodi 18.4 the appropriate Rpi 4 optimization flags (for this target platform) are already available in cmake/scripts/linux/ArchSetup.cmake ?
I remember I had to patch that file:
https://www.linuxquestions.org/quest...5/#post5957433

3. Noticed in your kodi.patch that you're modifying (patching): VaapiEGL.cpp, EGLUtils.cpp, GLContextEGL.cpp, GLContextEGL.h (maybe missed one)
Is that really necessary? Where did you get the patches from?


The Pi4 is a powerful device and it could handle the video decoding even on SW level (not sure about 4K) and even without properly optimizing the code (both Kodi and FFMPEG) for its CPU capabilities (HW video decoding and NEON SIMD extension).
 
Old 10-10-2019, 12:35 AM   #4
tarnow
LQ Newbie
 
Registered: Sep 2019
Posts: 17

Original Poster
Rep: Reputation: Disabled
Many thanks for your interest abga.

1. According to https://www.raspberrypi.org/document...odeclicence.md MPEG2 and VC1 hardware codecs are permanently disabled in RPI4 in favor of software codecs. I have only tested H.264 and H.265 videos so I have no idea if other video decoding will work. Under FFmpeg, hardware acceleration can be enabled with configuration options "--enable-gpl" and "--enable-mmal", assuming that you have the required mmal header files. This is the only thing that I did, no source code patching there. The hardware acceleration usage can be seen either in Kodi System Information page or with glxinfo. Both of the omx flags I have left for backward compatibility and I have not tested OMX. On Kodi forum someone suggested to use popcornmix's FFmpeg 4.0.4 as it has some good HVEC optimisation for RPI4. Currently I am not happy with 4K HVEC test results (software decoding) so I will give it a try.

2. For the flag --with-platform=raspberry-pi4 I have not noticed any difference if it is set to pi3 or pi4. I guess for RPI4 this can be set to one of these two.

3. The kodi.patch is a collection of fixes for errors encountered during compilation. I have not done any optimization or improvements there. I wanted to make the compiler happy. Those patches are based on my experience and various code fixes found on the internet, thanks google

All in all, this is just a collection of ideas that I wanted to put together to make a working system, pack it up in a single slackbuild package and share it with you. Please feel free to modify it however you like it.

Last edited by tarnow; 10-10-2019 at 12:36 AM.
 
1 members found this post helpful.
Old 10-10-2019, 04:30 PM   #5
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
Thanks for your replies. I'm still running Kodi 17 on Pi Zero, wanted to upgrade to Kodi 18, documented the build process here in the forum and stopped when I realized that OMX is broken. Your fresh work just stimulated my curiosity and wanted to learn about the new developments, including the support for Pi4. BTW, thanks for the info about the MPEG2 and VC1 hardware acceleration deactivation, missed that one.

Based on your replies, I did some checks and realized that Pi4 is not yet officially supported in Kodi 18.4.
In your SlackBuild, in which you build Kodi a little different than the official recommended way (with the help of cmake), you're configuring the platform "--with-platform=raspberry-pi4 ". That platform apparently doesn't exist in tools/depends/configure.ac, but only:
Code:
  raspberry-pi)
...
  raspberry-pi2)
...
  raspberry-pi3)
Nor in the file I mentioned in my first reply, used in the officially recommended build method - cmake/scripts/linux/ArchSetup.cmake
At least now it contains optimizations for Pi2/ Pi3:
Code:
# temp until further cleanup is done
# add Raspberry Pi 2 and 3 specific flags
if(CORE_PLATFORM_NAME_LC STREQUAL rbpi)
  if(CPU MATCHES "cortex-a7")
    set(NEON_FLAGS "-fPIC -mcpu=cortex-a7 -mfloat-abi=hard -mfpu=neon-vfpv4 -mvectorize-with-neon-quad")
  elseif(CPU MATCHES "cortex-a53")
    set(NEON_FLAGS "-fPIC -mcpu=cortex-a53 -mfloat-abi=hard -mfpu=neon-fp-armv8 -mvectorize-with-neon-quad")
  endif()
endif()
On FFMPEG, noticed that they still use their own Kodi "specialized" version and not the mainstream one:
https://github.com/xbmc/FFmpeg/archi...ia-18.4.tar.gz
The configure options I referenced in an older post of mine: --enable-decoder=h264_mmal & --enable-decoder=mpeg2_mmal do not exist, but only (comments inline):
Code:
#Enabling MMAL acceleration:
FFmpeg-4.0.4-Leia-18.4# ./configure --help | grep mmal
  --enable-mmal            enable Broadcom Multi-Media Abstraction Layer (Raspberry Pi) via MMAL [no]
# NEON is enabled by default, good!
FFmpeg-4.0.4-Leia-18.4# ./configure --help | grep neon
  --disable-neon           disable NEON optimizations
# And with these two options only the encoding is enabled:
FFmpeg-4.0.4-Leia-18.4# ./configure --help | grep libx26
  --enable-libx264         enable H.264 encoding via x264 [no]
  --enable-libx265         enable HEVC encoding via x265 [no]
I do (did) care and follow what popcornmix (Dom Cobley, Senior Principal Software Engineer @ Raspberry) and the folks at LibreELEC are doing, because popcornmix, due to his senior position, test capabilities and access to the Pi internals, can provide the best knowledge and LibreELEC the practical implementation of that knowledge.
Noticed that both are still heavily patching FFMPEG for the Raspberry target:
https://github.com/popcornmix/xbmc/t.../target/ffmpeg
https://github.com/LibreELEC/LibreEL...ffmpeg/patches

Building libx265 and enabling MMAL in FFMPEG, as you are doing, should be sufficient for providing HW acceleration. The only reliable way I found to check if it's really enabled is to monitor the CPU usage. That works for OMX all the time, not sure about MMAL, as the latter is not really efficient.

Popcornmix on MMAL:
https://github.com/popcornmix/omxpla...ment-513831534
And maybe looking into the LibreELEC build source code for their Rpi4 (still beta) release can shed some light about the platform optimizations and HW acceleration.
https://libreelec.tv/2019/09/libreelec-leia-9-2-beta1/

Last edited by abga; 10-10-2019 at 05:17 PM. Reason: abut=about (I'm not Canadian ;) )
 
Old 12-19-2019, 07:33 AM   #6
tarnow
LQ Newbie
 
Registered: Sep 2019
Posts: 17

Original Poster
Rep: Reputation: Disabled
Thanks Abga for this information.
In the last few days I spent some time cleaning up the patch and adjust configurations to combine the great popcornmix's "hacky" leia_pi4 (18.5) with the SlackBuild. The instruction can be found at http://axes2solution.com/kodi-leia-pi4.html.
I tried to keep the patch and the instructions as short as possible and pack everything into the SlackBuild according to popcornmix's way of building.
Icluded in the kodi.patch are some newer dependencies which most probably are not needed and the original ones from Kodi can be used instead. You can try to build Kodi with and without these newer dependencies and see if it works. I have built mine as it is provided.
I was also able to get the popcornmix's newclock5 (Kodi 19.x) install up and running with different configurations. Will try to test some more before posting instructions.
Enjoy
 
Old 12-24-2019, 05:51 PM   #7
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
You're welcome.

I still find the way you build Kodi a little over-complicated and cannot follow some of the dependencies, compilation crashes and instructions you describe here:
http://axes2solution.com/kodi-leia-pi4.html

I don't know if you have noticed my thread about building Kodi 18 on Raspberry, it's not on the front page anymore:
https://www.linuxquestions.org/quest...5/#post5957433
It doesn't contain the patches required to support the HW decoding on Raspberry Pi4, mainly because at the time I wrote it, the Pi4 was not yet released. But the build (compilation) instructions are simpler and respecting the official Kodi Team instructions (simply using cmake).

I've noticed something redundant in your instructions related to the permissions needed for a few VC related folders:
Quote:
If you want to run kodi as user please add user to groups:
video
input
and
chown root.video /dev/vchiq /dev/vcio /dev/vcsm /dev/argon*
chmod 660 /dev/vchiq /dev/vcio /dev/vcsm /dev/argon*


enjoy!
Well, /dev/vchiq /dev/vcio /dev/vcsm are already belonging to the video group and /dev/argon* I don't have on my Pi boards (could be something only related to Pi4 or newer firmware (which I don't use because the analogue audio is broken).
Adding the kodi-user to the required groups should suffice:
Code:
usermod -a -G cdrom,audio,video,plugdev,input,pulse,messagebus kodi-user
Maybe some other groups would also be helpful, it works here without them, I didn't bother about adding them.
https://forum.kodi.tv/showthread.php...359#pid2516359

Final point, you're recommending to allocate 1 GB for the swap and I honestly didn't check how many make jobs you're running in your SlackBuild. I'd suggest sizing the compilation jobs to fit the RAM and always use the RAM and not the swap when compiling anything, swap is just useless overkill. In the Kodi 18 build thread (link from above) I'm mentioning my 1GB RAM and 3 make jobs limitation/experience:
Quote:
I used a Pi 2B loaded with Slackware ARM 14.2 SF and 4 make jobs to build for Kodi Pi Zero and I had 960MB RAM available (set the GPU RAM on 32MB for the compilation period). Even so, it was using my swap on a few occasions, writing around 60MB in it. The compilation took well over 4 hours!
On the native Pi 2B compilation under Slackware ARM -current (new toolchain), I could only use 3 make jobs, because with 4 jobs the compilation crashed - at around 30% during the build, it went over both the available RAM and the 200MB swap space. This compilation took around 5-6 hours!
 
Old 12-27-2019, 07:25 AM   #8
tarnow
LQ Newbie
 
Registered: Sep 2019
Posts: 17

Original Poster
Rep: Reputation: Disabled
Thanks for the feedback.
The instruction given here is based on a fresh installation of Slackware ARM current on the Raspberry Pi 4 since I wanted to try 4K decoding. The included xbmc.SlackBuild is adjusted according to official Kodi instruction found on Github as well as popcornmix's way of building. I tried to leave the same dependencies which come from Kodi build process and only update those that are giving problems like libmicrohttpd, libgpg and so on (see kodi.patch).
For setting permissions and video group I think /dev/argon* is set to root.root per default so I just listed all the needed devices that should be checked for video group.
I have now included memory optimization in the xbmc.SlackBuild so the requirement for 1GB of Swap might be outdated. I have copied it from the old instruction just in case
I had a lot of problems trying to build the dependencies mostly because of broken downloads.
If you can not get past the dependencies build then without looking at the error I can suggest two things:
- check the size of your dependency files and compare it with the list here to make sure they are not partially downloaded.
- unset all the occurences of CPATH, LD_LIBRARY_PATH, and LIBRARY_PATH found in the environment. We need to avoid mixing up the /opt/vc/lib with /usr/lib during different parts of building process. The included xbmc.Slackbuild takes care of the environment already.
If that does not help then you can download the complete Kodi txz package here.
 
Old 05-16-2020, 09:38 AM   #9
Johpin
Member
 
Registered: May 2020
Posts: 44

Rep: Reputation: Disabled
Thanks for providing the patch and slackbuild for the RPI4 to make use of Kodi's Unified Depends Build System
.

I used your updated version, dated 31.03.2020, from http://axes2solution.com/kodi-leia-pi4.html
It compiled fine and resulted in a large package to be installed.

Unfortunately in Kodi I could not search for addons and the "install from repository" resulted in the message: could not connect to repository.

During my earlier attempt I build Kodi according to xbmc-18.6-Leia/docs/README.Linux.md with system ffmpeg (without hw acceleration) without this issue.

Installing addons from zip files is a possibility, but it has not my preference.
 
Old 05-19-2020, 06:53 AM   #10
tarnow
LQ Newbie
 
Registered: Sep 2019
Posts: 17

Original Poster
Rep: Reputation: Disabled
Hello Johpin,

I am glad to hear that you have managed to build the Leia_pi4_18.6.
You might want to check the kodi.log to see if there are any errors related to your message.
I am not sure but I think this is related to curl being unable to find the ca-certificates file.
You can try to export the CA path before starting kodi:
export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt

see if that helps.
 
Old 05-20-2020, 10:24 AM   #11
Johpin
Member
 
Registered: May 2020
Posts: 44

Rep: Reputation: Disabled
Thanks Tarnow for your suggestions.

Taken from .kodi/temp/kodi.log:

ERROR: GetDirectory - Error getting addons://search/
ERROR: CGUIMediaWindow::GetDirectory(addons://search/) failed
ERROR: CCurlFile::FillBuffer - Failed: Peer certificate cannot be authenticated with given CA certificates(60)

=> indeed it has to do with curl and certificates.

https://github.com/xbmc/xbmc/issues/16165
addresses this and gives the same solution you are giving.

Unfortunately it does not work for me :-(
 
Old 05-27-2020, 02:00 PM   #12
tarnow
LQ Newbie
 
Registered: Sep 2019
Posts: 17

Original Poster
Rep: Reputation: Disabled
Hi Johpin,

A new SlackBuild for Leia_pi4_18.7 is now available at http://axes2solution.com/kodi-leia-pi4.html . You may want to try this one and see if it is any better. I also suggest to upgrade Slackware on your Raspberry Pi 4 to the latest current version. This is what I do before I build and test the new version of xbmc.

Last edited by tarnow; 05-27-2020 at 04:22 PM.
 
Old 05-28-2020, 03:45 PM   #13
Johpin
Member
 
Registered: May 2020
Posts: 44

Rep: Reputation: Disabled
Hi Tarnow,

Leia_pi4_18.7 compiled fine on the up to date slackware arm current, but still resulted for me in a Kodi with curl and certificates errors.

In your description you mention to install nasm compiler. Is this necessary, because according to /var/log/packages it has already been installed by default?
 
Old 05-29-2020, 03:00 AM   #14
tarnow
LQ Newbie
 
Registered: Sep 2019
Posts: 17

Original Poster
Rep: Reputation: Disabled
When I started to build the Leia_pi4 packages last year I have not seen nasm compiler installed on my Slackware so I had to install it separately. It looks like they are now offering this package so you do not need to install it again.

Back to curl, could you please make sure that ca file is installed on your system:
ls -l /etc/ssl/certs/ca-certificates.crt
then update the ca with the latest certificates:
cd /etc/ssl/certs/
wget http://curl.haxx.se/ca/cacert.pem
update-ca-certificates -f
export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
kodi

if you still have problems with curl then look at the kodi error log to find out which website curl is trying to access and add this site certificate to your ca-certificates:
cd /etc/ssl/certs/
openssl s_client -showcerts -servername server -connect server:443 > cacert_server.pem
update-ca-certificates -f
export SSL_CERT_FILE=/etc/ssl/certs/ca-certificates.crt
kodi

If the above does not help then please find the location where curl is looking for the ca file:
strace curl https://www.google.com |& grep open
export SSL_CERT_FILE=/path-from-above-found-at-the-end/ca-certificates.crt
kodi

Last edited by tarnow; 05-29-2020 at 03:27 AM.
 
Old 05-29-2020, 01:28 PM   #15
abga
Senior Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,634

Rep: Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929Reputation: 929
In Kodi you could also enable Debug logging from System>Settings>Logging. But don't let it enabled after the test/investigation!
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] KODI Leia - 18.x MediaPlayer - Optimized for Raspberry Pi1/Zero/Pi2B/Pi3B(+) on Slackware ARM 14.2 SF & Slackware ARM - current HF abga Slackware - ARM 25 04-29-2020 05:43 PM
[SOLVED] KODI Krypton - 17.x MediaPlayer - Optimized for Raspberry Pi1/Pi2/Pi3 on Slackware ARM 14.2 SF & Slackware ARM - current HF abga Slackware - ARM 40 08-28-2018 08:50 PM
LXer: FFmpeg & Libav Add H.265 Encoder Via x265 LXer Syndicated Linux News 0 02-13-2014 09:51 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - ARM

All times are GMT -5. The time now is 10:27 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration