Using mpv, I have very good 4k playback of a (legally purchased) UHD ripped to MKV with the following config/environment.
Ubuntu 16.04 64-bit
AMD Phenom(tm) II X4 840 Processor × 4
GeForce GTX 1050 Ti/PCIe/SSE2 (4GB DDR5 RAM)
NVIDIA DRIVER VERSION: 410.48
(experimental driver supporting CUDA, from NVIDIA website following their installation instructions, using their packages to add all necessary CUDA support)
https://developer.nvidia.com/cuda-downl … e=deblocal
THEN THIS FOR MPV with CUDA baked in
https://howto-ubuntunew.blogspot.com/20 … er-in.html
mpv compiled from source with CUDA support:
mpv git-2018-10-02-2b0b9bb Copyright © 2000-2018 mpv/MPlayer/mplayer2 projects
built on Mon Oct 8 04:31:35 UTC 2018
ffmpeg library versions:
libavutil 56.19.101
libavcodec 58.32.100
libavformat 58.18.104
libswscale 5.2.100
libavfilter 7.33.100
libswresample 3.2.100
ffmpeg version: git-2018-10-07-3d30874
Success came after switching from cuda to nvdec
/home/<yourhome>/.config/mpv/mpv.conf contains:
hwdec=nvdec
vo=gpu
profile=gpu-hq
=====================
NOTE: There is an 18.04 install for the NVIDIA CUDA support and experimental driver. get it from the site. Other instructions on the web weren't bad, but didn't quite get me there.
Also, previously had a GTX 1030 which had 4K but no CUDA support, didn't work with either CUDA Or VDPAU. Then upgraded to a GeoForce 1050 2GB, which *might* possibly have worked if I had thought to try the nvdec decoder which uses FFMPEG. If you have one, it's worth a try, though I noticed it was maxing out the video card RAM when using cuda. I decided to keep the EVGA Single Fan GTX 1050 TI because it was only $42 more and I like having the 4GB of RAM.
Before I switched to nvdec, the video would play using hardware encoding but had large sections where it stuttered and just rendered sound with a green screen. Always the same spots.
The MPV link below was helpful in figuring out my config:
https://mpv.io/manual/stable/#video
If you run mpv from the command line you can see whether it's using hardware encoding (also, my CPU stayed well under 30% as opposed to hitting 100% on all 4 cores)
If you don't run from command line, on Linux, you can check with nvidia-smi or with the Nvidia control panel to see that the Video Processing engine and GPU are getting a nice little work out. Nothing too serious though for the 1050TI, memory and GPU were well under 50% during playback the whole movie.
The following link is useful for figuring out how to see if mpv is using hardware encoding:
https://negativo17.org/plex-media-playe … with-cuda/
Happy dancing because my 7 year old AMD CPU gets to live on and I save some coin while I sit back and watch how the RYZEN v I9 comparisons play out for my next build.
Good luck on your 4K quest!