Encourage FUNIX

The consultation of the site is completely free and without advertisements. Donations are nevertheless appreciated to pay for hosting and encourage its author


Media center Kodi

[ Presentation | Installation   | Usage   | Share a database with another machine   | Change movie genres | kodi and homecinemaYoutube extension ]

Media center kodi

Last modified February 20, 2025


This site has been automatically translated with Google Translate from this original page written in french, there may be some translation errors

Presentation

We assume that you have installed the basic libraries for making video .

This page presents kodi formerly known as XBMC, it is a media player, or in other words a "home theater" software. In French, we will say that it is a software dedicated to the multimedia PC generally connected to a TV. The official site is  http://kodi.tv .

Facility

First we will install the following packages by typing the command below:

urpmi swig lib64ass-devel lib64modplug-devel lib64yajl2 lib64tinyxml0 lib64pcrecpp-devel lib64jasper-devel gperf lib64expat-devel gnutls lib64tinyxml-devel gnutls-devel lib64lzo-devel lib64microhttpd-devel lib64uuid-devel lib64avahi-client-devel lib64mariadb-devel python-mako lib64drm-devel llvm-devel python3-devel rapidjson lib64cdio-devel pulseaudio-devel lib64xslt-devel lib64vdpau-devel curl-devel lib64sqlite3-devel taglib-devel lib64freeglut-devel lib64xrandr-devel java lib64spdlog-devel lib64waylandpp-devel lib64gif-devel doxygen lib64dav1d-devellib64flatbuffers-devel lib64mesaegl-devel lib64mesaglesv2-devel lib64gbm-devel dcadec-devel lib64crossguid-devel lib64fstrcmp-devel lib64tinyxml2-devel wayland-protocols-devel edid-decode

for those who have an intel GPU we will also install lib64vdpau-va-gl1 lib64va-devel

We will then install libdisplayinfo which we will find here https://gitlab.freedesktop.org/emersion/libdisplay-info we unzip the archive by typing

tar xvfj libdisplay-info-0.2.0.tar.bz2

this gives the directory libdisplay-info-0.2.0 in which we type

meson setup build
ninja -C build

then as root

cd build
meson install
ln -s /usr/local/linux/multimedia/libdisplay-info-0.2.0/include/libdisplay-info/ /usr/local/include

we finally get the sources of the latest version 21.2 Omega here https://github.com/xbmc/xbmc/releases we unzip it by typing

tar xvfz xbmc-21.2-Omega.tar.gz

this gives the xbmc-21.2-Omega directory in which we type

mkdir build cd build

cmake -DENABLE_BLUETOOTH=OFF -DENABLE_INTERNAL_FFMPEG=ON -DENABLE_SMBCLIENT=OFF -DENABLE_UPNP=OFF -DENABLE_BLURAY=OFF -DENABLE_LCMS2=OFF -DENABLE_LIRCCLIENT=OFF -DMYSQLCLIENT_INCLUDE_DIR=/usr/include/mysql/  -DENABLE_NFS=OFF -DENABLE_SNDIO=OFF -DENABLE_CEC=OFF -DENABLE_CCACHE=OFF -DENABLE_CAP=OFF  -DAPP_RENDER_SYSTEM=gles -DENABLE_MARIADBCLIENT=OFF -DENABLE_CLANGFORMAT=OFF -DLIBDISPLAYINFO_INCLUDE_DIR=/usr/local/linux/multimedia/libdisplay-info-0.2.0 ..

I disabled a bunch of options because I don't need them, I forced the use of an internal version of ffmpeg to avoid compilation errors with a version that is too recent.
I enabled the MySQL option by installing the mariadb-devel package so that the database is common and visible to everyone everywhere on the network. By default the webserver option is enabled, we will see later what it will be used for.

-- #---- CONFIGURATION ----#
-- Platforms: x11 wayland gbm
-- App package: org.xbmc.kodi
-- -- PATH config --
-- Prefix: /usr/local
-- Libdir: /usr/local/lib64
-- Bindir: /usr/local/bin
-- Includedir: /usr/local/include
-- Datarootdir: /usr/local/share
-- Datadir: /usr/local/share
-- Docdir: /usr/local/share/doc/kodi
-- CCACHE enabled: No
-- CLANGFORMAT enabled: No
-- CLANGTIDY enabled: No
-- CPPCHECK enabled: No
-- INCLUDEWHATYOUUSE enabled: No
-- ALSA enabled: Yes
-- AVAHI enabled: Yes
-- BLUETOOTH enabled: No
-- BLURAY enabled: No
-- CAP enabled: No
-- CEC enabled: No
-- DAV1D enabled: Yes
-- DBUS enabled: Yes
-- ISO9660PP enabled: Yes
-- LCMS2 enabled: No
-- LIRCCLIENT enabled: No
-- MDNS enabled: No
-- MICROHTTPD enabled: Yes
-- NFS enabled: No
-- PIPEWIRE enabled: No
-- PLIST enabled: No
-- PULSEAUDIO enabled: Yes
-- PYTHON enabled: Yes
-- SMBCLIENT enabled: No
-- SNDIO enabled: No
-- UDEV enabled: Yes
-- UDFREAD enabled: No
-- XSLT enabled: Yes
-- VAAPI enabled: Yes
-- VAAPI enabled: Yes
-- VAAPI enabled: Yes
-- MARIADBCLIENT enabled: No
-- MYSQLCLIENT enabled: Yes
-- Configuring done (21.5s)
-- Generating done (2.0s)
-- Build files have been written to: /usr/local/linux/multimedia/xbmc-21.2-Omega/build

we then type make then as root make install now to compile the extensions we will type (as root, be careful you must have the git command )

cd ..
make -j5 -C tools/depends/target/binary-addons PREFIX=/usr/local

to install in particular the game extensions we will type:

make -j5 -C tools/depends/target/binary-addons PREFIX=/usr/local ADDONS="game.*"

and we will make sure to delete the traces of an old installation (
/usr/local/share/xbmc or /usr/local/lib/xbmc )



Use

And this is what it looks like with the default Estuary theme, once we've populated it with the movie database and retrieved information for each movie from databases on the net.

 

Movies are categorized by genre, year or actors, movies that have been the subject of several versions are in the "sagas" category. I prefer to skip the genre to select my movie

When you select a film, you have the summary and a whole bunch of information, you can of course view it afterwards.

The same goes for music, this requires that your music files are correctly tagged, please go see here how to do this automatically with MusicBrainz Picard .

In artist search mode

In music playback mode, there is of course a way to create your own playlists.

Kodi also allows you to watch TV online (via the Internet or a box), listen to online radio or view your photos. There are a lot of sites that present Kodi, Media Passion with its forum and wiki is a very good entry point.

[ Back to top of page ]

Share a database with another machine

Now to make your database accessible to everyone on your network regardless of the machine used, we will install it on a MySQL server. On this server we will create a kodi user by typing

mysql -u root -p

here is the result

Enter password:

Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 25
Server version: 5.6.27 Source distribution

Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE USER 'kodi' IDENTIFIED BY 'kodi';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL ON *.* TO 'kodi';
Query OK, 0 rows affected (0.00 sec)

mysql> flush privileges;
Query OK, 0 rows affected (0.00 sec)

Now under kodi with your main user we will export the database from the menu System-> Video Media Library-> Export video media library

To the question Export to a single file or separate files for each element , we answer Separate

To the question Export thumbnails and fanarts , we answer Yes

To the question Export actor thumbnails , we answer Yes

To the question Overwrite old files , we answer Yes

This will create as many .nfo files as there are movies, each .nfo file is in the same directory as the movie it is supposed to describe. This is what it looks like

<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<movie>
    <title>Molière</title>
    <originaltitle>Molière</originaltitle>
    <rating>6.900000</rating>
    <epbookmark>0.000000</epbookmark>
    <year>2007</year>
    <top250>0</top250>
    <votes>14</votes>
    <outline></outline>
    <plot>In 1644, Molière was only twenty-two years old. Riddled with debt and pursued by bailiffs, he persisted in putting on
tragedies in which he was undeniably bad. And then one day, after being imprisoned by impatient creditors, he disappears
...</plot>
    <tagline></tagline>
    <runtime>121</runtime>
    <thumb aspect="poster" preview="http://image.tmdb.org/t/p/w500/hug2HMnzkW2fsvAPyYuBt0Ssg9A.jpg">http://image.tmdb.org/t/p/original/hug2HMnzkW2fs
vAPyYuBt0Ssg9A.jpg</thumb>
    <thumb aspect="poster" preview="http://image.tmdb.org/t/p/w500/9eTXAm7a7jY8tkGRgGtnyUUzKHw.jpg">http://image.tmdb.org/t/p/original/9eTXAm7a7jY8t
kGRgGtnyUUzKHw.jpg</thumb>
    <fanart>
        <thumb preview="http://image.tmdb.org/t/p/w780/nFdQrZM2upgnRsxVHvDzBHh5M8w.jpg">http://image.tmdb.org/t/p/original/nFdQrZM2upgnRsxVHvDzBHh5M
8w.jpg</thumb>
        <thumb preview="http://image.tmdb.org/t/p/w780/xBdllc2nxZBZ1olZA2aWLuuB7eW.jpg">http://image.tmdb.org/t/p/original/xBdllc2nxZBZ1olZA2aWLuuB7
eW.jpg</thumb>
        <thumb preview="http://image.tmdb.org/t/p/w780/wRaODxHVpPUgHWg7iXRCia35sNQ.jpg">http://image.tmdb.org/t/p/original/wRaODxHVpPUgHWg7iXRCia35s
NQ.jpg</thumb>
    </fanart>
    <mpaa>Rated</mpaa>
    <playcount>0</playcount>
    <lastplayed></lastplayed>
    <id>tt0796335</id>
    <genre>Drama</genre>
    <genre>Comedy</genre>
    <genre>Romance</genre>
    <genre>Foreign</genre>
    <country>France</country>
    <set></set>
    <director>Laurent Tirard</director>
    <premiered></premiered>
    <status></status>
    <code></code>
    <aired></aired>
    <trailer>plugin://plugin.video.youtube/?action=play_video&videoid=NySWrKfEa4E</trailer>
    <fileinfo>
        <streamdetails>
            <video>
                <codec>xvid</codec>
                <aspect>2.352941</aspect>
                <width>640</width>
                <height>272</height>
                <durationinseconds>7260</durationinseconds>
                <stereomode></stereomode>
            </video>
            <audio>
                <codec>mp3</codec>
                <language></language>
                <channels>2</channels>
            </audio>
        </streamdetails>
    </fileinfo>
    <actor>
        <name>Romain Duris</name>
        <role>Moliere</role>
        <order>0</order>
        <thumb>http://image.tmdb.org/t/p/original/buU0mFOX7PvSr50F6H8SrN71W08.jpg</thumb>
    </actor>
    <actor>
        <name>Fabrice Luchini</name>
        <role>Mr. Jourdain</role>
        <order>1</order>
        <thumb>http://image.tmdb.org/t/p/original/wtdwJeLGUBkXSm0ElDlsGTDZcJD.jpg</thumb>
    </actor>
    <actor>
        <name>Édouard Baer</name>
        <role>Dorante</role>
        <order>2</order>
        <thumb>http://image.tmdb.org/t/p/original/bevNDP9RQU1b8UdZPElEw4f9fc9.jpg</thumb>
    </actor>
    <actor>
        <name>Ludivine Sagnier</name>
        <role>Celimene</role>
        <order>3</order>
        <thumb>http://image.tmdb.org/t/p/original/sc0yD6DWgYsMKBpKrYqaZDYz8SX.jpg</thumb>
    </actor>
    <resume>
        <position>0.000000</position>
        <total>0.000000</total>
    </resume>
    <dateadded>2010-09-03 10:28:57</dateadded>
</movie>

We will export the music library in the same way. Now under .kodi/userdata we will create the advancedsettings.xml file which will contain

<advancedsettings>
  <videodatabase>
     <type>mysql</type>
     <host>192.168.13.11</host>
     <port>3306</port>
     <user>kodi</user>
     <pass>kodi</pass>
  </videodatabase>
  <videolibrary>
    <importwatchedstate>true</importwatchedstate>
    <importresumepoint>true</importresumepoint>
  </videolibrary>
  <musicdatabase>
     <type>mysql</type>
     <host>192.168.13.11</host>
     <port>3306</port>
     <user>kodi</user>
     <pass>kodi</pass>
  </musicdatabase>
</advancedsettings>

you will need to indicate the IP address of the MySQL server. After restarting, in the .kodi/temp/kodi.log file, we see the steps of the first creation of the tables in debug mode, here is an extract

16:09:20 T:139806471604160 DEBUG: Mysql execute: CREATE INDEX ixMusicVideoBasePath ON musicvideo ( c14(12) )
16:09:20 T:139806471604160 DEBUG: Mysql execute: CREATE INDEX ixEpisodeBasePath ON episode ( c19(12) )
16:09:20 T:139806471604160 DEBUG: Mysql execute: CREATE INDEX ix_streamdetails ON streamdetails (idFile)
16:09:20 T:139806471604160 DEBUG: Mysql execute: CREATE INDEX ix_seasons ON seasons (idShow, season)
16:09:20 T:139806471604160 DEBUG: Mysql execute: CREATE INDEX ix_art ON art(media_id, media_type(20), type(20))
16:09:20 T:139806471604160 DEBUG: Mysql execute: CREATE UNIQUE INDEX ix_tag_1 ON tag (name(255))
16:09:20 T:139806471604160 DEBUG: Mysql execute: CREATE UNIQUE INDEX ix_tag_link_1 ON tag_link (tag_id, media_type(20), media_id)
16:09:20 T:139806471604160 DEBUG: Mysql execute: CREATE UNIQUE INDEX ix_tag_link_2 ON tag_link (media_id, media_type(20), tag_id)
16:09:20 T:139806471604160 DEBUG: Mysql execute: CREATE INDEX ix_tag_link_3 ON tag_link (media_type(20))
16:09:20 T:139806471604160 DEBUG: Mysql execute: CREATE UNIQUE INDEX ix_actor_1 ON actor (name(255))

in phpMyAdmin , I see that the databases MyVideo131 and MyMusic83 have been created. Now for another kodi user, you will need to retrieve this advancedsettings.xml file and place it under its .kodi/userdata directory .

Now to populate the MySQL database, you need to launch Kodi with your main user and update the media library, it will launch a scan as when initializing a new database except that it will read the .nfo files instead of starting from scratch. If that doesn't work, you need to edit the source containing the movies and with the context menu choose Search for new content . This is the kind of thing you can discover by viewing the .kodi/temp/kodi.log file

17:18:30 T:140142598506240 DEBUG: Mysql execute: insert into actor (actor_id, name, art_urls) values(NULL, 'Dharmadasa Kuruppu', '')
17:18:30 T:140142598506240 DEBUG: Mysql execute: INSERT INTO actor_link (actor_id, media_id, media_type, role, cast_order) VALUES(3524,198,'movie','Chieftain',16)
17:18:30 T:140142598506240 DEBUG: Mysql execute: insert into actor (actor_id, name, art_urls) values(NULL, 'Stany De Silva', '')
17:18:30 T:140142598506240 DEBUG: Mysql execute: INSERT INTO actor_link (actor_id, media_id, media_type, role, cast_order) VALUES(3525,198,'movie','Sajnu',17)
17:18:30 T:140142598506240 DEBUG: Mysql execute: insert into actor (actor_id, name, art_urls) values(NULL, 'Ruby de Mel', '')
17:18:31 T:140142598506240 DEBUG: Mysql execute: INSERT INTO actor_link (actor_id, media_id, media_type, role, cast_order) VALUES(3526,198,'movie','Village Woman',18)
17:18:31 T:140142598506240 DEBUG: Mysql execute: insert into actor (actor_id, name, art_urls) values(NULL, 'Denavaka Hamine', '')

We will do the same for the audio library. Now to use this database on other machines with other users, just copy the advancedsettings.xml file to the userdata directory of the other user on another machine. We will also need to copy the Textures13.db file under userdata/Database and the entire userdata/Thumbnails directory.

That's not all, if your files from your initial PC are on the /germaine/video/Films disk, on the other client workstations this directory must be shared by NFS mounting to the other workstations and must be configured as is as a source on these same workstations.

And there, without having to create a media library, reload or scan anything, you can find your database.

[ Back to top of page ]

Change movie genres

I have noticed that often the films are classified a bit haphazardly, for example we will find the cartoon "Beauty and the Beast" in the horror category. There is no way to simply modify the category. On the other hand there are two possibilities, you are configured locally without using a database with the use of .nfo files to describe the films, or you are configured in a database with all the information of your films stored in a SQL database (as described above).

Usage with database

There was a time when there was WiMM which allowed you to modify directly in the Kodi database, you can still find it here https://github.com/slash2009/XWMM which gave something like this


it is unfortunately no longer maintained and is no longer compatible with the latest versions of kodi . I have not found any other solutions than to do it with phpMyAdmin.



In fact, you have to choose the
Kodi movie database, then the movie table and Search , in the c14 field which corresponds to the genre, you put %Fantasy% (without quotes) to select the movies in the Fantasy category, then if a movie is not classified correctly, you have to edit it and change the genre. I readily admit that this is a rather unfriendly method compared to what WiMM could provide.



Usage with .nfo files

kodi does not use a database and relies on .nfo files in your movie directory. We can use MediaElch which can be found here https://github.com/Komet/MediaElch/releases first we will install the following packages lib64mediainfo-devel lib64qt6multimediawidgets-devel lib64qt6sql-devel lib64qt6help-devel and  lib64quazip1-qt6-devel

we unarchive the MediaElch archive by typing

MediaElch-2.12.0.tar.gz

this gives the directory MediaElch-2.12.0 in which we type

mkdir build
cd build
cmake .. -DUSE_EXTERN_QUAZIP=ON -DMEDIAELCH_FORCE_QT6=ON
make

I forced the installation of Qt6 but it is possible to stay in Qt5. Then as root

make install

This is what you get when you type MediaElch




you can select movies of a certain genre



and if a movie is not in the right category, we modify it and MediaElch will modify the .nfo file



MediaElch can do much more, it can act on all the other information of each movie.

Kodi and home cinema

You have a sound bar and/or a multichannel audio home cinema system, it is possible to configure kodi to be able to enjoy it. In fact it is not really plug and play and there are some manipulations to be done on the PC to take into account these audio technologies. It starts with the configuration of PulseAudio , we launch its configuration utility and in the Configuration tab we must point to the HDMI output (since the PC is connected first to the bar, then the bar to the TV), we must not choose the multichannel HDMI outputs 5.1 or 7.1 even if the bar allows it.

Then in the Output Devices tab in the advanced options, I check all the boxes related to the different audio technologies available.

Now under kodi, in the Audio system settings in expert mode, I choose the Audio output device corresponding to the HDMI output, for Output configuration, I put Best match, I check Stereo to multichannel mix (even if I have a doubt that it should be done, to be tested).

Then further down, I check Enable Passthrough mode ( Audio Passthrough ) and all the boxes below.

And there, the difference is even more obvious if we activate Dolby Atmos mode on the sound bar.

Now regarding the audio format of movies, we basically have two choices, the AAC codec and the AC3 (Dolby digital) codec. The first one is a very good choice for sound quality, while the second one was designed for surround sound even though it is known to provide lower quality sound than AAC.

To go further, a little reading, first of all Understanding the different formats of cinema sound, and Obtaining multichannel sound from your computer under Linux.


Youtube extensions

You have the possibility to add a bunch of extensions, for example with the youtube extension. When you launch the youtube extension, you must first click on Connection to associate it with a youtube account, and this is what it looks like when the association is complete.


and here it is with a playlist


[ Back to home ] [ Back to top of page ]