MPV with NVIDIA driver (+ vdpau, cuda, nvdec), enable high quality profile

Before experiments, make sure that you have any tools to check the temperature and fan speed (RPM) of your video card. Don’t let it to overworking in reasonable conditions. Because each program or hardware may have bugs and flaws. My video card only works well with vdpau and at full 100% power with nvdec and CUDA, so it is overworking with nvdec and CUDA and I don’t use them.

Using VDPAU with NVIDIA proprietary driver

Find which NVIDIA version you are using:

dpkg -l | grep nvidia | grep driver
...
ii  nvidia-legacy-390xx-driver                 390.116-1                    amd64        NVIDIA metapackage (390xx legacy version)
...

If your output lists nvidia-driver package, then you are using modern driver version for modern video cards.

Check this article to find out how to choose and install NVIDIA driver.

Install the necessary package for your driver:

sudo apt install nvidia-vdpau-driver                            # For modern video cards
OR
sudo apt install nvidia-legacy-390xx-vdpau-driver     # For 390xx NVIDIA driver version, this is mine one
OR
sudo apt install nvidia-legacy-340xx-vdpau-driver     # For 340xx NVIDIA driver version

Now we can use VDPAU with MPV. The first command is:

mpv --hwdec=vdpau --vo=vdpau Video.mp4

It uses VDPAU. This command is the best for my video card (GeForce GT 610). CPU load is about 1%.

In the case of VDPAU, if it works there must be a message in our terminal when video starts:

Using hardware decoding (vdpau).

The another command is:

mpv --profile=gpu-hq --hwdec=vdpau --vo=gpu Video.mp4

It enables VDPAU decoding with high quality profile. Maybe you will like this command but it causes overclocking to me.

Note, that –vo=gpu, –profile=gpu-hq doesn’t work with –vo=vdpau.

Add VDPAU and high quality to MPV config

To make the settings permanent for MPV open its config:

nano ~/.config/mpv/mpv.conf

And add the following lines:

hwdec=vdpau
vo=gpu                   # OR vo=vdpau
profile=gpu-hq       # If vo=gpu is used

Now it’s easier:

mpv Video.mp4

Check this article to find out where MPV config file can be located.

“Using hardware decoding (vdpau)” message doesn’t appearing (some codecs are not supported)

In which cases VDPAU doesn’t work?

Video driver for your video card may not have some features, use vdpauinfo utility to see the features (sudo apt install vdpauinfo):

vdpauinfo
Part of my vdpauinfo output. So, my video driver supports h264 video codec, but doesn’t support h265 (HEVC) and VP8, VP9 (Google video codecs)

Using nvdec and CUDA API with MPV

Here are examples with nvdec and CUDA API, but my video card works at full power with them:

mpv --profile=gpu-hq --hwdec=nvdec --vo=gpu Video.mp4
mpv --profile=gpu-hq --hwdec=cuda --vo=gpu Video.mp4
mpv --profile=gpu-hq --hwdec=vdpau --vo=gpu Video.mp4     # VDPAU with GPU renderer as video output, required for high quality profile and video filters (additional mpv options)

What about VAAPI?

VAAPI works through VDPAU. When i used the following command:

mpv --profile=gpu-hq --hwdec=vaapi --vo=vaapi Video.mp4

The following messages appeared:

[vo/vaapi] VA-API is most likely emulated via VDPAU.
[vo/vaapi] It's better to use VDPAU directly with: --vo=vdpau
Using emulated hardware decoding API.

And CPU load was 25%. But VAAPI works fine with nouveau for me (open-sourced and free nvidia driver).

Therefore it is better to use VDPAU with NVIDIA proprietary driver.