2020년 1월 11일 토요일

라즈베리파이4(RaspberryPi4)에서 코디(Kodi) 설정


RASPBERRY PI 4 ONLY TWEAKS:

This is very important! 

-Kodi on the Raspberry Pi 4 will only function if you are using the Open Source drivers! This is the "GL (Fake KMS) OpenGL desktop driver with fake KMS" on raspi-config, which is currently the default on the Raspbian images for the RPi 4. If you select the Broadcom/Legacy driver, it won't work!

-Kodi on Raspbian requires a minimum of 160 MB of RAM dedicated to the GPU to function properly! This can be done by running "raspi-config" -> "Advanced Options" -> "Memory Split" -> 160.

-Kodi 18 on the Raspberry Pi 4 supports up to 4K h265/HEVC 10bit video files.

-If you have a 4K monitor/TV, Kodi will automatically limit the GUI interface to 1080p, for a faster and better experience, since rendering the interface at 4K gives a considerable penalty hit. 4K videos will still play at that resolution whitout user interferance. If you want you can always change this going to Kodi -> Settings -> System -> Limit GUI size

-If you have a 4K monitor/TV, by default, the Raspberry Pi 4B will select a 30hz refresh rate. To allow selection of 60Hz refresh rates go to raspi-config -> Advanced Options -> Pi 4 Video Output -> Enable 4Kp60 HDMI or add a new line to /boot/config.txt with the following:
Code: Select all
hdmi_enable_4kp60=1
Note, this will increase power consumption and increase the temperature of the Raspberry Pi. It is not possible to output 4Kp60 on both micro HDMI ports simultaneously.


ADDITIONAL INFO:

Kodi package includes an ARMv6 (for the RPi 0 and 1), ARMv7 (for the RPI 2 and 3) and ARMv8 (for the RPi 4) binaries, which are autoselected accordindly to which version of the Raspberry Pi you have for best performance. Optimizations available in Open/LibreELEC like H265/HEVC NEON acceleration are also included and enabled automatically if you have a RPi 2/3/4. 

------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------


EXTRA INFO (not required for proper function):

RUNNING KODI WITH ANOTHER USER DIFFERENT FROM THE DEFAUL "PI":

If you want to run Kodi with a user different from the default "pi", that user needs to be part of the following groups, for everything to work fine: 
audio, video, input, dialout, plugdev, netdev (needs confirmation), users, cdrom (only if you have cd/dvd drives) and tty (needs confirmation). 
For that, run the following command:
Code: Select all
sudo usermod -a -G audio,video,input,dialout,plugdev,netdev,users,cdrom,tty "username"
Replace "username" by the desired user name. Depending on the use case of Kodi, not all this groups may be needed.


AUTO-STARTING KODI AT BOOT:

Option 1 (without desktop):
If you want to auto-start Kodi automatically at boot, go to rc-gui on Raspbian desktop or raspi-config on a virtual terminal, and choose the option to boot to CLI/console.
Then copy/paste the following to a virtual termianl to create a systemd service for auto start:
Code: Select all
sudo tee -a /lib/systemd/system/kodi.service <<_EOF_
[Unit]
Description = Kodi Media Center
After = remote-fs.target network-online.target
Wants = network-online.target

[Service]
User = pi
Group = pi
Type = simple
ExecStart = /usr/bin/kodi-standalone
Restart = on-abort
RestartSec = 5

[Install]
WantedBy = multi-user.target
_EOF_
Press Enter after paste. Then enable the service:
Code: Select all
sudo systemctl enable kodi.service
Then reboot. If you want to auto start Kodi at boot with a different user change the "User" and "Group" fields above accordingly.

Option 2 (with desktop):

If you want autostart Kodi at boot but also keep the Desktop Environment on the background, just edit the file (with sudo) /etc/xdg/lxsession/LXDE-pi/autostart and add a line, preferably at the beginning of the file with:
Code: Select all
@kodi
This option is a bit more resource intensive because the DE is loaded on the background.