Kodi Community Forum

Full Version: Nvidia 1030 (or higher) 4k HEVC - Ubuntu 16.04. Kodi (kind of) working setup
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So I am one of those who used Nvidia since forever and was under impression that I will get 4k support under Linux.
Well it is working but not with VDPAU but CUVID.
As I understand Kodi developers have good reasons not to use CUVID (or there is lack of working code to support it) and Intel is recommended as hardware platform.
Guessing my next  PC will be kaby lake but for now... Smile

To play 4k HEVC mkvs I have to use mpv as external player within KODI.

This goes over whats needed as far as Nvidia drivers, Cuda and ffmpeg compilation.
https://developer.nvidia.com/ffmpeg

Once it is working you will need to compile mpv.

Finally modify playercorefactory.xml so it fires mpv at certain file types.

I only own one UHD BlueRay of Terminator 2 (classic Smile so I downloaded behemoth mkv file of that movie and use it for test (accept widely available test files)
I do not own 4k TV yet so have no idea if what I am seeing is good or not (picture quality , hdr) but at least it plays now Smile 

I run Nvidia GT1030 with drivers version 387.34. Ubuntu 16.04 with KODI 17.6
Could you share you config for that?
Also stuck with Nvidia, as it was cheaper the to replace the whole PC.
(2018-02-12, 17:49)Slurp Wrote: [ -> ]Could you share you config for that?
Also stuck with Nvidia, as it was cheaper the to replace the whole PC.
 Not sure what are you looking for when you say "config".
First step is going to that link and follow instructions there to set correct drivers for Nvidia, Cuda and ffmpeg compilation.
(2018-02-12, 18:42)uomiarz Wrote: [ -> ]
(2018-02-12, 17:49)Slurp Wrote: [ -> ]...
 Not sure what are you looking for when you say "config".
First step is going to that link and follow instructions there to set correct drivers for Nvidia, Cuda and ffmpeg compilation. 
The playercorefactory.xml config. I already got the mpv running correctly.
But could not find a right way to target 10bit hevc with the playercorefactory.xml
Sorry man. I was out for a while.
Look below.
This will use mpv whenever you pick files that have UHD or 2160p in their names.
You can do some reading on it and modify it. Pretty straight forward.


<playercorefactory>
        <players>
                <player name="mpv" type="ExternalPlayer" audio="false" video="true">
                        <filename>/usr/bin/mpv</filename>
                        <args>--hwdec=cuda --fs "{1}"</args>
                        <hidexbmc>false</hidexbmc>
                        <hideconsole>false</hideconsole>
                        <warpcursor>none</warpcursor>
                </player>
        </players>
        <rules action="prepend">
                <rule video="true" player="dvdplayer">
                <rule filename=".*UHD.*|.*2160p.*" player="mpv"/>
                </rule>
        </rules>
</playercorefactory>
Hello,

Here is my working configuration/install:

1. Install ffmpeg:
  • Download the latest FFmpeg or libav source code, by cloning the corresponding GIT repositories: https://git.ffmpeg.org/ffmpeg.git
  • Download and install the compatible driver from NVIDIA web site
  • Downoad and install the CUDA Toolkit
  • Use the following configure command in FFmpeg dir (Use correct CUDA library path in config command below) 
Code:
./configure --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64
  • Use following command for build:
Code:
make -j 10

2. Install mpv
  • Add mpv PPA
Code:
sudo add-apt-repository ppa:mc3man/mpv-tests
  • Install MPV
Code:
sudo apt-get install mpv
  • If you want to remove it later
Code:
sudo apt-get remove --autoremove mpv

3. Use alternative player (mpv) in KODI if the file name contains the "UHD" or "2160p". (Put the "UHD" or "2160p" in the file name what you want to play in MPV.)
  • Create the playercorefactory.xml in the kodi userdata folder (my folder is here: /home/kodi/.kodi/userdata)
Code:
nano /home/kodi/.kodi/userdata/playercorefactory.xml
  • Copy these lines into the file, and save it:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playercorefactory>
        <players>
                <player name="mpv" type="ExternalPlayer" audio="false" video="true">
                        <filename>/usr/bin/mpv</filename>
                        <args>--log-file=./.config/mpv/log --fs --vo=gpu --hwdec=auto --gpu-api=auto --video-sync=display-resample --icc-profile-auto "{1}"</args>
                        <hidexbmc>false</hidexbmc>
                        <hideconsole>false</hideconsole>
                        <warpcursor>none</warpcursor>
                </player>
        </players>
        <rules action="prepend">
                <rule video="true" player="dvdplayer">
                <rule filename=".*UHD.*|.*2160p.*" player="mpv"/>
                </rule>
        </rules>
</playercorefactory>

4. If done, restart the mediacenter to apply the new playercorefactory config.
5. ENJOY the UHD movies on KODI UBUNTU with NVIDIA CARD
UPDATE!

With the Cuda 10.1 (upgrade) need some extra step to install ffmpeg: And the FFmpeg configure command in the FFmpeg dir is changed to:
Code:
./configure --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64
(2018-12-02, 12:35)vargacs Wrote: [ -> ]Hello,

Here is my working configuration/install:

1. Install ffmpeg:
  • Download the latest FFmpeg or libav source code, by cloning the corresponding GIT repositories: https://git.ffmpeg.org/ffmpeg.git
  • Download and install the compatible driver from NVIDIA web site
  • Downoad and install the CUDA Toolkit
  • Use the following configure command in FFmpeg dir (Use correct CUDA library path in config command below) 
Code:
./configure --enable-cuda --enable-cuvid --enable-nvenc --enable-nonfree --enable-libnpp --extra-cflags=-I/usr/local/cuda/include --extra-ldflags=-L/usr/local/cuda/lib64
  • Use following command for build:
Code:
make -j 10

2. Install mpv
  • Add mpv PPA
Code:
sudo add-apt-repository ppa:mc3man/mpv-tests
  • Install MPV
Code:
sudo apt-get install mpv
  • If you want to remove it later
Code:
sudo apt-get remove --autoremove mpv

3. Use alternative player (mpv) in KODI if the file name contains the "UHD" or "2160p". (Put the "UHD" or "2160p" in the file name what you want to play in MPV.)
  • Create the playercorefactory.xml in the kodi userdata folder (my folder is here: /home/kodi/.kodi/userdata)
Code:
nano /home/kodi/.kodi/userdata/playercorefactory.xml
  • Copy these lines into the file, and save it:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<playercorefactory>
        <players>
                <player name="mpv" type="ExternalPlayer" audio="false" video="true">
                        <filename>/usr/bin/mpv</filename>
                        <args>--log-file=./.config/mpv/log --fs --vo=gpu --hwdec=auto --gpu-api=auto --video-sync=display-resample --icc-profile-auto "{1}"</args>
                        <hidexbmc>false</hidexbmc>
                        <hideconsole>false</hideconsole>
                        <warpcursor>none</warpcursor>
                </player>
        </players>
        <rules action="prepend">
                <rule video="true" player="dvdplayer">
                <rule filename=".*UHD.*|.*2160p.*" player="mpv"/>
                </rule>
        </rules>
</playercorefactory>

4. If done, restart the mediacenter to apply the new playercorefactory config.
5. ENJOY the UHD movies on KODI UBUNTU with NVIDIA CARD 

Thank you so much!  I did end up having to jump through a few additional hoops due to some driver conflicts, but I've FINALLY got HEVC files playing smoothly in Linux.  For anyone attempting this, I recommend removing all traces of existing proprietary nvidia drivers beforehand.  The exact steps to do this might vary from system to system, but I'll attempt some general guidance based on my own experience with Linux Mint 19.2.

- Use Driver Manager to switch to open-source driver
- reboot
- Switch to console mode using CTRL+ SHIFT + F1
- login
- sudo service lightdm stop
- sudo nvidia-installer --uninstall
- sudo apt remove nvidia-*
- reboot

Everything else should be covered sufficiently in the above steps and links above.  As mentioned, I saw success with Linux Mint 19.2 and the most recent driver, which is 430.50 at the time of this post. It's also worth mentioning that I use the analog audio out from this PC, and when playing back HEVC using mpv, setting the audio delay to 100ms (CTRL + +) seems to help.