Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mpv: --hwdec=nvdec dont work in unstable #218859

Closed
3JlOy-PYCCKUi opened this issue Feb 28, 2023 · 8 comments
Closed

mpv: --hwdec=nvdec dont work in unstable #218859

3JlOy-PYCCKUi opened this issue Feb 28, 2023 · 8 comments
Labels
0.kind: bug Something is broken

Comments

@3JlOy-PYCCKUi
Copy link
Contributor

Describe the bug

mpv with --hwdec=nvdec throws errors

[ffmpeg/video] h264: Cannot load libnvcuvid.so.1
[ffmpeg/video] h264: Failed loading nvcuvid.
[ffmpeg/video] h264: Failed setup for format cuda: hwaccel initialisation returned error.

Steps To Reproduce

Steps to reproduce the behavior:

  1. Open h264 video with mpv from nixos-unstable (it is 7f5639f commit now)
  2. Get errors

Expected behavior

No errors printed

Screenshots

If applicable, add screenshots to help explain your problem.

Additional context

Problem exists in current master (4a6cd14), unstable (7f5639f)

But no issue on commit c2f4e0d (last commit pkgs/applications/video/mpv dir was touched)

i tested this via nix shell github:NixOS/nixpkgs/<commit>#mpv and then open video (direct link to video - https://0x0.st/s/jPdDkhUx1W-W5saPzei__Q/HzN-.mp4)

Notify maintainers

@AndersonTorres
@fpletz
@globin
@Ma27
@tadeokondrak

Metadata

Please run nix-shell -p nix-info --run "nix-info -m" and paste the result.

[user@system:~]$ nix-shell -p nix-info --run "nix-info -m"
 - system: `"x86_64-linux"`
 - host os: `Linux 6.1.13-xanmod1, NixOS, 23.05 (Stoat), 23.05.20230226.7f5639f`
 - multi-user?: `yes`
 - sandbox: `yes`
 - version: `nix-env (Nix) 2.13.2`
 - nixpkgs: `/nix/store/glny4n684v2j01d43l5cy4qixxjarpi6-mzwhfnrlcij1iqvx52pjb8r699xdgvyi-source`
@3JlOy-PYCCKUi 3JlOy-PYCCKUi added the 0.kind: bug Something is broken label Feb 28, 2023
@AndersonTorres
Copy link
Member

Oh boy. I can't help with nvidia hardware things.

@SomeoneSerge
Copy link
Contributor

nix shell github:NixOS/nixpkgs/#mpv

That'd use ffmpeg built without the cudaSupport flag. Unless nvcuvid is one of the "impurely deployed" libraries (go into /run), neither ffmpeg nor MPV would know about it

@3JlOy-PYCCKUi
Copy link
Contributor Author

i did this in my nixpkgs overlays

      (self: super: {
        mpv-nvidia = super.wrapMpv pkgs.mpv-unwrapped-nvidia { };
      })

      (self: super: {
        mpv-unwrapped-nvidia = super.mpv-unwrapped.override {
          ffmpeg_5 = super.ffmpeg_5-full;
        };
      })

i tried both, mpv-nvidia and mpv-unwrapped-nvidia, i still get error
ffmpeg_5-full is built with cuda support

@SomeoneSerge

This comment was marked as off-topic.

@Dulanjala007
Copy link

Dulanjala007 commented Mar 30, 2023

have the same issue...
workaround for now: LD_LIBRARY_PATH=/run/opengl-driver/lib/ mpv video.mkv

@SomeoneSerge
Copy link
Contributor

SomeoneSerge commented Mar 30, 2023

Weird that libnvcuvid.so comes with the driver (nvidia_x11), I didn't expect that. @Dulanjala007 great! The reason it worked for you is that libnvcuvid.so comes with the nvidia driver (nvidia_x11) which is deployed by NixOS impurely at that path

I see we have a broken derivation nixpkgs#nvidia-video-sdk (which currently fails at fetchurl), and it probably should refer to the samples

@SomeoneSerge
Copy link
Contributor

SomeoneSerge commented Mar 30, 2023

@3JlOy-PYCCKUi can you

  • verify if the problem is gone with https://nixpk.gs/pr-tracker.html?pr=217044 being merged? If it's not there must some libs we forgot to patchelf, and we should just migrate ffmpeg from addOpenGLRunpath to cudaPackages.autoAddOpenGLRunpathHook

@SomeoneSerge
Copy link
Contributor

May 31st, the problem appears to have been solved by #217044. Closing the issue, feel free to follow up

# Mpv from a two weeks old nixos-unstable. Can reproduce the nvcuvid error
❯ readlink -f $(which mpv)
/nix/store/maqw3rlx5sq60hkflm40n6lg5j0k7w1m-mpv-with-scripts-0.35.1/bin/mpv
❯ mpv --hwdec=nvdec nix-du-xdot-2.mp4
Error parsing option cache-default (option not found)
/home/ss/.config/mpv/mpv.conf:3: setting option cache-default='4000000' failed.
 (+) Video --vid=1 (*) (h264 3828x2108 10.000fps)
[ffmpeg/video] h264: Cannot load libnvcuvid.so.1
[ffmpeg/video] h264: Failed loading nvcuvid.
[ffmpeg/video] h264: Failed setup for format cuda: hwaccel initialisation returned error.
VO: [gpu] 3828x2108 yuv420p
V: 00:00:00 / 00:00:41 (0%)

Exiting... (Quit)
❯ nix shell --expr '(import (builtins.getFlake github:NixOS/nixpkgs/master) { config = { cudaSupport = true; allowUnfree = true; }; }).mpv' --impure
❯ mpv --hwdec=nvdec nix-du-xdot-2.mp4
Error parsing option cache-default (option not found)
/home/ss/.config/mpv/mpv.conf:3: setting option cache-default='4000000' failed.
 (+) Video --vid=1 (*) (h264 3828x2108 10.000fps)
[ffmpeg/video] h264: Cannot load libnvcuvid.so.1
[ffmpeg/video] h264: Failed loading nvcuvid.
[ffmpeg/video] h264: Failed setup for format cuda: hwaccel initialisation returned error.
VO: [gpu] 3828x2108 yuv420p
V: 00:00:00 / 00:00:41 (0%)

Exiting... (Quit)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0.kind: bug Something is broken
Projects
None yet
Development

No branches or pull requests

4 participants