🛠 Serveur multimédia : Kodi, décodage 4K et accès GPU en conteneur

Raspberry Pi 4 Model B (2019) — Board Sheet · avance · Schéma : IMG-model-4b-avance-3-model4b-serveur-multimedia.svg — Pi 4B en media center : double sortie micro-HDMI 4K, flux H.265 4K60 décodé par le VideoCore VI, stockage sur disque USB 3.0

Objectives

Turn the Pi 4B into a media center: the VideoCore VI running at 500 MHz decodes H.265 4Kp60 and H.264 1080p60, the dual micro-HDMI outputs display up to 4K, and the open-source Mesa V3D driver (Vulkan 1.2 compliant since 2022) also allows exposing the GPU to containers. You will install Kodi and launch a container with GPU access.

Hardware

Complete code

# Option A - media center dedie : flasher LibreELEC (Kodi) avec Raspberry Pi Imager
# Verification : Lecture 4K HEVC fluide, menu en 60 i/s sur les deux ports micro-HDMI.

# Option B - Kodi/Docker avec GPU sur Raspberry Pi OS Bookworm :
sudo usermod -aG video "$USER"
ls -l /dev/dri                       # rendre visible card0 (V3D)
docker run -d --name kodi --restart unless-stopped \
  --privileged --net host \
  -v /dev:/dev -v /mnt/media:/data \
  linuxserver/kodi
# Controles :
vcgencmd version                     # firmware a jour
vcgencmd measure_temp                # < 70 degres en lecture 4K

Expected verification

When playing a 4K H.265 file, the CPU stays below 30% (everything is decoded by the GPU), the display outputs 3840x2160 at 60 Hz on one port, and the second can display the desktop in 1080p. Inside the container, ls /dev/dri shows card0: the GPU is visible.

Common errors

Other tutorials for this board

Code examples for this board

← Back to the board 🛠 All tutorials