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

ffmpeg, mpv: enable hardware-accelerated decoding with CUDA #54392

Merged
merged 1 commit into from Mar 29, 2019

Conversation

ivan
Copy link
Member

@ivan ivan commented Jan 20, 2019

Motivation for this change

NVIDIA users can now use mpv --hwdec=nvdec to play videos that the software decoders cannot keep up with.

I did not touch any configure options, so this should hopefully not cause build errors on unsupported platforms/versions.

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 nox --run "nox-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)
  • Assured whether relevant documentation is up to date
  • Fits CONTRIBUTING.md.

I tested a very similar change applied to master, and I don't really have the build resources to test staging right now, so I am hoping someone can test this on staging.

Test with mpv --hwdec=nvdec --msg-level=vd=debug ... and check mpv's output to make sure it doesn't fall back to software decoding.

8K test content that plays fine at 1.0-1.7x on a 1080 Ti:

youtube-dl -f 272+251 'https://www.youtube.com/watch?v=5MnVakBk850'

Dumb problems that can occur while testing:

[vo/gpu/x11] X11 error: BadValue (integer parameter out of range for operation)
...
[vo/gpu] Could not create GLX context!

Fix: check journalctl -b for NVIDIA version mismatch and reboot to fix.

[vd] Looking at hwdec vp9-nvdec...
[vo/gpu/cuda-nvdec] cu->cuInit(0) failed -> CUDA_ERROR_UNKNOWN: unknown error
[vo/gpu/cuda-nvdec] cu->cuCtxPopCurrent(&dummy) failed -> CUDA_ERROR_NOT_INITIALIZED: initialization error

Fix: modprobe nvidia-uvm if it was previously unloaded or never loaded.

@AndersonTorres
Copy link
Member

Well, I have no CUDA to test :)

@Fuuzetsu
Copy link
Member

I have a GTX 1080 Ti, I can probably test it. Let me try…

@Fuuzetsu
Copy link
Member

Fuuzetsu commented Jan 25, 2019

As far as working, it seems to work. I tried it on the video you provided, hardware acceleration works fine.

Edit: I tried it on top of yesterday's master.

@grahamc
Copy link
Member

grahamc commented Jan 29, 2019

@GrahamcOfBorg build ffmpeg mpv

NVIDIA users can now use `mpv --hwdec=nvdec` to play videos that the
software decoders cannot keep up with.
@infinisil
Copy link
Member

@GrahamcOfBorg build ffmpeg2
@GrahamcOfBorg build ffmpeg3
@GrahamcOfBorg build ffmpeg4
@GrahamcOfBorg build mpv

@infinisil
Copy link
Member

...

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

@infinisil infinisil merged commit a8e1908 into NixOS:staging Mar 29, 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

6 participants