Kodi on Bullseye, playing 4K on the RPI4

{}
March 18th, 2022

Getting the most out of your (cheap) hardware is always a challenge. Selling hardware is easier then supporting hardware.

The Raspberry Pi 4 has strong multimedia capabilities, it can playing 4K media 60fps, but getting it done isn’t a piece of cake. Even playing 1080HD content on YouTube can be a problem, but that’s probably because YouTube is more about tracking and selling adds than playing media.

A bold statement? Think about it this way. Any 1080p movie will play fine outside a browser in Kodi, any movie will play fine without DRM (Digital Rights Management). It chokes on the DRM en-/decryption. By definition: DRM is tracking.

Historically LibreElec is the best distribution for a Raspberry Pi as a multimedia device. LibreElec’s goal: just enough OS to support Kodi, and it is highly optimized for that.

Yes it’s powerful. You can install add-ons like MPD for music, or RetroPie-alike  for games. Also docker containers are available for HomeAssistant, MQTT and Nginx. So a RPI with LibreElec can be pretty powerful.

Still LibreElec is limited, and the RPI4 is capable of doing more.

Kodi on Raspberry used to work pretty well, until big changes in the 5.10 kernel came. It more or less stopped working on Buster. Compiling it yourself was quite a hassle, that actually failed more than it succeeded. I wrote about that before and it failed in most cases for most users including myself, I must admit.

But now luckily RPI-engineers stepped up:  Kodi in Rapsberry Pi OS is more or less supported again.

At least it’s easy again to install Kodi in Bullseye. But you still need a bit more tweaks to get it running smoothly.

To install Kodi in Bullseye

No OS can beat this 🙂 :

sudo apt install kodi

Install addons

Two important add-ons that can’t be installed from within Kodi like in LibreElec, but you have to resort to apt again:

TVHeadend-client (DVB-T tv)

sudo apt install kodi-pvr-hts

Only the client is installed with this command, this assumes a TV-Headend server is running on another local IP-address.

Inputstream-adaptive helper to play DRM protected (Widevine) content

sudo apt-get install kodi-inputstream-adaptive

The add-on then will extract (and update) the needed libs from internet automatically.

To enable HEVC HW decoding, you have to tweak /boot/config.txt

Add this line (only for RPI4)

dtoverlay=rpivid-v4l2

For 4K HEVC playback tweak this line:

# Enable DRM VC4 V3D driver
dtoverlay=vc4-kms-v3d,cma-512

Mount NFS shares

Somehow Kodi on Bullseye stopped discovering NFS by default. Don’t worry to much, just give it a little manual bump.

  • Choose Browse for new share -> Add network location -> Protocol -> Network File System (NFS)
  • Entering the your ip-address as Server address and Remote path manually, adding up to something like nfs://192.168.0.3:/path/to/mnt/
  • Click OK, then it will list.
  • Select and click OK.

Conclusion

Changes in `/boot/config.txt` require a reboot.

After all these steps, playing 4K HEVC content with HW-acceleration should work fine on a Raspberry Pi 4.

That’s all. Let me know if it’s working for you.

 

Tags:

5 Responses to “Kodi on Bullseye, playing 4K on the RPI4”

  1. Victor Says:

    This is working great!

  2. Martin klein Says:

    I tried this on my Raspi 400.
    But when I start Kodi I get this:
    Cannot connect to server socket err = No such file or directory
    Cannot connect to server request channel
    jack server is not running or cannot be started
    JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
    JackShmReadWritePtr::~JackShmReadWritePtr – Init not done for -1, skipping unlock
    ERROR: Unable to create GUI. Exiting

    Many thanks for any hints
    Martin

  3. webonomic Says:

    @Martin, that is a weird error message. I don’t think Jack server is installed on Bullseye by default.

    Furthermore to start Kodi, you have to quit the GUI desktop environment, or restart to terminal and start Kodi from there.

    OR there is an error in /boot/config.txt. recheck that.

  4. Frank Says:

    Hi there! Thank you very much for your guide, really appreciate it.

    Nonetheless, i have a problem for which i find no solution and i hope, you have an idea.

    I have a Raspberry Pi 4b with Raspberry OS installed. I installed Kodi and all works fine, except that my system does not run videos in 4k. Neither in kodi, nor in the VLC media player would videos start. I configured my system like you described in your guide. Perhaps you have an idea, what could cause this issue.

    Thank you very much!

    Frank

  5. webonomic Says:

    Not really sure, the RPI4 supports only 4kH265p30 by default, so maybe your video has a different format.

    KODI has superior playback over VLC IMHO. But KODI is best supported in LibreElec.

    If you run Kodi in Debian, be sure to leave the graphical desktop.

Leave a Reply