LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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 02-04-2019, 01:07 AM   #1
abga
Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 991

Rep: Reputation: 522Reputation: 522Reputation: 522Reputation: 522Reputation: 522Reputation: 522
KODI Leia - 18.x MediaPlayer - Optimized for Raspberry Pi1/Zero/Pi2B/Pi3B(+) on Slackware ARM 14.2 SF & Slackware ARM - current HF


Kodi 18.0 - codename Leia has been released, it contains a lot of optimizations and it's apparently able to play DRM content (NetFlix, Amazon Prime, etc. included).
Announcement:
https://kodi.tv/article/kodi-180

The build method has changed, somewhat simplified/automated, it's all wrapped in cmake now, not really properly documented for Raspberry builds and a little difficult to fine-tune/optimize.
But I did receive some proper help and I'm thankful for that.
Inspiration&Credits&Thanks:
- first, The Kodi Team
- then:
https://github.com/xbmc/xbmc/blob/ma...EADME.Linux.md
https://forum.kodi.tv/showthread.php?tid=340082
(I'm not so familiar with cmake and had to ask for help for the Raspberry target compilation details)

Important!
Before you follow the instructions presented here, look after & read the follow-up posts from this thread, as they may contain some corrections or adaptations.
Due to the way LQ works, I won't be able to update this original post after a while.


If you already have Kodi 17.x installed and would like to upgrade it, you'll be able to - upgrade is supported. Backup your /home/kodi/.kodi/ directory (just in case), uninstall the previous Kodi version, make sure you manually delete the 3-4 directories removepkg will not delete and install this version.
Do not launch it in case you built some add-ons for Kodi 17.x, you'll need to rebuild them - follow the ADD-ONS sections from this How-To for the details.

As with Kodi 17, I'll cover both Slackware ARM releases and the Raspberry P1 1/0, Pi2B, Pi3B boards:
Using "pi1" will imply Slack ARM 14.2 - SoftFloat on armv6 (RaspberryPi 1/0)
Using "pi2" will imply Slack ARM current - HardFloat on armv7 (RaspberryPi 2B)
Using "pi3" will imply Slack ARM current - HardFloat on armv8 (Raspberry Pi3B(+))
To avoid any confusions, I'm going to use absolute paths in my instructions and again using /kit/kodi-slack-build/ as the top tree for the compilation work.
There will be some steps you might find absurd, but you'll find the reasons behind them in the Kodi Forum thread I posted above.
During the Kodi compilation, you'll need to be online, because the Kodi build scripts will need to download a few source packages.

Edit: - some more "idiot-proof-ness"
Prepare the working directory and enter the deps subdirectory for resolving the dependencies first.
If you're not building as the user root (I do it all the time), then don't forget to chown (needs root privileges) the working directory for your user.
Substitute your-username with your actual user in the command in bold from the following section:

Code:
# as root
mkdir -p /kit/kodi-slack-build/
# then, only if you're not building as root
chown -R your-username:users /kit/kodi-slack-build/
# exit root / switch to your user if you're not planning to stay & build as root
mkdir -p /kit/kodi-slack-build/deps/
cd /kit/kodi-slack-build/deps/
--- DEPENDENCIES ---

The dependencies, plenty of, are the same as with Kodi 17, and there are some more.

1. FFmpeg:
- there are 3 ways I documented to build the required FFmpeg 4.x for Kodi:
a. The way the Kodi Team is doing with their "endorsed" FFmpeg 4.0.3-Leia-RC5.tar.gz (OMX Player is broken):
https://www.linuxquestions.org/quest...5/#post5958276
b. The way FFmpeg 4.0.3-Leia-RC5.tar.gz is officially designed to support the MMAL & OMX HW Acceleration (OMX Player is broken):
https://www.linuxquestions.org/quest...ml#post5956641
c. The way FFmpeg 4.1 is officially designed to support the MMAL & OMX HW Acceleration (OMX Player is broken):
https://www.linuxquestions.org/quest...5/#post5960801
- in any of these 3 cases don't forget to resolve the FFmpeg dependencies described here:
https://www.linuxquestions.org/quest...7/#post5751491
- build it & install it, run ldconfig
- there is a possibility to let Kodi build FFmpeg internally&statically (highly recommended), but ATM the FFmpeg configure script is broken and I'm not sure if the compiler CPU optimization flags are passed to the FFmpeg build and if the Raspberry specific FFmpeg HW accelerations are enabled (MMAL, OMX) by cmake.
- to build FFmpeg internally/statically, make sure you have no FFmpeg available on the system, Kodi won't find one to link with, and do some investigation and patching in the files: CMakeLists.txt, autobuild.sh, Makefile, before you start the Kodi compilation. There you could also patch the configure script.
https://github.com/xbmc/xbmc/tree/ma.../target/ffmpeg
- just in case you're interested, these files will be available in your /kit/kodi-slack-build/xbmc-18.0-Leia/tools/depends/target/ffmpeg/ folder.

2. for java / libbluray (this should be already available in Slackware ARM) / libgpg-error / lirc / yajl follow the dependencies section from Kodi 17:
https://www.linuxquestions.org/quest...2/#post5759079
- there might be newer versions available for all of the above - I didn't bother to upgrade
- alternatively, look for slackbuilds at http://www.slackbuilds.org/

3. tinyXML
http://www.slackbuilds.org/repositor...aries/tinyxml/
- use the Slackbuild fix (add -fPIC) that stormtracknole presented here:
https://www.linuxquestions.org/quest...ml#post5897038

4. fstrcmp - no slackbuild available
Code:
wget http://fstrcmp.sourceforge.net/fstrcmp-0.7.D001.tar.gz
tar -xzpf fstrcmp-0.7.D001.tar.gz
cd fstrcmp-0.7.D001/
./configure
make && make install
ldconfig
cd /kit/kodi-slack-build/deps/
# or, create a package
# https://docs.slackware.com/howtos:slackware_admin:building_a_package
5. rapidjson
http://slackbuilds.org/repository/14...ies/rapidjson/
for pi2 & pi3 - Slackware ARM -current, use ponce's slackbuild:
https://github.com/Ponce/slackbuilds...ries/rapidjson
and patch it according to this post:
https://www.linuxquestions.org/quest...0/#post5956599

6. libxkbcommon
http://slackbuilds.org/repository/14.../libxkbcommon/

7. only for pi1 you'll need libinput and there's a little extra effort to put in building its deps.
- build & install these in the following order:
http://www.slackbuilds.org/repositor...ython/python3/
http://www.slackbuilds.org/repositor...lopment/ninja/
http://www.slackbuilds.org/repository/14.2/python/pip/
then follow:
https://stackoverflow.com/questions/...ide-python-2-x
run:
Code:
wget https://bootstrap.pypa.io/get-pip.py
python3 get-pip.py
- the above will install the python3 module setuptools needed by meson
http://www.slackbuilds.org/repositor...lopment/meson/
http://slackbuilds.org/repository/14...ries/libwacom/
and finally:
http://www.slackbuilds.org/repositor...ries/libinput/

8. CEC support - if you want to control Kodi through your CEC enabled TV set (works through HDMI)
http://slackbuilds.org/repository/14...raries/libcec/

9. libmicrohttpd - only needed if you plan to control Kodi remotely and unsecurely (doesn't use HTTPS) through a web browser or the official Kodi android remote application (Kore)
http://slackbuilds.org/repository/14...libmicrohttpd/
- just for reference:
https://kodi.wiki/view/Kore

10. don't forget to run:
Code:
ldconfig
--- DEPENDENCIES END ---

--- COMPILATION ---

- get the source code and unpack it:
Code:
cd /kit/kodi-slack-build/
wget https://github.com/xbmc/xbmc/archive/18.0-Leia.tar.gz
tar -xzpf 18.0-Leia.tar.gz
- preparing the compilation environment:
- only for pi1, the Kodi build scripts will look after /usr/bin/grep
Code:
cp /usr/sbin/grep /usr/bin/grep
- absurd step - playing hide and seek - uninstall mesa as the build scripts from Kodi will link to it. You'll install it back after the Kodi compilation (if you don't forget about it).
Code:
ls -al /var/log/packages/mesa*
# get the name and then remove it - substitute mesa-name with the actual package name
removepkg /var/log/packages/mesa-name
- to get it back, just run:
Code:
slackpkg install mesa
- edit the project build script for optimizing the compiler flags:
/kit/kodi-slack-build/xbmc-18.0-Leia/cmake/scripts/linux/ArchSetup.cmake
- for pi1 modify the CPU flags section like this:
Code:
  elseif(CPU STREQUAL arm1176jzf-s)
    set(ARCH arm)
    set(NEON False)
    set(NEON_FLAGS "-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=soft")
- for pi2 and pi3 modify the two CPU flags sections (ATM only modifying the second section would suffice, but better be sure and mod both) like this:
Code:
  elseif(CPU MATCHES "cortex-a7")
    set(ARCH arm)
    set(NEON True)
    set(NEON_FLAGS "-fPIC -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad -mfloat-abi=hard")
  elseif(CPU MATCHES "cortex-a53")
    set(ARCH arm)
    set(NEON True)
    set(NEON_FLAGS "-fPIC -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mvectorize-with-neon-quad -mfloat-abi=hard")
&
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 -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad -mfloat-abi=hard")
  elseif(CPU MATCHES "cortex-a53")
    set(NEON_FLAGS "-fPIC -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mvectorize-with-neon-quad -mfloat-abi=hard")
  endif()
endif()
- set up the environment and prepare the cmake project.
- create the working directory - cmake project directory:
Code:
mkdir /kit/kodi-slack-build/kodi-build/ && cd /kit/kodi-slack-build/kodi-build/
- for pi1 run:
Code:
export PATH="$PATH:/opt/java/bin"
CFLAGS="-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=soft"
CXXFLAGS="-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=soft"
cmake ../xbmc-18.0-Leia -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_PREFIX_PATH=/opt/vc -DENABLE_INTERNAL_CROSSGUID=ON -DENABLE_INTERNAL_FLATBUFFERS=ON -DENABLE_INTERNAL_FMT=ON -DCORE_SYSTEM_NAME=linux -DCORE_PLATFORM_NAME=rbpi -DWITH_CPU=arm1176jzf-s -DCMAKE_C_FLAGS="-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=soft" -DCMAKE_CXX_FLAGS="-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=soft"
- for pi2 run:
Code:
export PATH="$PATH:/opt/java/bin"
CFLAGS="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad -mfloat-abi=hard"
CXXFLAGS="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad -mfloat-abi=hard"
cmake ../xbmc-18.0-Leia -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_PREFIX_PATH=/opt/vc -DENABLE_INTERNAL_CROSSGUID=ON -DENABLE_INTERNAL_FLATBUFFERS=ON -DENABLE_INTERNAL_FMT=ON -DCORE_SYSTEM_NAME=linux -DCORE_PLATFORM_NAME=rbpi -DWITH_CPU=cortex-a7 -DCMAKE_C_FLAGS="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad -mfloat-abi=hard" -DCMAKE_CXX_FLAGS="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad -mfloat-abi=hard"
- for pi3 run:
Code:
export PATH="$PATH:/opt/java/bin"
CFLAGS="-march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mvectorize-with-neon-quad -mfloat-abi=hard"
CXXFLAGS="-march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mvectorize-with-neon-quad -mfloat-abi=hard"
cmake ../xbmc-18.0-Leia -DCMAKE_INSTALL_PREFIX=/usr/local -DCMAKE_PREFIX_PATH=/opt/vc -DENABLE_INTERNAL_CROSSGUID=ON -DENABLE_INTERNAL_FLATBUFFERS=ON -DENABLE_INTERNAL_FMT=ON -DCORE_SYSTEM_NAME=linux -DCORE_PLATFORM_NAME=rbpi -DWITH_CPU=cortex-a53 -DCMAKE_C_FLAGS="-march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mvectorize-with-neon-quad -mfloat-abi=hard" -DCMAKE_CXX_FLAGS="-march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mvectorize-with-neon-quad -mfloat-abi=hard"
- in all cases follow the output of cmake and look after unresolved dependencies - you might want to add something.
- to restart the process, just clean the content of /kit/kodi-slack-build/kodi-build/ and start over again with the last cmake command, don't forget to cd to that dir:
Code:
cd /kit/kodi-slack-build/kodi-build/
- if everything went well, you can start the compilation, but first some considerations about the space&time(continuum).
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!
- on pi1, make sure you're still in the /kit/kodi-slack-build/kodi-build/ directory, run:
Code:
nohup cmake --build . -- VERBOSE=1 -j 1 2>&1 | tee kodi-build.log &
- on pi2 and pi3, make sure you're still in the /kit/kodi-slack-build/kodi-build/ directory, run:
Code:
nohup cmake --build . -- VERBOSE=1 -j 3 2>&1 | tee kodi-build.log &
- go out and play, or take a nap and tail the kodi-build.log from time to time, the cmake will inform you about the stage of the build [percentage%]
- if your build is successful, you'll end up with something like this:
Code:
gmake[2]: Leaving directory '/kit/kodi-slack-build/kodi-build'
[100%] Built target kodi
gmake[1]: Leaving directory '/kit/kodi-slack-build/kodi-build'
/usr/bin/cmake -E cmake_progress_start /kit/kodi-slack-build/kodi-build/CMakeFiles 0
--- COMPILATION END ---

--- INSTALLATION ---

- the compilation results will be available in /kit/kodi-slack-build/kodi-build/ and you only need to run make install in that directory, or, create a package:
https://docs.slackware.com/howtos:sl...ding_a_package
- for those of you lazier than me, I didn't write a slackbuild for this compilation, here is what I did - copy-paste:
Code:
cd /kit/kodi-slack-build/kodi-build/
rm -rf /tmp/build
mkdir /tmp/build
make install DESTDIR=/tmp/build
strip -s /tmp/build/usr/local/lib/* /tmp/build/usr/local/bin/*
cd /tmp/build
mkdir install/
cd install/
mcedit slack-desc
- put the following in slack-desc
Code:
# HOW TO EDIT THIS FILE:
# The "handy ruler" below makes it easier to edit a package description.
# Line up the first '|' above the ':' following the base package name, and
# the '|' on the right side marks the last column you can put a character in.
# You must make exactly 11 lines for the formatting to be correct.  It's also
# customary to leave one space after the ':' except on otherwise blank lines.

    |-----handy-ruler------------------------------------------------------|
kodi: kodi 18 - Leia
kodi: Raspberry Pi specific compilation
- then back in the console:
Code:
cd /tmp/build/
makepkg -l y -c n ../kodi-18-0-Leia-Raspberry-1-2-3-SF-HF.tgz
mv /tmp/kodi-18-0-Leia-Raspberry-1-2-3-SF-HF.tgz /kit/kodi-slack-build/
cd /kit/kodi-slack-build/
rm -rf /tmp/build/
rm -rf /kit/kodi-slack-build/kodi-build/
- for a new installation, just install the package:
Code:
installpkg /kit/kodi-slack-build/kodi-18-0-Leia-Raspberry-1-2-3-SF-HF.tgz
--- INSTALLATION END ---

- If this is your first installation, DO NOT yet launch Kodi!

--- ADD-ONS ---
- some important add-ons that you need to build. Prepare the working dir:
Code:
mkdir -p /kit/kodi-slack-build/addons-18/ && cd /kit/kodi-slack-build/addons-18/
- the platform add-on, required to be able to build&install other add-ons:
Code:
cd /kit/kodi-slack-build/addons-18/
git clone https://github.com/Pulse-Eight/platform.git
cd /kit/kodi-slack-build/addons-18/platform/
cmake -DCMAKE_INSTALL_PREFIX=/usr/local
make && make install
ldconfig
- the kodi-platform add-on, required to be able to build&install other add-ons:
Code:
cd /kit/kodi-slack-build/addons-18/
git clone https://github.com/xbmc/kodi-platform.git
cd /kit/kodi-slack-build/addons-18/kodi-platform/
cmake -DCMAKE_INSTALL_PREFIX=/usr/local
make && make install
ldconfig
- the pvr.hts add-on, in case you want to connect to a TVheadend backend and watch TV:
Code:
cd /kit/kodi-slack-build/addons-18/
git clone https://github.com/kodi-pvr/pvr.hts.git
cd /kit/kodi-slack-build/addons-18/pvr.hts/
cmake -DCMAKE_INSTALL_PREFIX=/usr/local
make && make install
ldconfig
- the inputstream.adaptive add-on, might be required for some other add-ons (listening/watching online streams):
Code:
cd /kit/kodi-slack-build/addons-18/
git clone https://github.com/peak3d/inputstream.adaptive.git
cd /kit/kodi-slack-build/addons-18/inputstream.adaptive/
cmake -DCMAKE_INSTALL_PREFIX=/usr/local
make && make install
ldconfig
- the rest of the add-ons you can install from within the Kodi GUI > Add-Ons - from their official repository

--- ADD-ONS END ---

--- CLEAN UP ---

- install back mesa!
- clean ccache
Code:
/usr/bin/ccache -C
- only for pi1, remove the grep alter ego
Code:
rm -f /usr/bin/grep
--- CLEAN UP END ---

- in my previous Kodi 17 How-To I wasn't using proper formatting (was new on LQ, and on forums in general) and the kodi user setup section looks pretty bad, here you have it again:
- create the kodi user & group and add the user to the required groups:
Code:
groupadd kodi
adduser kodi
- for the user kodi use the following settings:
Code:
Group: kodi
Directory: /home/kodi
Shell: /bin/bash
- add kodi to the required groups (you might want to add some more, related to storage/power/etc.):
Code:
usermod -a -G cdrom,audio,video,plugdev,input,pulse,messagebus kodi
- the /kit/glx and /kit/glkodi scripts from this post (towards the end of the post) might be required:
https://www.linuxquestions.org/quest...2/#post5759079
- launch kodi:
Code:
/usr/local/bin/kodi
- the configuration hasn't changed too much and you can use the hints I provided in the Kodi 17 How-To post, again the very end of the post - section ------Configuration - Optimization--------
https://www.linuxquestions.org/quest...2/#post5759079


Sharing my personal experience, Kodi 18 doesn't run well on Raspberry Pi Zero (audio&video stuttering) with OMX and analogue out, there are reports in the Kodi Forum about Pi 2B too, and the FFmpeg is in a RC state.
That doesn't mean it won't work well over digital audio - HDMI, the GPU will be less busy with the analogue audio generation.
I'll stick with the solid Kodi 17.4 for the moment. Just wanted to write down all these instructions because I'll forget the details soon, getting older...
Go on and play with it, maybe on a more powerful Pi3B it's running fine with OMX and analogue out, although the GPU is the same on all boards.

Enjoy! And do "annoy" me with errors/inconsistencies you spot in this post & with Slackware/Raspberry related questions.
For the Kodi related ones please address the Kodi Forum.

Last edited by abga; 02-17-2019 at 01:41 PM. Reason: 2 little typos + Edit + ffmpeg details
 
Old 02-04-2019, 01:21 AM   #2
abga
Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 991

Original Poster
Rep: Reputation: 522Reputation: 522Reputation: 522Reputation: 522Reputation: 522Reputation: 522
Yes, there is still work in progress and I'm using this second post to write about it, also to have a reply to the original post and to bring it down from the top of the list.

1. Will need to patch (literally butcher) the new Kodi 18.x power/shutdown source code in order to be able to access the very useful Custom Shutdown Timer (sleep timer) from the Exit menu, without allowing the kodi user to shut down the system.

2. I'm failing to build the iptv.simple add-on, required for playing IPTV and I need to dig into its cmake files to understand where to put its newly externalized dependency rapidXML.
This add-on should be normally built like this:
Code:
cd /kit/kodi-slack-build/addons-18/
git clone https://github.com/kodi-pvr/pvr.iptvsimple.git
cd /kit/kodi-slack-build/addons-18/pvr.iptvsimple/
cmake -DCMAKE_INSTALL_PREFIX=/usr/local
make && make install
ldconfig
- but it has a dependency that got "externalized" recently:
https://sourceforge.net/projects/rap...idxml-1.13.zip
- that needs to get extracted somewhere where it can find it, that's before running cmake
- tried this so far and failed - /pvr.iptvsimple/lib/rapidxml/ was the place it was available in the older version of the add-on (for Kodi 17):
Code:
cd /kit/kodi-slack-build/addons-18/pvr.iptvsimple/
wget https://sourceforge.net/projects/rapidxml/files/rapidxml-1.13.zip
unzip rapidxml-1.13.zip
mkdir -p /kit/kodi-slack-build/addons-18/pvr.iptvsimple/lib/rapidxml/
mv /kit/kodi-slack-build/addons-18/pvr.iptvsimple/rapidxml-1.13/*.hpp /kit/kodi-slack-build/addons-18/pvr.iptvsimple/lib/rapidxml/
- there are some scripts in:
/pvr.iptvsimple/depends/common/rapidxml
- and some inspiration here:
https://github.com/LibreELEC/LibreEL...9e02068f975b9c
https://github.com/kodi-pvr/pvr.iptv...Rapidxml.cmake
- all these for when I have a little more time

3. I'll wait for Kodi 18.1.
... tried 18.1 RC1 (cloned the master) yesterday and is still not usable on Pi Zero for watching TV/Movies with OMX and analogue out.
 
Old 02-04-2019, 04:19 PM   #3
abga
Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 991

Original Poster
Rep: Reputation: 522Reputation: 522Reputation: 522Reputation: 522Reputation: 522Reputation: 522
I got a reply in the Kodi forum from user asavah, suggesting I should better build the newclock5 Kodi tree prepared by popcornmix:
https://forum.kodi.tv/showthread.php...537#pid2817537
It's in this tree that all the Raspberry optimizations are first developed and then merged into the main Kodi tree. Apparently, this merge didn't happen with Kodi Leia 18.0 and it's my mistake for not checking it.

I used popcornmix's stuff when I first built Kodi 17 Krypton for Raspberry Pi under Slackware ARM, the beta series, before it was released as stable. The builds were performing well, a little unstable - crashed a lot, but then, all the developments from that popcornmix Raspberry specific tree have been merged into the first official Kody 17 Krypton release and I started to use that instead. This didn't happen with Kodi 18 Leia yet, that's odd, but I'm sure it will in the following official Kodi 18 releases.

I took a look at how FFmpeg is built in popcornmix's newclock5 tree and noticed some interesting patches:
https://github.com/popcornmix/xbmc/t.../target/ffmpeg
Will try to build that FFmpeg together with the patches (not sure I need hevc) and substitute the "official" one I documented in:
https://www.linuxquestions.org/quest...ml#post5956641

FFmpeg is actually the workhorse that drives the Kodi Media Player and I hope that only this new FFmpeg compilation will resolve the performance issues I reported.
Will post back once I get some time to compile/play/test the new patched FFmpeg.
 
Old 02-05-2019, 07:03 PM   #4
abga
Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 991

Original Poster
Rep: Reputation: 522Reputation: 522Reputation: 522Reputation: 522Reputation: 522Reputation: 522
This is the official way in which the Kodi Team is building FFmpeg for the Raspberry target in the Kodi build scripts. This will also enable HW accelerated (GPU aided) HEVC decoding - haven't tested it.

In all my attempts to get the FFmpeg 4.x compiled and optimized for the Raspberry boards, I've used the newer, FFmpeg 4.x official, syntax to enable the MMAL&OMX HW accelerations:
Code:
--enable-encoder=h264_omx \
--enable-omx \
--enable-omx-rpi \
--enable-decoder=h264_mmal \
--enable-decoder=mpeg2_mmal \
It looks like the Kodi Team is doing it differently, patching the FFmpeg 4.0.3-Leia-RC5.tar.gz code and using the older (FFmpeg 3.x) --enable-rpi switch, switch that is not available anymore in the official FFmpeg 4.x

Inspiration: popcornmix & LibreELEC - FFmpeg builds:
https://github.com/popcornmix/xbmc/b...target/ffmpeg/
https://github.com/LibreELEC/LibreEL...timedia/ffmpeg

I suggest to use the LibreELEC patches, these look actual and contain some "patches for the patches", example:
https://github.com/LibreELEC/LibreEL...d64b6a0148418d

- get the code and unpack it:
Code:
wget https://github.com/xbmc/FFmpeg/archive/4.0.3-Leia-RC5.tar.gz
tar -xzpf 4.0.3-Leia-RC5.tar.gz
cd FFmpeg-4.0.3-Leia-RC5/
- get the patches from LibreELEC & apply them:
Code:
mkdir patches/ && cd patches/
wget https://raw.githubusercontent.com/LibreELEC/LibreELEC.tv/master/packages/multimedia/ffmpeg/patches/ffmpeg-99.1001-Call-get_format-to-fix-an-issue-with-MMAL-ren.patch
wget https://raw.githubusercontent.com/LibreELEC/LibreELEC.tv/master/packages/multimedia/ffmpeg/patches/ffmpeg-99.1002-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch
wget https://github.com/LibreELEC/LibreELEC.tv/raw/master/packages/multimedia/ffmpeg/patches/ffmpeg-99.1003-pfcd_hevc_optimisations.patch
wget https://raw.githubusercontent.com/LibreELEC/LibreELEC.tv/master/packages/multimedia/ffmpeg/patches/ffmpeg-99.1004-added_upstream_mvc_patches.patch
cd ..
patch -p1 < patches/ffmpeg-99.1001-Call-get_format-to-fix-an-issue-with-MMAL-ren.patch
patch -p1 < patches/ffmpeg-99.1002-mpeg4video-Signal-unsupported-GMC-with-more-than-one.patch
patch -p1 < patches/ffmpeg-99.1003-pfcd_hevc_optimisations.patch
patch -p1 < patches/ffmpeg-99.1004-added_upstream_mvc_patches.patch
- Note: The bigger ffmpeg-99.1003-pfcd_hevc_optimisations.patch patch will also modify the configure script and will add the older (ffmpeg 3.x) configuration switch: --enable-rpi

- Configure FFmpeg for the platform you're building on:
- For Pi1 / Pi0:
Code:
./configure --extra-ldflags="-L /opt/vc/lib/" \
--extra-cflags="-I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=soft" \
--extra-cxxflags="-march=armv6zk -mtune=arm1176jzf-s -mfpu=vfp -mfloat-abi=soft" \
--extra-libs="-lbcm_host -lvcos -lvchiq_arm -lmmal -lmmal_core -lmmal_util -lvcsm" \
--disable-neon \
--enable-rpi \
--disable-debug \
--enable-stripping \
--disable-v4l2_m2m \
--disable-vaapi \
--disable-vdpau \
--disable-static \
--enable-shared \
--enable-gpl \
--disable-version3 \
--enable-nonfree \
--enable-logging \
--disable-doc \
--enable-pic \
--enable-optimizations \
--disable-extra-warnings \
--disable-programs \
--enable-avdevice \
--enable-avcodec \
--enable-avformat \
--enable-swscale \
--enable-postproc \
--enable-avfilter \
--disable-devices \
--enable-pthreads \
--enable-network \
--disable-gnutls --enable-openssl \
--disable-gray \
--enable-swscale-alpha \
--disable-small \
--enable-dct \
--enable-fft \
--enable-mdct \
--enable-rdft \
--disable-crystalhd \
--enable-runtime-cpudetect \
--disable-hardcoded-tables \
--disable-encoders \
--enable-encoder=ac3 \
--enable-encoder=aac \
--enable-encoder=wmav2 \
--enable-encoder=mjpeg \
--enable-encoder=png \
--enable-hwaccels \
--disable-muxers \
--enable-muxer=spdif \
--enable-muxer=adts \
--enable-muxer=asf \
--enable-muxer=ipod \
--enable-muxer=mpegts \
--enable-demuxers \
--enable-parsers \
--enable-bsfs \
--enable-protocol=http \
--disable-indevs \
--disable-outdevs \
--enable-filters \
--disable-avisynth \
--enable-bzlib \
--disable-lzma \
--disable-alsa \
--disable-frei0r \
--disable-libopencore-amrnb \
--disable-libopencore-amrwb \
--disable-libopencv \
--disable-libdc1394 \
--disable-libfreetype \
--disable-libgsm \
--disable-libmp3lame \
--disable-libopenjpeg \
--disable-librtmp \
--disable-libtheora \
--disable-libvo-amrwbenc \
--disable-libvorbis \
--disable-libvpx \
--disable-libx264 \
--disable-libxavs \
--disable-libxvid \
--enable-zlib \
--enable-asm \
--disable-altivec \
--disable-symver
For Pi 2B:
Code:
./configure --extra-ldflags="-L /opt/vc/lib/" \
--extra-cflags="-I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad -mfloat-abi=hard" \
--extra-cxxflags="-march=armv7-a -mtune=cortex-a7 -mfpu=neon-vfpv4 -mvectorize-with-neon-quad -mfloat-abi=hard" \
--extra-libs="-lbcm_host -lvcos -lvchiq_arm -lmmal -lmmal_core -lmmal_util -lvcsm" \
--enable-neon \
#continue with the rest of the configure switches - like for Pi1 / Pi0
For Pi 3B(+):
Code:
./configure --extra-ldflags="-L /opt/vc/lib/" \
--extra-cflags="-I/opt/vc/include/ -I/opt/vc/include/interface/vcos/pthreads -I/opt/vc/include/interface/vmcs_host/linux -march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mvectorize-with-neon-quad -mfloat-abi=hard" \
--extra-cxxflags="-march=armv8-a+crc -mtune=cortex-a53 -mfpu=neon-fp-armv8 -mvectorize-with-neon-quad -mfloat-abi=hard" \
--extra-libs="-lbcm_host -lvcos -lvchiq_arm -lmmal -lmmal_core -lmmal_util -lvcsm" \
--enable-neon \
#continue with the rest of the configure switches - like for Pi1 / Pi0
- build it:
Code:
#on Pi1 / Zero run:
make -j 1 V=1
# on Pi 2B/ Pi 3B (both quad-core) to avoid exhausting the 1GB RAM, run only 3 make jobs
make -j 3 V=1
- remove any other existent ffmpeg versions/packages and install this one:
Code:
make install
- or, create a package (recommended) and install that one:
https://docs.slackware.com/howtos:sl...ding_a_package

Last edited by abga; 02-17-2019 at 01:30 PM. Reason: Rewrote the whole post
 
Old 02-11-2019, 06:44 PM   #5
abga
Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 991

Original Poster
Rep: Reputation: 522Reputation: 522Reputation: 522Reputation: 522Reputation: 522Reputation: 522
As an alternative to FFmpeg 4.0.3-Leia-RC5.tar.gz use the official FFmpeg latest source 4.1 (not a RC release, but stable):
https://ffmpeg.org/releases/ffmpeg-4.1.tar.bz2
and patch the configure script according to this new patch:
cat configure.patch
Code:
--- configure   2018-11-06 01:22:33
+++ configure-ok        2019-02-07 18:21:53
@@ -6222,10 +6222,12 @@
                                check_lib opengl ES2/gl.h glGetError "-isysroot=${sysroot} -Wl,-framework,OpenGLES" ||
                                die "ERROR: opengl not found."
                              }
-enabled omx               && require_headers OMX_Core.h
-enabled omx_rpi           && { check_headers OMX_Core.h ||
-                               { ! enabled cross_compile && add_cflags -isystem/opt/vc/include/IL && check_headers OMX_Core.h ; } ||
-                               die "ERROR: OpenMAX IL headers not found"; } && enable omx
+enabled omx_rpi && enable omx
+enabled omx               && { check_header OMX_Core.h ||
+                                { ! enabled cross_compile && enabled omx_rpi && {
+                                    add_cflags -isystem/opt/vc/include/IL ; }
+                                check_header OMX_Core.h ; } ||
+                               die "ERROR: OpenMAX IL headers not found"; }
 enabled openssl           && { check_pkg_config openssl openssl openssl/ssl.h OPENSSL_init_ssl ||
                                check_pkg_config openssl openssl openssl/ssl.h SSL_library_init ||
                                check_lib openssl openssl/ssl.h SSL_library_init -lssl -lcrypto ||
The rest of the steps to build ffmpeg are the same as in:
https://www.linuxquestions.org/quest...ml#post5956641

Afterwards, in Kodi 18 use the MMAL acceleration and disable the faulty OMX. In Menu Setting > Player settings > Videos > Allow hardware acceleration MMAL (enabled) and Allow hardware acceleration OMX (disabled)
This will enable the default Kodi VideoPlayer and disable the OMXPlayer engine. This MMAL acceleration is not that efficient like OMX (which runs mostly in the GPU) and it will put some load on the CPU(s).
MMAL on a Pi Zero it's almost usable, the media playback starts pretty slow but works well and the OSD is very laggy, almost unusable. On a more powerful Rpi 2B it's running decent and I guess that on a Rpi 3B(+) it'll perform OK.

For watching Netfilx and/or Amazon Prime, you need to install the inputstream add-on (documented in the first post) and then the actual Netflix/Amazon add-ons:

Amazon Prime - external, not official but "tolerated":
https://forum.kodi.tv/showthread.php?tid=331136
https://github.com/Sandmann79/xbmc/releases/

Netflix - internal Add-On - can be installed through the Kodi Add-Ons Menu > Video Add-Ons:
https://github.com/kodinerds/repo/tr...sitory.netflix

Note that these add-ons will require the internal Kodi Videoplayer with the MMAL acceleration and won't work with OMX.
https://forum.kodi.tv/showthread.php?tid=340556
- it also looks like the maximum video resolution on Rpi Pi3 is 720p. I cannot confirm this as I'm not using Netflix/Amazon

Besides, a side note, the "perverted" scope:
https://en.wikipedia.org/wiki/Raspberry_pi
"The Raspberry Pi is a series of small single-board computers developed in the United Kingdom by the Raspberry Pi Foundation to promote teaching of basic computer science in schools and in developing countries."
In the newly opened store, first stand - right side (where right-handed people(the majority) will focus first), the "first" thing to do with a Pi board is ... run Kodi on it:
https://www.raspberrypi.org/blog/guess-what/
https://www.raspberrypi.org/app/uplo...e-Outdside.jpg
(right side of the picture, first stand - Build an all-in-one multimedia centre - running Kodi)
Run Kodi with a 2 years old broken firmware, I must add ...
https://github.com/raspberrypi/firmware/issues/924

Will update this thread in case Kodi will get a new release out and maybe fix the OMX engine.

Last edited by abga; 02-17-2019 at 01:58 PM. Reason: correction - alternative
 
Old 02-12-2019, 03:36 AM   #6
Dunc.
LQ Newbie
 
Registered: Jul 2012
Location: Cumbria UK
Distribution: Slackware
Posts: 17

Rep: Reputation: Disabled
From the kodi 18 Leia changelog

Quote:
Removed the unused and unmaintained OpenMAX video decoder from Kodi's VideoPlayer[160]
So I guess that trying to get OMX working is a non starter.
Edit: I see OMX is the rpi interface to their hardware decoders. Any resemblance to openmax is coincidental.

On the plus side 18.1 rc1 is out!

Kind regards

Dunc.

Last edited by Dunc.; 02-12-2019 at 03:54 AM. Reason: I thought omx was an inplementation of openmax
 
Old 02-12-2019, 05:07 PM   #7
abga
Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 991

Original Poster
Rep: Reputation: 522Reputation: 522Reputation: 522Reputation: 522Reputation: 522Reputation: 522
Kodi 18.1 RC1 was started immediately after Kodi 18.0 got released and I mentioned I tried it in my post #2 (last point - 3):
https://github.com/xbmc/xbmc/commit/...95e80663b61a38
As of today, there are over 108 commits already and I couldn't see the one you mentioned (must have been one from the past - maybe Kodi 17):
Quote:
Removed the unused and unmaintained OpenMAX video decoder from Kodi's VideoPlayer[160]
There's a little confusion over the two video players Kodi is using. Some details:

1. The default VideoPlayer - developed and maintained by the Kodi Team. This VideoPlayer is available for all targets (x86 incl.) and is the main video player. Under Raspberry Pi it will use the MMAL acceleration. It's not very efficient, will put some high load on the CPU and it's not able to use the OMX (OpenMAX) libraries and acceleration. That's why the "OpenMAX video decoder from Kodi's VideoPlayer" was removed.
This default VideoPlayer(MMAL) will work well on all Raspberry Pi boards, including Pi1/Zero for pretty much all the video playbacks. The problems appear on Pi1/Zero boards for DVB-H264-FullHD streams (over TVHeadend), where it will put too much load on the single CPU and the GUI will start to behave really laggy/unresponsive, Kodi 17 would also crash after a few seconds (crashing doesn't occur in Kodi 18.x anymore).

2. OMX Player - an adapted/simplified version of the OMX Player, that is only available for the Raspberry Pi targets (specific Kodi compilations - like this one here - first post). This is very efficient, using the GPU directly for video playback primitives and not putting too much pressure on the CPU itself. Due to this efficiency, this OMX Player is the recommended video player to be used on Raspberry Pis, especially on weaker single-core ones like the Pi1/Zero. However, it has some limitations, as previously mentioned, the DRM (&encrypted) add-ons like NetFlix/Amazon/etc. cannot make use of it and the only audio outputs it supports, as it works directly with the GPU also for the audio decoding, are the internal analogue and HDMI. For external sound adapters, if these are configured to be used in the Kodi GUI - Settings, Kodi will fallback on its default VideoPlayer(MMAL).
See some reference from the maintainer of the Raspberry Pi / OMX Player specific code for Kodi - popcornmix:
https://forum.kodi.tv/showthread.php?tid=331043
The actual issue in Kodi 18.x with the OMX Player looks to be some buffering and it should be trivial to fix, but it'll take time, since popcornmix looks to be the only one maintaining this specific Raspberry Pi stuff for Kodi and he's pretty busy, maintaining also the official Raspberry Pi kernel & firmware.
For the actual OMX Player buffering issue in Kodi 18.x - check the Extra section from this post (I also uploaded a debug log):
https://forum.kodi.tv/showthread.php...448#pid2817448

Note that both VideoPlayer(MMAL) and OMX Player were suffering from audio-analogue&video stuttering with the Kodi 18.0 "endorsed" FFmpeg 4.0.3-Leia-RC5 for all the video playbacks I tried (even simple 720p movies) and that is why I recommended FFmpeg latest source 4.1 to be used (post #5).
OMX Player is still broken (buffering issues - apparently a Kodi internal issue and not related to FFmpeg) but at least VideoPlayer(MMAL) is working fine with this mainstream FFmpeg 4.1.

P.S.
@Dunc. - check this post for some links pointing to both MMAL & OMX libs (which are both included in the Raspberry Pi userland (in /opt/vc)) and used by both FFmpeg and Kodi:
https://www.linuxquestions.org/quest...5/#post5948307

And, on your statement:
Quote:
Edit: I see OMX is the rpi interface to their hardware decoders. Any resemblance to openmax is coincidental.
Nope, it's not coincidental, OMX is actually OpenMAX IL, develoed by khronos.

Last edited by abga; 02-12-2019 at 06:29 PM. Reason: H264 + P.S.
 
Old 02-17-2019, 01:54 PM   #8
abga
Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 991

Original Poster
Rep: Reputation: 522Reputation: 522Reputation: 522Reputation: 522Reputation: 522Reputation: 522
Kodi 18.1 has been released:
https://github.com/xbmc/xbmc/releases

I got it compiled for Pi Zero and played with it. OMX (OMX Player) is still unusable - both audio&video stutters. Went on and inspected how the Kodi Team is compiling FFmpeg for their LibreELEC distro and updated post #4 from this thread with the findings:
https://www.linuxquestions.org/quest...5/#post5958276
Even with this FFmpeg compilation, OMX Player still doesn't want to work properly. I get the same symptoms even with LibreELEC and I don't know who to blame now, FFmpeg or the OMX Player code in Kodi:
https://github.com/xbmc/xbmc/commits...ores/omxplayer

ATM either stick with Kodi 17.x and OMX or use Kodi 18.x with the MMAL acceleration.
 
Old 05-07-2019, 04:55 PM   #9
abga
Member
 
Registered: Jul 2017
Location: EU
Distribution: Slackware
Posts: 991

Original Poster
Rep: Reputation: 522Reputation: 522Reputation: 522Reputation: 522Reputation: 522Reputation: 522
OMXPlayer has just been ditched by the Kodi devs from the upcoming Kodi 19.x code and it doesn't look that it'll get some fixes in the actual 18.x code base:
https://github.com/xbmc/xbmc/pull/16080
https://github.com/xbmc/xbmc/commit/...a0d926d58d1ef1

In this respect please disregard any points I made about OMX Player in this thread and focus on Kodi's default VideoPlayer and the MMAL HW acceleration. It's working decently on Pi2B/Pi3B(+), it's way more inefficient and due to the higher load you won't be able to use the Rpi for additional workloads, but dedicate it for Kodi.

As stated in the previous post, stick with Kodi 17 if you need the efficient OMXPlayer engine (or if you own a Pi1/Zero).

I won't update this thread and I'm moving away from using ARM SBCs as they (all) became unreliable (performance-wise - overheating&throttling) and pretty expensive (accessories included) compared to the currently available x86 miniPC alternatives.
 
  


Reply


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
Trying to build KODI 18 Leia Barcoboy Slackware 8 11-19-2018 07:53 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: Kodi v18 Leia Alpha, BleachBit Version 2.0, Use an RPi 3 to Build Your Own Cheap Car Head Unit and More LXer Syndicated Linux News 0 03-06-2018 01:30 AM
LXer: Kodi 18 Media Center to Be Dubbed "Leia," In Honor of the Late Carrie Fisher LXer Syndicated Linux News 0 01-10-2017 05:35 AM

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

All times are GMT -5. The time now is 03:55 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration