Closed xphoniex closed 1 year ago
Do I need to download CUDA for this to work?
Downloading cuda_12.2.1_535.86.10_linux.run right now, but Nvidia's server is dropping my download speed down to 100kb/s, so it's very annoying.
I can set NVD_BACKEND=direct
and get this:
[vd] Opening decoder h264
[vd] Looking at hwdec h264-vaapi...
[vo/gpu] Loading hwdec driver 'vaapi-egl'
[vo/gpu/vaapi-egl] using VAAPI EGL interop
[vo/gpu/vaapi-egl] Trying to open a x11 VA display...
[vo/gpu/vaapi-egl/vaapi] libva: VA-API version 1.14.0
[vo/gpu/vaapi-egl/vaapi] libva: Trying to open /usr/lib/x86_64-linux-gnu/dri/nvidia_drv_video.so
[vo/gpu/vaapi-egl/vaapi] libva: Found init function __vaDriverInit_1_0
[vo/gpu/vaapi-egl/vaapi] libva: va_openDriver() returns 0
[vo/gpu/vaapi-egl/vaapi] Initialized VAAPI: version 1.14
[ffmpeg] AVHWDeviceContext: VAAPI driver: VA-API NVDEC driver [direct backend].
[ffmpeg] AVHWDeviceContext: Driver not found in known nonstandard list, using standard behaviour.
[vo/gpu/vaapi-egl] Going to probe surface formats (may log bogus errors)...
[vo/gpu/vaapi-egl] Supported formats:
[vo/gpu/vaapi-egl] nv12
[vo/gpu/vaapi-egl] p010
[vo/gpu/vaapi-egl] yuv444p
[vo/gpu/vaapi-egl] Done probing surface formats.
[vo/gpu] Loading hwdec driver 'cuda-nvdec'
[vo/gpu] Loading hwdec driver 'drmprime-drm'
[vo/gpu/drmprime-drm] Failed to retrieve DRM fd from native display.
[vo/gpu] Loading failed.
[vd] Trying hardware decoding via h264-vaapi.
[vd] Selected codec: h264 (H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10)
[vf] User filter list:
[vf] (empty)
[ad] Codec list:
[ad] aac - AAC (Advanced Audio Coding)
[ad] aac_fixed (aac) - AAC (Advanced Audio Coding)
[ad] Opening decoder aac
[ad] Requesting 1 threads for decoding.
[ad] Selected codec: aac (AAC (Advanced Audio Coding))
[af] User filter list:
[af] (empty)
[cplayer] Starting playback...
[af] [in] 44100Hz stereo 2ch floatp
[af] [userspeed] 44100Hz stereo 2ch floatp
[af] [userspeed] (disabled)
[af] [convert] 44100Hz stereo 2ch floatp
[vd] Pixel formats supported by decoder: vdpau cuda vaapi_vld yuv420p
[vd] Codec profile: High (0x64)
[vd] Requesting pixfmt 'vaapi_vld' from decoder.
[ffmpeg/video] h264: Reinit context to 1280x640, pix_fmt: vaapi_vld
[vd] Using hardware decoding (vaapi).
but the screen is just green. (I can also see Video Engine Utilization at 0% - 1%)
It's pointless to use this driver with MPV, as that supports using NVDEC directly which is far more efficient.
But any idea why VA-API is not working?
In mpv, if I set hwdec=auto
, I get NVDEC -- it's slower than CPU though :disappointed: .
Marking the issue as complete, but it'd still be nice to know what I did wrong, when setting up VA-API, in case some one comes across this issue via Google, etc.
You could try running it with NVD_LOG=1
set and see if there's anything that points to an issues. But it's probably a question for the MPV devs.
You'll need NVD_BACKEND=direct
set too.
It seems you have an EGL issue. What version of MPV do you have. You need at least v0.35.0 for this to work.
Yeah, I'm on mpv v0.34.1
--
I'm somewhat disappointed as even with NVDEC, which you said is more efficient than VA-API, I still get frame drops and jumps when I seek to another position when playing x265/HEVC file.
I have 13900k/4090, which is the best consumer grade hardware, and still can't get a smooth playback. Is there anything else I can tune?
v0.34.1 doesn't have the patch necessary for it to work with this driver.
As for your performance issue, I'm not sure what could be causing that. Hardware that powerful should have no problem playing back any video. My 5900X/1060 can easily do multiple 4k HEVC streams without issue.
Do you the same issue if you use software decoding? If so, then your issue may be on the presentation side of things, rather than the decode.
I don't even do 4k, mine is 720p x265. I can play just fine, my issue is when I move to another position on the timeline, e.g. jumping a minute ahead/behind. That's when it slows down, starts to drop frames, and jumps to compensate, until it becomes smooth again.
I have this issue with both software and NVDEC.
I encountered the same unfortunateness with video playback in mpv, where when starting a video, or after jumping forward or back, playback would slow down for a while, and eventually become smooth.
I started having the same issue with mpv after refreshing my desktop, going from an Nvidia Geforce 1060 to using amdgpu (integrated graphics on my new processor). I had upgraded from ubuntu 20.04 to 22.04 as part of the hardware refresh, thinking that I needed to in order to get a more recent version of amdgpu. I initially attributed the mpv issue to be due to using the integrated graphics, as mpv playback was fine previously, but I had the same mpv playback issue after throwing the 1060 back in my refreshed system, running 22.04.
I installed the mpv and libcdio18 packages from Ubuntu 20.04 on my 22.04 system (obtained by running 'apt download
$ dpkg -l mpv libcdio18
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name Version Architecture Description
+++-===============-===============-============-======================================
ii libcdio18:amd64 2.0.0-2 amd64 library to read and control CD-ROM
hi mpv 0.32.0-1ubuntu1 amd64 video player based on MPlayer/mplayer2
I think the version of mpv (0.34.1) that comes with ubuntu 22.04 is wonky :-|
@asynapse Thanks for sharing this, I'll give your solution a try.
I noticed a few weeks ago that this issue is less prevalent on Windows, so I tried the updated mpv from snap (0.36) but that didn't help either..
I was looking at my mpv logs and noticed HW Acceleration is not working for me:
vainfo
was returning something similar:va_openDriver() returns -1
I'm on Ubuntu 22.04 LTS Jammy, which the package for, does not exist. You have it for 22.10 but not 22.04.
So I built it from source, (also had to
apt install libdrm-dev
, maybe add it to list?) and now:I have installed my driver using
NVIDIA-Linux-x86_64-525.85.05.run
file, and don't have anything else.now in mpv, I get:
here's nvidia-smi:
Given the line
[vo/gpu/drmprime-drm] Failed to retrieve DRM fd from native display.
, I thought this was a drm issue, so I rebooted and addednvidia_drm.modeset=1
at the end of mylinux ...
line in grub.I tried both
nvidia_drm.modeset
andnvidia-drm.modeset
, but mpv is still using software decoding, and drm seems to be enabled:what's missing? what do I need to do?