Raspberry Pi 4 + Slackware ARM -current + Kodi 18.4 + FFmpeg 4.2 with x265
Slackware - ARMThis forum is for the discussion of Slackware ARM.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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).
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.
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:
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.
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
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
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!
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.
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.
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
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.
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?
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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.