Review your favorite Linux distribution.
Go Back > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - ARM
User Name
Slackware - ARM This forum is for the discussion of Slackware ARM.


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

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.
Old 10-08-2019, 12:15 PM   #2
Senior Member
Registered: Aug 2005
Distribution: Slackware, RHEL
Posts: 1,142

Rep: Reputation: 158Reputation: 158
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.
This is great. Thank you for sharing!
Old 10-08-2019, 04:33 PM   #3
Senior Member
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,211

Rep: Reputation: 640Reputation: 640Reputation: 640Reputation: 640Reputation: 640Reputation: 640
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:
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:

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
LQ Newbie
Registered: Sep 2019
Posts: 3

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

1. According to 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
Senior Member
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 1,211

Rep: Reputation: 640Reputation: 640Reputation: 640Reputation: 640Reputation: 640Reputation: 640
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/, 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:
# temp until further cleanup is done
# add Raspberry Pi 2 and 3 specific flags
  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")
On FFMPEG, noticed that they still use their own Kodi "specialized" version and not the mainstream one:
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):
#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:

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:
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.

Last edited by abga; 10-10-2019 at 05:17 PM. Reason: abut=about (I'm not Canadian ;) )


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 8 05-07-2019 04:55 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 > Forums > Linux Forums > Linux - Distributions > Slackware > Slackware - ARM

All times are GMT -5. The time now is 04:15 AM.

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