Nvidia 1030 (or higher) 4k HEVC - Ubuntu 16.04. Kodi (kind of) working setup
#1
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
Reply
#2
Could you share you config for that?
Also stuck with Nvidia, as it was cheaper the to replace the whole PC.
Reply
#3
(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.
Reply
#4
(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
Reply
#5
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.

xml:

<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>
Reply
#6
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:
<?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
Reply
#7
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
Reply
#8
(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:
<?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.
Reply
#9
@vargacs  Thank you very much for you detail information. I am so glad that at least ffmpeg and mpv has now been updated with NVDEC/NVENC enabled. MPV can utilize NVIDA CUDA.

The only issue with using MPV in KODI is that you are not able to utilise NFS defined by KODI. You have to map NFS locally where KODI is running. This would not be an issue if individual KODI repo is used for each instance. If mariaDB is used and shared among all the instances, the NFS path has to be a universe one and MPV can not play it.
Reply
#10
This just worked a treat in Ubuntu 20.04 although it wasn't plain sailing by a long shot, apart from:

I went through Vargacs post
After the FFMPEG install I couldn't for the life of it find the FFMPEG install directory, I was looking everywhere except ./home, if you can't find it after installing it try a reboot.

Had to run the following:
export PATH=/usr/local/cuda-11.6/bin${PATH:+:${PATH}}

The VLC Git Repo has changed:
git clone https://git.videolan.org/git/ffmpeg/nv-c...eaders.git

I had to install:
sudo apt install nasm yasm

I used:
./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

This was not easy but it works, I could play HVEC files before but for some reason the Laptop fans would be getting ready for take off until the movie was stopped, now it works like a charm using mpv, no loud fans and great quality playback using mpv.

Just posting this in case it's useful for anyone.
Reply
#11
Is there any way channels could be incorporated into this? I even tried changing the channel name to UHD obviously its not a file so does not have the .UHD or .2160 file extension

This is for 422 'feeds' it is absolutely destroying my GT1030/G3258 setup it crashes after 30 seconds

This was using arch which was a slightly different setup to the original post

Image
Reply

Logout Mark Read Team Forum Stats Members Help
Nvidia 1030 (or higher) 4k HEVC - Ubuntu 16.04. Kodi (kind of) working setup1