Kodi is the best software to watch video on a Raspberry Pi. The Raspberry Pi 4 supports 4K, but the only software that can play it well is Kodi. That’s a bit disappointing, knowing the the Pi4 is already available since early 2019.
On the other hand, Kodi is nice open source software, with a thriving community.
Playing video in a browser is energy-wise, (privacy-wise IMHO) and performance-wise a bad thing. Try playing YouTube movies in a browser and in Kodi (unofficial YouTube plugin), and see the differences. Stuttering play, and high CPU usage in the browser, smooth play and lower CPU usage in Kodi.
The best performance for Kodi is offered by LibreELEC, a lightweight ‘Just enough OS’ Linux distribution. if you wanna run the latest Kodi on Raspberry Pi OS, you’ll need to compile it yourself at the moment.
Compile instructions Kodi 19
There isn’t yet an updated version Kodi 19 in Raspberry Pi OS, so you’ll need to compile Kodi 19 yourself. Big underlying changes in the way video and hardware-accceleration is done in the new kernel 5.10 broke Kodi 18.7 and
On the Kodi forum there are several attempts to compile a working version, but apparently that is not so simple. Still I used those instructions as a base, but added the kernel-header packages ` as a dependency and use a patched version of Kodi.
# sudo apt update && sudo apt full-upgrade -y
sudo apt install \
autoconf automake autopoint autotools-dev cmake cpp curl default-jre \
g++ gawk gcc gdc gettext git gperf libasound2-dev libass-dev \
libavahi-client-dev libavahi-common-dev libbluetooth-dev \
libbluray-dev libbz2-dev libcdio-dev libcec4 libcec-dev \
libcrossguid-dev libcurl4-openssl-dev libcwiid-dev libdbus-1-dev \
libdrm-dev libegl1-mesa-dev libenca-dev libflac-dev libfmt3-dev \
libfontconfig-dev libfreetype6-dev libfribidi-dev libfstrcmp-dev \
libgbm-dev libgcrypt-dev libgif-dev libgles2-mesa-dev libglew-dev \
libglu1-mesa-dev libgnutls28-dev libgpg-error-dev libgtest-dev \
libinput-dev libiso9660-dev libjpeg-dev liblcms2-dev liblirc-dev \
libltdl-dev liblzo2-dev libmariadb-dev libmicrohttpd-dev libnfs-dev \
libogg-dev libomxil-bellagio-dev libpcre3-dev libplist-dev \
libpng-dev libpulse-dev libshairplay-dev libsmbclient-dev \
libsqlite3-dev libssl-dev libtag1-dev libtiff5-dev libtinyxml-dev \
libtool libudev-dev libunistring-dev libva-dev libvdpau-dev \
libvorbis-dev libxkbcommon-dev libxmu-dev libxrandr-dev libxslt1-dev \
libxt-dev lsb-release meson nasm ninja-build python3-dev python3-pil \
python-support rapidjson-dev raspberrypi-kernel-headers swig unzip \
uuid-dev wayland-protocols yasm zip zlib1g-dev
Then you need a special GBM version of Kodi, but instead of this version.
wget https://github.com/popcornmix/xbmc/archive/gbm_matrix.zip
I used a patched version:
wget https://github.com/graysky2/xbmc/archive/refs/heads/gs-gbm_matrix.zip
Then this workaround is needed, Raspberry Pi OS uses a different path for some files. This just creates a symbolic link to the right path.
# drm_fourcc error workaround
sudo mkdir /usr/include/drm/
sudo ln -s /usr/include/libdrm/drm_fourcc.h /usr/include/drm/drm_fourcc.h
Extract the downloaded zip:
unzip gs-gbm_matrix.zip
Enter the map
cd xbmc-gs-gbm_matrix
Create build directory:
mkdir kodi-build
Enter build directory
cd kodi-build
Then make:
cmake .. -DCMAKE_INSTALL_PREFIX=/usr/local -DCORE_PLATFORM_NAME=gbm -DAPP_RENDER_SYSTEM=gles -DX11_RENDER_SYSTEM=gles -DENABLE_INTERNAL_FMT=ON -DENABLE_INTERNAL_FLATBUFFERS=ON -DENABLE_INTERNAL_SPDLOG=ON -DENABLE_VAAPI=OFF -DENABLE_VDPAU=OFF
Then compile
cmake --build . -- VERBOSE=1 -j$(getconf _NPROCESSORS_ONLN)
If done properly, ti should take about 2 hours. Afterwards you can start Kodi with `kodi-build/kodi-gbm`
That’s all. And don’t forget to backup your existing Kodi profile.
Occasionally the script exits with an error. Seems it’s running out of memory. Just restart the building process, executing the cmake –build command, to finish compiling.
UPDATE:
For Raspberry Pi Bullseye see this new post: