Rascas
Posts: 283
Joined: Tue Mar 11, 2014 6:18 pm
Location: Porto, Portugal
Contact: Website

Kodi on Raspbian Stretch

Tue Sep 05, 2017 2:55 am

INTRO:

After so many posts about people getting problems on installing Kodi on Raspbian, specially on the new Raspbian Stretch, this is a complete guide on how to do it, and an attempt to keep things together in the same place. You will see that after all, it is not so hard.

In the time of the first Raspbian Stretch image released by the RPi Foundation, there was only available the generic Debian Kodi version (17.1) which is compiled against OpenGL, so not optimal to run on the RPi (at least by this time), it runs very slow. But now, a new version is available (17.4) on the repos, compiled against OpenGLES, optimized for the RPi.

INSTALLATION:

To install it you first need to update/refresh packages, and then install the main package. This can be done in a virtual terminal by running the respective commands:

Code: Select all

sudo apt-get update

Code: Select all

sudo apt-get install kodi
Take note that Kodi on Raspbian, like most Debian based OSs, is divided into many packages, so you can install only what you really need. Besides the main package, you will find many "binary addons" packages which provide additional functions to Kodi. For example, PVRs, Joystick support, Inputstreams, Visualizations, etc. You can easily search for aditional packages by running:

Code: Select all

apt-cache search kodi
And install what you want.
For example in this case, we will install the joystick support, IPTV Simple PVR and the inputstream addons:

Code: Select all

sudo apt-get install kodi-peripheral-joystick kodi-pvr-iptvsimple kodi-inputstream-adaptive kodi-inputstream-rtmp
After that, restart Kodi and check if the binary addons are enabled in Kodi interface, if not, enable them.

Alternatively and easier, if you are running Raspbian with Desktop, you can just open the graphical package manager "Dont know the name of it" on the upper left corner menu, search for "Kodi" and install the packages you want.


TWEAKS:

This is very important!
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.
If you have a RPi 2/3, the recommended is 256 MB of RAM for the GPU.

Also, Kodi on Raspbian by default, doesn't play some video codecs like VP6, VP8, MJPEG, Theora, etc, so to be able to play this codecs, you need to go to "raspi-config" -> "Interfacing Options" -> "Camera" -> Enable,
or just add a new line in /boot/config.txt with:
start_x=1

ADDITIONAL INFO:

This is very important also!
Kodi will only function if you are using the Broadcom drivers! This is the "Original non-GL desktop driver" on raspi-config, which is currently the default on the Raspbian images. If you select the open-source OpenGL driver, it won't work!

Kodi package includes both an ARMv6 and ARMv7 binary, which is 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.

If you have any problem, please include your Kodi log. Information on how to do it here: http://kodi.wiki/view/Log_file

PS: This is the first draft of the instructions/information and will be updated accordingly as needed or if something changes.
Last edited by Rascas on Wed Sep 06, 2017 3:09 pm, edited 2 times in total.

cjan
Posts: 439
Joined: Sun May 06, 2012 12:00 am

Re: Kodi on Raspbian

Tue Sep 05, 2017 4:55 am

does jessie keep update or wait until 18 ?

Rascas
Posts: 283
Joined: Tue Mar 11, 2014 6:18 pm
Location: Porto, Portugal
Contact: Website

Re: Kodi on Raspbian

Tue Sep 05, 2017 5:08 am

Hardly, Kodi 18 will most likely be available only on Raspbian Stretch.

gkreidl
Posts: 5197
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Kodi on Raspbian

Tue Sep 05, 2017 6:55 am

Are the special settings (like certain udev rules and adding pi to some groups) still needed?
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

Rascas
Posts: 283
Joined: Tue Mar 11, 2014 6:18 pm
Location: Porto, Portugal
Contact: Website

Re: Kodi on Raspbian

Tue Sep 05, 2017 11:22 am

gkreidl wrote:
Tue Sep 05, 2017 6:55 am
Are the special settings (like certain udev rules and adding pi to some groups) still needed?
The udev rules are not needed anymore, they are already included in Raspbian. And if you are using the default user "pi" you also don't need to add any groups.
Later today I will post the groups needed for newly created users.

cjan
Posts: 439
Joined: Sun May 06, 2012 12:00 am

Re: Kodi on Raspbian

Wed Sep 06, 2017 1:19 am

stretch, kodi back to Desktop, chromium play youtube video & audio not sync.
ps. gpu_mem=256

Rascas
Posts: 283
Joined: Tue Mar 11, 2014 6:18 pm
Location: Porto, Portugal
Contact: Website

Re: Kodi on Raspbian

Wed Sep 06, 2017 1:35 am

cjan wrote:
Wed Sep 06, 2017 1:19 am
stretch, kodi back to Desktop, chromium play youtube video & audio not sync.
ps. gpu_mem=256
If you have any problem, please include your Kodi log. Information on how to do it here: http://kodi.wiki/view/Log_file

Chromium is offtopic, but it works fine for me on Raspbian Stretch with Desktop. If you upgraded from Jessie, did you removed pulseaudio ?

cjan
Posts: 439
Joined: Sun May 06, 2012 12:00 am

Re: Kodi on Raspbian

Wed Sep 06, 2017 2:51 am

Rascas wrote:
Wed Sep 06, 2017 1:35 am
Chromium is offtopic, but it works fine for me on Raspbian Stretch with Desktop. If you upgraded from Jessie, did you removed pulseaudio ?
chromium youtube play fine, but when back from kodi to Desktop video & audio not sync.
pulseaudio, should remove or not ?

Rascas
Posts: 283
Joined: Tue Mar 11, 2014 6:18 pm
Location: Porto, Portugal
Contact: Website

Re: Kodi on Raspbian

Wed Sep 06, 2017 9:23 am

cjan wrote:
Wed Sep 06, 2017 2:51 am
Rascas wrote:
Wed Sep 06, 2017 1:35 am
Chromium is offtopic, but it works fine for me on Raspbian Stretch with Desktop. If you upgraded from Jessie, did you removed pulseaudio ?
chromium youtube play fine, but when back from kodi to Desktop video & audio not sync.
pulseaudio, should remove or not ?
In Jessie I always had video/audio sync problems in Chromium, with pulseaudio installed, like for example, playing 1080p videos on Youtube, and since I don't use bluetooth audio devices, I always ended up removing it and it worked fine after that. This was with or without opening Kodi first.

In Stretch, pulseaudio isn't installed anymore, because you can now get bluetooth audio devices working without it. They recommend to remove it if you upgrade to Stretch and don't use it for anything else: https://www.raspberrypi.org/blog/raspbian-stretch/

About Kodi and Chromium, I don't see any connection between them, no problems in video/audio sync on Stretch like you said. The only thing I can think of, is like you having some 3rd party addon installed that is causing some memory leak.
Last edited by Rascas on Wed Sep 06, 2017 2:20 pm, edited 1 time in total.

User avatar
topguy
Posts: 3423
Joined: Tue Oct 09, 2012 11:46 am
Location: Trondheim, Norway

Re: Kodi on Raspbian

Wed Sep 06, 2017 2:19 pm

Good writeup but this part confuses me:
Also, Kodi on Raspbian by default, doesn't play some video codecs like VP6, VP8, MJPEG, Theora, etc, so to be able to play this codecs, you need to go to "raspi-config" -> "Interfacing Options" -> "Camera" -> Enable,
or just add a new line in /boot/config.txt with: start_x=1
Why would those codecs be linked to the Camera interface ? Did you test those files with omxplayer before enabling the camera ?

gkreidl
Posts: 5197
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Kodi on Raspbian

Wed Sep 06, 2017 2:43 pm

topguy wrote:
Wed Sep 06, 2017 2:19 pm
Good writeup but this part confuses me:
Also, Kodi on Raspbian by default, doesn't play some video codecs like VP6, VP8, MJPEG, Theora, etc, so to be able to play this codecs, you need to go to "raspi-config" -> "Interfacing Options" -> "Camera" -> Enable,
or just add a new line in /boot/config.txt with: start_x=1
Why would those codecs be linked to the Camera interface ? Did you test those files with omxplayer before enabling the camera ?
It tells the RPi to use the extended firmware which contains not only the camera interface but also the additional codecs.
It replaces
start_file=start_x.elf
fixup_file=fixup_x.dat
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

Rascas
Posts: 283
Joined: Tue Mar 11, 2014 6:18 pm
Location: Porto, Portugal
Contact: Website

Re: Kodi on Raspbian

Wed Sep 06, 2017 2:52 pm

topguy wrote:
Wed Sep 06, 2017 2:19 pm
Good writeup but this part confuses me:
Also, Kodi on Raspbian by default, doesn't play some video codecs like VP6, VP8, MJPEG, Theora, etc, so to be able to play this codecs, you need to go to "raspi-config" -> "Interfacing Options" -> "Camera" -> Enable,
or just add a new line in /boot/config.txt with: start_x=1
Why would those codecs be linked to the Camera interface ? Did you test those files with omxplayer before enabling the camera ?
Well first I would like to say that I am not the right person to explain you that.
If you take a look at raspi-config shell script, in the camera part, all it does is to add start_x=1 and setting GPU mem to 128 MB. What start_x=1 does, is to load the elf/firmware start_x.elf instead of the normal start.elf. I can't explain you all the diferences between the two for obvious reasons, but for sure, it enables the camera module and allows you to play the said codecs. I can't say if this is needed for omxplayer right now, I think so if omxplayer has the ability to play that codecs, but for sure it is needed for Kodi to play that video codecs.

gkreidl
Posts: 5197
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Kodi on Raspbian

Wed Sep 06, 2017 3:02 pm

Rascas wrote:
Wed Sep 06, 2017 2:52 pm
...
I can't say if this is needed for omxplayer right now, I think so if omxplayer has the ability to play that codecs, but for sure it is needed for Kodi to play that video codecs.
It's also needed for omxplayer and gstreamer-omx if you want to use the additional codecs.
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

cjan
Posts: 439
Joined: Sun May 06, 2012 12:00 am

Re: Kodi on Raspbian Stretch

Wed Sep 06, 2017 11:31 pm

ok, remove pulseaudio, solve the A/V not sync problem, thanks.

dingo35
Posts: 12
Joined: Sat Oct 26, 2013 8:09 am

Re: Kodi on Raspbian Stretch

Tue Sep 12, 2017 10:07 am

Upgraded from Jessie to Stretch, the kodi 2:17.3-1~jessie package was withheld, all worked fine.

After an apt-get dist-upgrade it upgraded to kodi 2:17.4-1~stretch, I now get a segfault when starting kodi.

I added start_x=1 to my /boot/config.txt ; did not help.
I ran raspi-config to make sure the original driver was installed, that was the case.

It doesnt matter whether I run it as the kodi user that was succesfully running kodi in the jessie-past, or as root.
kodi_segfault_logs.tgz
(5.54 KiB) Downloaded 4 times
What could be going wrong?!? If you need a core file please let me know ...

EDIT: I'm running on a Raspi3, raspbian image. Adding
start_file=start_x.elf
fixup_file=fixup_x.dat to my /boot/config.txt did not change anything either.

EDIT2:
Strange thing: on my Raspi1, the kodi 2:17.4-1~stretch version works fine. However, it seems to be another package that on the Raspi3:
on raspi3:
dpkg -L kodi | grep init :
/usr/share/kodi/addons/service.xbmc.versioncheck/lib/__init__.py
/etc/init.d/kodi

on raspi1:
dpkg -L kodi | grep init:
/usr/share/kodi/addons/service.xbmc.versioncheck/lib/__init__.py

So on the raspi3 an extra /etc/init.d/kodi ?!?

EDIT3:
apt-get install xserver-xorg-core did not solve anything either; perhaps there are dependencies to packages that are available on a fresh raspbian image, but that might be removed in the past on my raspi3?

Rascas
Posts: 283
Joined: Tue Mar 11, 2014 6:18 pm
Location: Porto, Portugal
Contact: Website

Re: Kodi on Raspbian Stretch

Tue Sep 12, 2017 2:50 pm

/etc/init.d/kodi is from an old Kodi version, it is not included in newer packages.
Kodi installs all the needed dependencies, xserver is not one of them, and if you try to remove one dependencie it also removes Kodi. It should not be your probem.

Did you tried starting with a default config/settings? Move your ~/.kodi dir, for it to start with default settings.

dingo35
Posts: 12
Joined: Sat Oct 26, 2013 8:09 am

Re: Kodi on Raspbian Stretch

Tue Sep 12, 2017 3:09 pm

Hi Rascas, thanks for your quick response!

I had already tried with a clean .kodi directory, but that doesn't change anything, still segfault ....

dingo35
Posts: 12
Joined: Sat Oct 26, 2013 8:09 am

Re: Kodi on Raspbian Stretch

Wed Sep 13, 2017 9:14 am

SOLVED kodi 2:17.4-1~stretch segfaulting after upgrading raspbian jessie to stretch:

Turns out a normal upgrade+dist-upgrade leaves A LOT of old packages installed.

The problem on my system was solved by doing:

Code: Select all

aptitude purge libnettle4 libhogweed2 libgnutls-deb0-28
,

where I chose the following solution:

Code: Select all

The following actions will resolve these dependencies:

     Remove the following packages:                                                             
1)     libmicrohttpd10 [0.9.37+dfsg-1+b1 (now)]                                                 

     Downgrade the following packages:                                                          
2)     librtmp1 [2:2.4~20150315.gita107cef9b-dmo1 (now) -> 2.4+20151223.gitfa8646d.1-1 (stable)]


Gustave_Coste
Posts: 4
Joined: Thu Aug 03, 2017 7:18 am

Re: Kodi on Raspbian Stretch

Thu Sep 14, 2017 6:42 am

I updated to Raspbian but I still cannot install Kodi:

Code: Select all

sudo apt-get install kodi
Reading package lists... Done
Building dependency tree
Reading state information... Done
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
kodi : Depends: kodi-bin (>= 2:17.3-1~jessie) but it is not going to be installed
Depends: kodi-bin (< 2:17.3-1~jessie.1~) but it is not going to be installed
Recommends: libva-intel-vaapi-driver but it is not installable
E: Unable to correct problems, you have held broken packages.
Here's my source.list:

Code: Select all

etc/apt/sources.list
deb http://archive.raspbian.org/raspbian stretch main contrib non-free rpi
deb-src http://archive.raspbian.org/raspbian stretch main contrib non-free rpi 
Do I need to add a particular repo?

gkreidl
Posts: 5197
Joined: Thu Jan 26, 2012 1:07 pm
Location: Germany

Re: Kodi on Raspbian Stretch

Thu Sep 14, 2017 7:41 am

cat /etc/apt/sources.list.d/raspi.list

should return:
deb http://archive.raspberrypi.org/debian/ stretch main ui
# Uncomment line below then 'apt-get update' to enable 'apt-get source'
#deb-src http://archive.raspberrypi.org/debian/ stretch main ui
Minimal Kiosk Browser (kweb)
Slim, fast webkit browser with support for audio+video+playlists+youtube+pdf+download
Optional fullscreen kiosk mode and command interface for embedded applications
Includes omxplayerGUI, an X front end for omxplayer

Gustave_Coste
Posts: 4
Joined: Thu Aug 03, 2017 7:18 am

Re: Kodi on Raspbian Stretch

Thu Sep 14, 2017 3:33 pm

That's it, my /etc/apt/sources.list.d/raspi.list had jessie and not stretch repo.

Return to “Raspbian”

Who is online

Users browsing this forum: No registered users and 31 guests