How to disable cuda-nwdec in celluloid or mpv?

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Post Reply
HyperBear
Level 2
Level 2
Posts: 65
Joined: Thu May 04, 2023 3:39 am

How to disable cuda-nwdec in celluloid or mpv?

Post by HyperBear »

TLDR: libcuda causes a five-second delay before a video is played on a non-NVIDIA computer. Why not just uninstall libcuda? It runs from a portable SSD that is used on multiple computers.
–––––

I switched from xserver-xorg-video-nouveau to nvidia-driver-535 inside the "Driver Manager". nvidia-driver-535 wasn't pre-installed so driver manager installed it and then asked me to reboot, which I did.

I originally did this with two intentions:
  • I hoped it would prevent the screen brightness from unsolicitedly going to maximum every time after waking up after the screen times out. It worked.
  • I hoped it would prevent the black screen after unsuspending the computer. It didn't work. I will post about this problem in a separate thread since it is out of scope here.


This Linux Mint instance is running from a portable SSD. I booted it from a different computer which does not have an NVIDIA GPU.

This lead to a problem with celluloid and mpv that was not there before installing nvidia-driver-535: there is a five-second delay before a video starts playing.

In celluloid, this can usually be fixed by removing "hwdec=yes" from the "Extra mpv options" field in the settings menu. In mpv, --hwdec=none accomplishes this. But I prefer using hardware decoding for performance reasons.

Is there any way to prevent mpv or celluloid from getting stuck trying to load NVIDIA CUDA for five seconds? Is there any way that does not require uninstalling anything?

The following terminal output gets stuck for five seconds at [vo/gpu] Loading hwdec driver 'cuda-nvdec', which is line 96.

Terminal output:

Code: Select all

$ mpv --hwdec=vdpau --msg-level=all=v test2.mp4 
[cplayer] Command line options: '--hwdec=vdpau' '--msg-level=all=v' 'test2.mp4'
[cplayer] mpv 0.34.1 Copyright © 2000-2021 mpv/MPlayer/mplayer2 projects
[cplayer]  built on UNKNOWN
[cplayer] FFmpeg library versions:
[cplayer]    libavutil       56.70.100
[cplayer]    libavcodec      58.134.100
[cplayer]    libavformat     58.76.100
[cplayer]    libswscale      5.9.100
[cplayer]    libavfilter     7.110.100
[cplayer]    libswresample   3.9.100
[cplayer] FFmpeg version: 4.4.2-0ubuntu0.22.04.1
[cplayer] 
[cplayer] Configuration: ./waf configure --prefix=/usr --libdir=/usr/lib/x86_64-linux-gnu --confdir=/etc/mpv --zshdir=/usr/share/zsh/vendor-completions --enable-cdda --enable-dvdnav --enable-libmpv-shared --enable-sdl2 --disable-build-date --enable-dvbin
[cplayer] List of enabled features: alsa asm caca cdda cplayer cplugins cuda-hwaccel cuda-interop debug-build drm dvbin dvdnav egl egl-drm egl-helpers egl-x11 ffmpeg ffmpeg-aviocontext-bytes-read ffnvcodec gbm gbm.h gl gl-wayland glibc-thread-name glob glob-posix gpl iconv jack javascript jpeg lcms2 libarchive libass libavdevice libbluray libdl libm libmpv-shared libplacebo librt linux-fstatfs linux-input-event-codes lua lua52 memfd_create optimize plain-gl posix posix-or-mingw pthreads pulse rubberband sdl2 sdl2-audio sdl2-gamepad sdl2-video sixel spirv-cross spirv-cross-shared stdatomic uchardet vaapi vaapi-drm vaapi-egl vaapi-vulkan vaapi-wayland vaapi-x-egl vaapi-x11 vdpau vector vt.h vulkan wayland wayland-protocols x11 xv zimg zlib
[cplayer] Reading config file /etc/mpv/encoding-profiles.conf
[cplayer] Applying profile 'default'...
[cplayer] Reading config file /etc/mpv/mpv.conf
[cplayer] Applying profile 'default'...
[cplayer] Setting option 'hwdec' = 'vaapi' (flags = 4)
[cplayer] Setting option 'hwdec' = 'vdpau' (flags = 8)
[cplayer] Setting option 'msg-level' = 'all=v' (flags = 8)
[ifo_dvdnav] Opening /home/username/.config/mpv/input.conf
[bdmv/bluray] Opening /home/username/.config/mpv/input.conf
[file] Opening /home/username/.config/mpv/input.conf
[input] Parsing input config file /home/username/.config/mpv/input.conf
[input] Input config file /home/username/.config/mpv/input.conf parsed: 1 binds
[cplayer] Waiting for scripts...
[osd/libass] libass API version: 0x1502000
[osd/libass] libass source: tarball: 0.15.2
[osd/libass] Shaper: FriBidi 1.0.8 (SIMPLE) HarfBuzz-ng 2.7.4 (COMPLEX)
[osd/libass] Setting up fonts...
[osd/libass] Using font provider fontconfig
[osd/libass] Done.
[cplayer] Set property: shared-script-properties -> 1
[cplayer] Set property: shared-script-properties -> 1
[cplayer] Done loading scripts.
[cplayer] Running hook: ytdl_hook/on_load
[ytdl_hook] ytdl:// hook 
[ytdl_hook] not a ytdl:// url 
[cplayer] Set property: shared-script-properties -> 1
[ifo_dvdnav] Opening test2.mp4
[bdmv/bluray] Opening test2.mp4
[file] Opening test2.mp4
[demux] Trying demuxers for level=normal.
[cplayer] Set property: shared-script-properties -> 1
[osd/libass] libass API version: 0x1502000
[osd/libass] libass source: tarball: 0.15.2
[osd/libass] Shaper: FriBidi 1.0.8 (SIMPLE) HarfBuzz-ng 2.7.4 (COMPLEX)
[osd/libass] Setting up fonts...
[lavf] Found 'mov,mp4,m4a,3gp,3g2,mj2' at score=100 size=2048.
[demux] Detected file format: mov,mp4,m4a,3gp,3g2,mj2 (libavformat)
[cplayer] Opening done: test2.mp4
[osd/libass] Using font provider fontconfig
[osd/libass] Done.
[find_files] Loading external files in .
[cplayer] Running hook: ytdl_hook/on_preloaded
[lavf] select track 0
[lavf] select track 1
 (+) Video --vid=1 (*) (h264 640x360 23.976fps)
 (+) Audio --aid=1 --alang=eng (*) (aac 2ch 44100Hz)
[vo/gpu] Probing for best GPU context.
[vo/gpu/opengl] Initializing GPU context 'wayland'
[vo/gpu/opengl] Initializing GPU context 'x11egl'
[vo/gpu/x11] X11 opening display: :0
[vo/gpu/x11] Display 0 (eDP-1): [0, 0, 1600, 900] @ 60.112209 FPS
[vo/gpu/x11] Current display FPS: 60.112209
[vo/gpu/opengl] EGL_VERSION=1.5
[vo/gpu/opengl] EGL_VENDOR=Mesa Project
[vo/gpu/opengl] EGL_CLIENT_APIS=OpenGL OpenGL_ES 
[vo/gpu/opengl] Trying to create Desktop OpenGL context.
[vo/gpu/opengl] Choosing visual EGL config 0xa, visual ID 0x21
[vo/gpu/opengl] GL_VERSION='4.6 (Core Profile) Mesa 23.2.1-1ubuntu3.1~22.04.2'
[vo/gpu/opengl] Detected desktop OpenGL 4.6.
[vo/gpu/opengl] GL_VENDOR='Intel'
[vo/gpu/opengl] GL_RENDERER='Mesa Intel(R) HD Graphics 4400 (HSW GT2)'
[vo/gpu/opengl] GL_SHADING_LANGUAGE_VERSION='4.60'
[vo/gpu] Testing FBO format rgba16f
[vo/gpu] Using FBO format rgba16f.
[vo/gpu] No advanced processing required. Enabling dumb mode.
[vo/gpu] Assuming 60.112209 FPS for display sync.
[vd] Container reported FPS: 23.976024
[vd] Codec list:
[vd]     h264 - H.264 / AVC / MPEG-4 AVC / MPEG-4 part 10
[vd]     h264_v4l2m2m (h264) - V4L2 mem2mem H.264 decoder wrapper
[vd]     h264_qsv (h264) - H264 video (Intel Quick Sync Video acceleration)
[vd]     h264_cuvid (h264) - Nvidia CUVID H264 decoder
[vd] Opening decoder h264
[vd] Looking at hwdec h264-vdpau...
[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] Initialized VAAPI: version 1.14
[vo/gpu/vaapi-egl] Going to probe surface formats (may log bogus errors)...
[vo/gpu/vaapi-egl] Done probing surface formats.
[vo/gpu] Loading hwdec driver 'cuda-nvdec'
[vo/gpu/cuda-nvdec] cu->cuInit(0) failed -> CUDA_ERROR_NO_DEVICE: no CUDA-capable device is detected
[vo/gpu] Loading failed.
[vo/gpu] Loading hwdec driver 'drmprime-drm'
[vo/gpu/drmprime-drm] Failed to retrieve DRM fd from native display.
[vo/gpu] Loading failed.
[vd] Could not create device.
[vd] No hardware decoding available for this codec.
[vd] Using software decoding.
[vd] Detected 4 logical cores.
[vd] Requesting 5 threads for decoding.
[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...
[vd] Using software decoding.
[vd] Decoder format: 640x360 yuv420p bt.709/bt.709/bt.1886/limited/auto CL=mpeg2/4/h264
[vf] [in] 640x360 yuv420p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[vf] [userdeint] 640x360 yuv420p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[vf] [userdeint] (disabled)
[vf] [autorotate] 640x360 yuv420p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[vf] [autorotate] (disabled)
[vf] [convert] 640x360 yuv420p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[vf] [convert] (disabled)
[vf] [out] 640x360 yuv420p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[af] [in] 44100Hz stereo 2ch floatp
[af] [userspeed] 44100Hz stereo 2ch floatp
[af] [userspeed] (disabled)
[af] [convert] 44100Hz stereo 2ch floatp
[ao] Trying audio driver 'pulse'
[ao/pulse] requested format: 44100 Hz, stereo channels, floatp
[ao/pulse] Library version: 15.99.0
[ao/pulse] Proto: 35
[ao/pulse] Server proto: 4294967295
[ao/pulse] Channel layouts:
[ao/pulse]  - #fl
[ao/pulse]  - #fr
[ao/pulse]  - #fc
[ao/pulse]  - #lfe
[ao/pulse]  - #bl
[ao/pulse]  - #br
[ao/pulse]  - #flc
[ao/pulse]  - #frc
[ao/pulse]  - #bc
[ao/pulse]  - #sl
[ao/pulse]  - #sr
[ao/pulse]  - #tc
[ao/pulse]  - #tfl
[ao/pulse]  - #tfc
[ao/pulse]  - #tfr
[ao/pulse]  - #tbl
[ao/pulse]  - #tbc
[ao/pulse]  - #tbr
[ao/pulse] result: stereo
[ao/pulse] device buffer: 4410 samples.
[ao/pulse] using soft-buffer of 8820 samples.
AO: [pulse] 44100Hz stereo 2ch float
[cplayer] AO: Description: PulseAudio audio output
[autoconvert] inserting resampler
[swresample] format change, reinitializing resampler
[swresample] 44100Hz stereo floatp -> 44100Hz stereo float
[af] [out] 44100Hz stereo 2ch float
VO: [gpu] 640x360 yuv420p
[cplayer] VO: Description: Shader-based GPU Renderer
[vo/gpu] reconfig to 640x360 yuv420p bt.709/bt.709/bt.1886/limited/display SP=1.000000 CL=mpeg2/4/h264
[vo/gpu/x11] not waiting for MapNotify
[vo/gpu] Resize: 640x360
[vo/gpu] Window size: 640x360 (Borders: l=0 t=0 r=0 b=0)
[vo/gpu] Video source: 640x360 (1:1)
[vo/gpu] Video display: (0, 0) 640x360 -> (0, 0) 640x360
[vo/gpu] Video scale: 1.000000/1.000000
[vo/gpu] OSD borders: l=0 t=0 r=0 b=0
[vo/gpu] Video borders: l=0 t=0 r=0 b=0
[vo/gpu] Reported display depth: 8
[vo/gpu] Texture for plane 0: 640x360
[vo/gpu] Texture for plane 1: 320x180
[vo/gpu] Texture for plane 2: 320x180
[vo/gpu] Testing FBO format rgba16f
[vo/gpu] Using FBO format rgba16f.
[vo/gpu] No advanced processing required. Enabling dumb mode.
[vo/gpu] DR enabled: yes
[cplayer] first video frame after restart shown
[cplayer] audio ready
[cplayer] starting audio playback
[cplayer] playback restart complete @ 0.000000, audio=playing, video=playing
[ao/pulse] starting AO
[cplayer] Set property: shared-script-properties -> 1
AV: 00:00:00 / 00:03:25 (0%) A-V:  0.000
[vo/gpu/x11] Disabling screensaver.
AV: 00:00:01 / 00:03:25 (1%) A-V:  0.000
[cplayer] EOF code: 5  
[cplayer] finished playback, success (reason 3)

Exiting... (Quit)
[cplayer] Set property: shared-script-properties -> 1
[vo/gpu/x11] Enabling screensaver.
Before installing nvidia-driver-535, there was a Cannot load libcuda.so.1
error here:

Code: Select all

(+) Audio --aid=1 --alang=eng (*) (aac 2ch 48000Hz)
Cannot load libcuda.so.1
Using hardware decoding (vaapi).
But the playback started immediately.
Post Reply

Return to “Software & Applications”