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, ffmpeg: use addOpenGLRunpath to fix CUDA-accelerated playback #67790

Merged
merged 1 commit into from Sep 16, 2019

Conversation

ivan
Copy link
Member

@ivan ivan commented Aug 30, 2019

Motivation for this change

This fixes #67780.

Currently, using mpv --hwdec=nvdec --msg-level=vd=debug ... on NVIDIA results in:

[vd] Opening decoder hevc
[vd] Looking at hwdec hevc-nvdec...
Cannot load libcuda.so.1
[vd] Could not create device.
[vd] No hardware decoding available for this codec.

With just mpv patched, ffmpeg cannot load libnvcuvid.so.1:

[vd] Opening decoder hevc
[vd] Looking at hwdec hevc-nvdec...
[vd] Trying hardware decoding via hevc-nvdec.
[vd] Selected codec: hevc (HEVC (High Efficiency Video Coding))
[vd] Pixel formats supported by decoder: vaapi_vld cuda yuv420p10le
[vd] Codec profile: Main 10 (0x2)
[vd] Requesting pixfmt 'cuda' from decoder.
[ffmpeg/video] hevc: Cannot load libnvcuvid.so.1
[ffmpeg/video] hevc: Failed loading nvcuvid.
[ffmpeg/video] hevc: Failed setup for format cuda: hwaccel initialisation returned error.

With both mpv and ffmpeg patched, it works:

[vd] Opening decoder hevc
[vd] Looking at hwdec hevc-nvdec...
[vd] Trying hardware decoding via hevc-nvdec.
[vd] Selected codec: hevc (HEVC (High Efficiency Video Coding))
[vd] Pixel formats supported by decoder: vaapi_vld cuda yuv420p10le
[vd] Codec profile: Main 10 (0x2)
[vd] Requesting pixfmt 'cuda' from decoder.
Using hardware decoding (nvdec).
[vd] Decoder format: 3840x2160 cuda[p010] bt.2020-ncl/bt.2020/pq/limited/auto SP=10.000000 CL=unknown (auto 0.000000/0.000000/0.000000)
Things done
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nix-review --run "nix-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.

I tested a very similar commit on master, not staging.

Notify maintainers

mpv: cc @AndersonTorres @Fuuzetsu @fpletz @globin
ffmpeg: cc @codyopel @Fuuzetsu

@ivan
Copy link
Member Author

ivan commented Aug 30, 2019

@GrahamcOfBorg build mpv
@GrahamcOfBorg build ffmpeg_2
@GrahamcOfBorg build ffmpeg_3
@GrahamcOfBorg build ffmpeg_4

matthewbauer added a commit to matthewbauer/nixpkgs that referenced this pull request Aug 30, 2019
Unfortunately there are still a few programs that need this. To avoid
breaking too many things for the 19.09 release, I recommend making
this true. We can disable it again once we feel confident most of
these cases are handled. Relevant issues:

- NixOS#67790
- NixOS#66544
- https://discourse.nixos.org/t/getting-an-error-has-anything-regarding-opengl-in-nixpkgs/3641

/cc @ambrop72 @disassembler @lheckemann
@ivan ivan mentioned this pull request Sep 2, 2019
10 tasks
This fixes NixOS#67780.

Currently, using `mpv --hwdec=nvdec --msg-level=vd=debug` on NVIDIA results in:

```
[vd] Opening decoder hevc
[vd] Looking at hwdec hevc-nvdec...
Cannot load libcuda.so.1
[vd] Could not create device.
[vd] No hardware decoding available for this codec.
```

With just mpv patched, ffmpeg cannot load libnvcuvid.so.1:

```
[vd] Opening decoder hevc
[vd] Looking at hwdec hevc-nvdec...
[vd] Trying hardware decoding via hevc-nvdec.
[vd] Selected codec: hevc (HEVC (High Efficiency Video Coding))
[vd] Pixel formats supported by decoder: vaapi_vld cuda yuv420p10le
[vd] Codec profile: Main 10 (0x2)
[vd] Requesting pixfmt 'cuda' from decoder.
[ffmpeg/video] hevc: Cannot load libnvcuvid.so.1
[ffmpeg/video] hevc: Failed loading nvcuvid.
[ffmpeg/video] hevc: Failed setup for format cuda: hwaccel initialisation returned error.
```

With both mpv and ffmpeg patched, it works:

```
[vd] Opening decoder hevc
[vd] Looking at hwdec hevc-nvdec...
[vd] Trying hardware decoding via hevc-nvdec.
[vd] Selected codec: hevc (HEVC (High Efficiency Video Coding))
[vd] Pixel formats supported by decoder: vaapi_vld cuda yuv420p10le
[vd] Codec profile: Main 10 (0x2)
[vd] Requesting pixfmt 'cuda' from decoder.
Using hardware decoding (nvdec).
[vd] Decoder format: 3840x2160 cuda[p010] bt.2020-ncl/bt.2020/pq/limited/auto SP=10.000000 CL=unknown (auto 0.000000/0.000000/0.000000)
```
@ivan
Copy link
Member Author

ivan commented Sep 6, 2019

Updated to sort the nativeBuildInputs.

@ivan
Copy link
Member Author

ivan commented Sep 6, 2019

@GrahamcOfBorg build mpv
@GrahamcOfBorg build ffmpeg_2
@GrahamcOfBorg build ffmpeg_3
@GrahamcOfBorg build ffmpeg_4

@peti peti merged commit 409ff06 into NixOS:staging Sep 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants